Documentation ¶
Index ¶
- Variables
- func SetLogMode(mode log.Mode)
- type AskRequest
- type AskRequestCallBack
- type AskRequestResponseCallBack
- type CallbackMessageResponse
- type GetSettingResponse
- type GptInterface
- type GptMessage
- type GptType
- type MultiUserGpt
- type PoeGPT
- func (poe *PoeGPT) AddConsumer(configure *messageQueue.ConsumerConfigure)
- func (poe *PoeGPT) GetHistory() (*PoeGetHistoryMessage, error)
- func (poe *PoeGPT) GetMessageId() string
- func (poe *PoeGPT) GetMidCidAndPid() (string, string, string)
- func (poe *PoeGPT) GetSettings() (seq string, hash string, boxName string, channel string, err error)
- func (poe *PoeGPT) NewPoeRequest(parentMessageId, prompt string) *PoeRequest
- func (poe *PoeGPT) PoeRequest(httpMethod, urlStr string, body *bytes.Reader) (*http.Response, error)
- func (poe *PoeGPT) PoeWsClient() bool
- func (poe *PoeGPT) Publish(message *messageQueue.Message)
- func (poe *PoeGPT) ReOpenWsClient()
- func (poe *PoeGPT) RemoveConsumer(consumerName string)
- func (poe *PoeGPT) SetConversationID(cid string)
- func (poe *PoeGPT) SetParentMessageID(parentMessageID string)
- func (poe *PoeGPT) Talk(ctx context.Context, askRequest *AskRequest) (*GptMessage, error)
- type PoeGetHistoryMessage
- type PoeGetHistoryPayload
- type PoeHistoryNode
- type PoeRequest
- type PoeResponse
- type PoeSendMessageResponse
- type RequestConnType
- type UserChat
- func (u *UserChat) Ask(askRequest *AskRequest)
- func (u *UserChat) NewMessageNotify(askRequest *AskRequest, lastResponse *GptMessage, ctx context.Context, ...) *messageQueue.ConsumerConfigure
- func (u *UserChat) NewPersistenceConsumer() *messageQueue.ConsumerConfigure
- func (u *UserChat) NewPoeGpt(store *UserStore)
- type UserStore
Constants ¶
This section is empty.
Variables ¶
View Source
var ( LOG_DEBUG log.Mode = log.DEBUG LOG_SILENCE log.Mode = log.SILENCE LOG_ERROR log.Mode = log.ERROR )
View Source
var RequestConnTypeHttpEventStream = 4
Functions ¶
func SetLogMode ¶ added in v1.0.4
Types ¶
type AskRequest ¶
type AskRequest struct { UserId int64 Question string CallbackFuncName string AskResponseCallBack AskRequestResponseCallBack }
AskRequest like the JSONP callback if you are older ,you know what i mean:) CallbackFuncName when your client send it to server, also reply back to client when you are using websocket.Send, you can build a global callback function to handle the response
type AskRequestCallBack ¶
type AskRequestCallBack func(askRequest *AskRequest, response []byte)
type AskRequestResponseCallBack ¶
type AskRequestResponseCallBack func(askRequest *AskRequest, message *CallbackMessageResponse)
type CallbackMessageResponse ¶ added in v1.0.8
type CallbackMessageResponse struct { Type string `json:"type"` CallbackFuncName string `json:"callback_func_name"` Data *GptMessage `json:"data"` }
type GetSettingResponse ¶ added in v1.0.3
type GetSettingResponse struct { Formkey string `json:"formkey"` TchannelData struct { MinSeq string `json:"minSeq"` Channel string `json:"channel"` ChannelHash string `json:"channelHash"` BoxName string `json:"boxName"` BaseHost string `json:"baseHost"` TargetUrl string `json:"targetUrl"` EnableWebsocket bool `json:"enableWebsocket"` } `json:"tchannelData"` }
type GptInterface ¶
type GptInterface interface { Talk(ctx context.Context, askRequest *AskRequest) (*GptMessage, error) Publish(message *messageQueue.Message) AddConsumer(consumer *messageQueue.ConsumerConfigure) RemoveConsumer(consumerName string) GetMessageId() string SetConversationID(cid string) SetParentMessageID(parentMessageID string) GetMidCidAndPid() (mid, cid, pid string) }
type GptMessage ¶
type GptType ¶
type GptType uint
var GptTypeBingGpt GptType = 1
var GptTypeOfficialApi GptType = 3
var GptTypePoeUnofficial GptType = 4
var GptTypeUnOfficial GptType = 2
type MultiUserGpt ¶
func NewMutLtiUserGpt ¶
func NewMutLtiUserGpt(gptType GptType) *MultiUserGpt
func (*MultiUserGpt) Talk ¶
func (m *MultiUserGpt) Talk(askRequest *AskRequest)
type PoeGPT ¶
type PoeGPT struct { MessageBus *messageQueue.MemoryMessageQueue PoeURl string MessageID, ConversationID, ParentMessageID string // contains filtered or unexported fields }
func NewPoeGPT ¶
func NewPoeGPT(parentMessageID string, messageConsumer *messageQueue.ConsumerConfigure) *PoeGPT
func (*PoeGPT) AddConsumer ¶
func (poe *PoeGPT) AddConsumer(configure *messageQueue.ConsumerConfigure)
func (*PoeGPT) GetHistory ¶
func (poe *PoeGPT) GetHistory() (*PoeGetHistoryMessage, error)
func (*PoeGPT) GetMessageId ¶
func (*PoeGPT) GetSettings ¶
func (*PoeGPT) NewPoeRequest ¶
func (poe *PoeGPT) NewPoeRequest(parentMessageId, prompt string) *PoeRequest
func (*PoeGPT) PoeRequest ¶ added in v1.0.3
func (*PoeGPT) PoeWsClient ¶
func (*PoeGPT) Publish ¶
func (poe *PoeGPT) Publish(message *messageQueue.Message)
func (*PoeGPT) ReOpenWsClient ¶
func (poe *PoeGPT) ReOpenWsClient()
func (*PoeGPT) RemoveConsumer ¶
func (*PoeGPT) SetConversationID ¶
func (*PoeGPT) SetParentMessageID ¶
func (*PoeGPT) Talk ¶
func (poe *PoeGPT) Talk(ctx context.Context, askRequest *AskRequest) (*GptMessage, error)
type PoeGetHistoryMessage ¶
type PoeGetHistoryMessage struct { Data struct { ChatOfBot struct { Id string `json:"id"` Typename string `json:"__typename"` MessagesConnection struct { Typename string `json:"__typename"` PageInfo struct { Typename string `json:"__typename"` HasPreviousPage bool `json:"hasPreviousPage"` } `json:"pageInfo"` Edges []struct { Typename string `json:"__typename"` Node PoeHistoryNode `json:"node"` } `json:"edges"` } `json:"messagesConnection"` } `json:"chatOfBot"` } `json:"data"` Extensions struct { IsFinal bool `json:"is_final"` } `json:"extensions"` }
type PoeGetHistoryPayload ¶ added in v1.0.3
type PoeHistoryNode ¶
type PoeHistoryNode struct { Typename string `json:"__typename"` Id string `json:"id"` MessageId int `json:"messageId"` Text string `json:"text"` LinkifiedText string `json:"linkifiedText"` AuthorNickname string `json:"authorNickname"` State string `json:"state"` Vote interface{} `json:"vote"` VoteReason interface{} `json:"voteReason"` CreationTime int64 `json:"creationTime"` SuggestedReplies []string `json:"suggestedReplies"` }
type PoeRequest ¶
type PoeResponse ¶
type PoeSendMessageResponse ¶
type PoeSendMessageResponse struct { Data struct { MessageEdgeCreate struct { Typename string `json:"__typename"` Message struct { Typename string `json:"__typename"` Node struct { Typename string `json:"__typename"` Id string `json:"id"` MessageId int `json:"messageId"` Text string `json:"text"` LinkifiedText string `json:"linkifiedText"` AuthorNickname string `json:"authorNickname"` State string `json:"state"` Vote interface{} `json:"vote"` VoteReason interface{} `json:"voteReason"` CreationTime int64 `json:"creationTime"` SuggestedReplies []string `json:"suggestedReplies"` Chat struct { Typename string `json:"__typename"` Id string `json:"id"` ShouldShowDisclaimer bool `json:"shouldShowDisclaimer"` } `json:"chat"` } `json:"node"` } `json:"message"` ChatBreak interface{} `json:"chatBreak"` } `json:"messageEdgeCreate"` } `json:"data"` Extensions struct { IsFinal bool `json:"is_final"` } `json:"extensions"` }
type RequestConnType ¶
type RequestConnType int
var RequestConnTypeGrpc RequestConnType = 3
var RequestConnTypeJSON RequestConnType = 2
var RequestConnTypeWebsocket RequestConnType = 1
type UserChat ¶
type UserChat struct { UserId int64 Gpt GptInterface // contains filtered or unexported fields }
func (*UserChat) Ask ¶
func (u *UserChat) Ask(askRequest *AskRequest)
func (*UserChat) NewMessageNotify ¶
func (u *UserChat) NewMessageNotify(askRequest *AskRequest, lastResponse *GptMessage, ctx context.Context, cancel context.CancelFunc) *messageQueue.ConsumerConfigure
func (*UserChat) NewPersistenceConsumer ¶
func (u *UserChat) NewPersistenceConsumer() *messageQueue.ConsumerConfigure
Source Files ¶
Click to show internal directories.
Click to hide internal directories.