Documentation ¶
Index ¶
- Constants
- func AddTodo(param, userId string) string
- func ClearMsg(param string, userId string) string
- func DelTodo(param, userId string) string
- func DoAction(userId, msg string) (r string, flag bool)
- func GetCoin(param, userId string) string
- func GetModel(param string, userId string) string
- func GetMsgListWithDb[T ChatMsg](botType, userId string, msg T, f func(msg T) db.Msg, f2 func(msg db.Msg) T) []T
- func GetPrompt(param string, userId string) string
- func GetTodoList(param string, userId string) string
- func HmacWithShaTobase64(algorithm, data, key string) string
- func RmPrompt(param string, userId string) string
- func SaveMsgListWithDb[T ChatMsg](botType, userId string, msgList []T, f func(msg T) db.Msg)
- func SetModel(param, userId string) string
- func SetPrompt(param, userId string) string
- func SwitchUserBot(userId string, botType string) string
- func WithTimeChat(userID, msg string, f func(userID, msg string) string) string
- type BaseChat
- type ChatMsg
- type Echo
- type ErrorChat
- type GeminiChat
- type Input
- type Output
- type Parameters
- type QwenChat
- type QwenMessage
- type QwenRequest
- type QwenResponse
- type SimpleChat
- type SimpleGptChat
- type SparkChat
- type SparkMessage
- type SparkResponse
- type SparkResponseHeader
- type Usage
Constants ¶
View Source
const ( GeminiUser = "user" GeminiBot = "model" )
View Source
const ( QwenChatUser = "user" QwenChatBot = "assistant" )
Variables ¶
This section is empty.
Functions ¶
func GetMsgListWithDb ¶
func GetTodoList ¶
func HmacWithShaTobase64 ¶
func SaveMsgListWithDb ¶
func SwitchUserBot ¶
Types ¶
type BaseChat ¶
type BaseChat interface { Chat(userID string, msg string) string HandleMediaMsg(msg *message.MixMessage) string }
func GetChatBot ¶
type ChatMsg ¶
type ChatMsg interface { openai.ChatCompletionMessage | QwenMessage | SparkMessage | *genai.Content }
type Echo ¶
type Echo struct{}
func (*Echo) HandleMediaMsg ¶
func (e *Echo) HandleMediaMsg(msg *message.MixMessage) string
type ErrorChat ¶
type ErrorChat struct {
// contains filtered or unexported fields
}
func (*ErrorChat) HandleMediaMsg ¶
func (e *ErrorChat) HandleMediaMsg(msg *message.MixMessage) string
type GeminiChat ¶
type GeminiChat struct { BaseChat // contains filtered or unexported fields }
type Input ¶
type Input struct {
Messages []QwenMessage `json:"messages"`
}
type Parameters ¶
type Parameters struct { ResultFormat string `json:"result_format"` Seed int `json:"seed"` MaxTokens int `json:"max_tokens"` TopP float64 `json:"top_p"` TopK float64 `json:"top_k"` RepetitionPenalty float64 `json:"repetition_penalty"` Temperature float64 `json:"temperature"` Stop string `json:"stop"` EnableSearch bool `json:"enable_search"` IncrementalOutput bool `json:"incremental_output"` Tools []string `json:"tools"` }
type QwenChat ¶
type QwenChat struct { BaseChat Config *config.QwenConfig // contains filtered or unexported fields }
type QwenMessage ¶
type QwenRequest ¶
type QwenRequest struct { Model string `json:"model"` Input Input `json:"input"` Parameters Parameters `json:"parameters"` }
type QwenResponse ¶
type SimpleChat ¶
type SimpleChat struct { }
func (SimpleChat) HandleMediaMsg ¶
func (s SimpleChat) HandleMediaMsg(msg *message.MixMessage) string
type SimpleGptChat ¶
type SimpleGptChat struct { BaseChat // contains filtered or unexported fields }
type SparkChat ¶
type SparkChat struct { BaseChat Config *config.SparkConfig // contains filtered or unexported fields }
type SparkMessage ¶
type SparkResponse ¶
type SparkResponse struct { Header *SparkResponseHeader `json:"header"` Payload map[string]any `json:"payload"` }
type SparkResponseHeader ¶
type SparkResponseHeader struct { Code int `json:"code"` Message string `json:"message"` Sid string `json:"sid"` Status int `json:"status"` }
func (*SparkResponseHeader) IsFailed ¶
func (header *SparkResponseHeader) IsFailed() bool
func (*SparkResponseHeader) IsSuccess ¶
func (header *SparkResponseHeader) IsSuccess() bool
func (*SparkResponseHeader) ToString ¶
func (header *SparkResponseHeader) ToString() string
Click to show internal directories.
Click to hide internal directories.