mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-11-12 04:03:42 +08:00
定期清理用户聊天会话上下文 ChatContext
This commit is contained in:
@@ -48,6 +48,12 @@ type ChatSession struct {
|
||||
Username string `json:"user"` // 当前登录的 user
|
||||
}
|
||||
|
||||
// ChatContext 聊天上下文
|
||||
type ChatContext struct {
|
||||
Messages []Message
|
||||
LastAccessTime int64 // 最后一次访问上下文时间
|
||||
}
|
||||
|
||||
func GetDefaultChatRole() map[string]ChatRole {
|
||||
return map[string]ChatRole{
|
||||
"gpt": {
|
||||
|
||||
@@ -22,12 +22,13 @@ type User struct {
|
||||
|
||||
// Chat configs struct
|
||||
type Chat struct {
|
||||
ApiURL string
|
||||
ApiKeys []string
|
||||
Model string
|
||||
Temperature float32
|
||||
MaxTokens int
|
||||
EnableContext bool // 是否保持聊天上下文
|
||||
ApiURL string
|
||||
ApiKeys []string
|
||||
Model string
|
||||
Temperature float32
|
||||
MaxTokens int
|
||||
EnableContext bool // 是否保持聊天上下文
|
||||
ChatContextExpireTime int // 聊天上下文过期时间,单位:秒
|
||||
}
|
||||
|
||||
// Session configs struct
|
||||
|
||||
Reference in New Issue
Block a user