backend

package
v1.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 28, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChatGPT           = "ChatGPT"
	ChatGPTUnofficial = "ChatGPTUnofficial"
	NewBingUnofficial = "NewBingUnofficial"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountInfo

type AccountInfo struct {
	ChatEngine        string `json:"chat_engine"`
	OpenaiApiKey      string `json:"openai_api_key"`
	BaseURL           string `json:"base_url"`
	OpenaiAccessToken string `json:"openai_access_token"`
	NewbingCookies    string `json:"newbing_cookies"`
	Proxy             string `json:"proxy"`
}

type AccountState

type AccountState struct {
	AccountInfo AccountInfo `json:"account_info"`
}

type ChatMessage

type ChatMessage struct {
	Role            string     `json:"role"`
	ID              string     `json:"id"`
	ParentMessageID string     `json:"parentMessageId"`
	ConversationID  string     `json:"conversationId"`
	Text            string     `json:"text"`
	Delta           string     `json:"delta"`
	Detail          DetailInfo `json:"detail"`
}

func (*ChatMessage) Byte

func (msg *ChatMessage) Byte() []byte

func (*ChatMessage) String

func (msg *ChatMessage) String() string

type ChoiceInfo

type ChoiceInfo struct {
	Delta        DeltaInfo   `json:"delta"`
	Index        int         `json:"index"`
	FinishReason interface{} `json:"finish_reason"`
}

type DeltaInfo

type DeltaInfo struct {
	Content string `json:"content"`
	Role    string `json:"role"`
}

type DetailInfo

type DetailInfo struct {
	ID      string       `json:"id"`
	Object  string       `json:"object"`
	Created int64        `json:"created"`
	Model   string       `json:"model"`
	Choices []ChoiceInfo `json:"choices"`
}

type FailMessage

type FailMessage struct {
	Message string      `json:"message"`
	Data    interface{} `json:"data"`
	Status  string      `json:"status"`
}

Fail Message {"message":"tnames: Host: bypass.duti.tech. is not in the","data":null,"status":"Fail"}

func (*FailMessage) Byte

func (msg *FailMessage) Byte() []byte

func (*FailMessage) String

func (msg *FailMessage) String() string

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(sk, proxy string) *Server

func (*Server) Init

func (s *Server) Init(ctx context.Context)

func (*Server) SetAccountState added in v1.1.1

func (s *Server) SetAccountState(accountState AccountState)

func (*Server) Start

func (s *Server) Start()

type Setting

type Setting struct {
	// contains filtered or unexported fields
}

func NewSetting

func NewSetting(str string) *Setting

func (*Setting) ChatSk

func (s *Setting) ChatSk() string

newbingCookies

func (*Setting) Engine

func (s *Setting) Engine() string

ChatGPT ChatGPT

func (*Setting) Proxy

func (s *Setting) Proxy() string

Directories

Path Synopsis
chatbot
bot

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL