mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-11-09 18:53:43 +08:00
rename Token to User, the chat history function is ready
This commit is contained in:
@@ -14,6 +14,14 @@ type Message struct {
|
||||
Content string `json:"content"`
|
||||
}
|
||||
|
||||
// HistoryMessage 历史聊天消息
|
||||
type HistoryMessage struct {
|
||||
Type string `json:"type"`
|
||||
Id string `json:"id"`
|
||||
Icon string `json:"icon"`
|
||||
Content string `json:"content"`
|
||||
}
|
||||
|
||||
type ApiResponse struct {
|
||||
Choices []ChoiceItem `json:"choices"`
|
||||
}
|
||||
@@ -37,7 +45,7 @@ type ChatRole struct {
|
||||
type ChatSession struct {
|
||||
SessionId string `json:"session_id"`
|
||||
ClientIP string `json:"client_ip"` // 客户端 IP
|
||||
Token string `json:"token"` // 当前登录的 token
|
||||
Username string `json:"user"` // 当前登录的 user
|
||||
}
|
||||
|
||||
func GetDefaultChatRole() map[string]ChatRole {
|
||||
|
||||
@@ -13,10 +13,11 @@ type Config struct {
|
||||
Chat Chat
|
||||
}
|
||||
|
||||
type Token struct {
|
||||
type User struct {
|
||||
Name string `json:"name"`
|
||||
MaxCalls int `json:"max_calls"` // 最多调用次数,如果为 0 则表示不限制
|
||||
RemainingCalls int `json:"remaining_calls"` // 剩余调用次数
|
||||
EnableHistory bool `json:"enable_history"` // 是否启用聊天记录
|
||||
}
|
||||
|
||||
// Chat configs struct
|
||||
|
||||
@@ -6,7 +6,7 @@ type BizVo struct {
|
||||
Page int `json:"page,omitempty"`
|
||||
PageSize int `json:"page_size,omitempty"`
|
||||
Total int `json:"total,omitempty"`
|
||||
Message string `json:"message"`
|
||||
Message string `json:"message,omitempty"`
|
||||
Data interface{} `json:"data,omitempty"`
|
||||
}
|
||||
|
||||
@@ -36,5 +36,5 @@ const (
|
||||
ErrorMsg = "系统开小差了"
|
||||
)
|
||||
|
||||
const TokenName = "ChatGPT-Token"
|
||||
const TokenName = "ChatGPT-TOKEN"
|
||||
const SessionKey = "WEB_SSH_SESSION"
|
||||
|
||||
Reference in New Issue
Block a user