mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-11-08 02:03:42 +08:00
refactor: refactor chat_handler, add support for Azure and ChatGLM
This commit is contained in:
@@ -3,7 +3,7 @@ package model
|
||||
// ApiKey OpenAI API 模型
|
||||
type ApiKey struct {
|
||||
BaseModel
|
||||
UserId uint //用户ID,系统添加的用户 ID 为 0
|
||||
Platform string
|
||||
Value string // API Key 的值
|
||||
LastUsedAt int64 // 最后使用时间
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package model
|
||||
|
||||
import "gorm.io/gorm"
|
||||
|
||||
type HistoryMessage struct {
|
||||
BaseModel
|
||||
ChatId string // 会话 ID
|
||||
@@ -10,6 +12,7 @@ type HistoryMessage struct {
|
||||
Tokens int
|
||||
Content string
|
||||
UseContext bool // 是否可以作为聊天上下文
|
||||
DeletedAt gorm.DeletedAt
|
||||
}
|
||||
|
||||
func (HistoryMessage) TableName() string {
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package model
|
||||
|
||||
import "gorm.io/gorm"
|
||||
|
||||
type ChatItem struct {
|
||||
BaseModel
|
||||
ChatId string `gorm:"column:chat_id;unique"` // 会话 ID
|
||||
UserId uint // 用户 ID
|
||||
RoleId uint // 角色 ID
|
||||
Model string // 会话模型
|
||||
Title string // 会话标题
|
||||
ChatId string `gorm:"column:chat_id;unique"` // 会话 ID
|
||||
UserId uint // 用户 ID
|
||||
RoleId uint // 角色 ID
|
||||
ModelId uint // 会话模型
|
||||
Title string // 会话标题
|
||||
DeletedAt gorm.DeletedAt
|
||||
}
|
||||
|
||||
10
api/store/model/chat_model.go
Normal file
10
api/store/model/chat_model.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package model
|
||||
|
||||
type ChatModel struct {
|
||||
BaseModel
|
||||
Platform string
|
||||
Name string
|
||||
Value string // API Key 的值
|
||||
SortNum int
|
||||
Enabled bool
|
||||
}
|
||||
@@ -2,13 +2,11 @@ package model
|
||||
|
||||
type User struct {
|
||||
BaseModel
|
||||
Username string `gorm:"index:username,unique"`
|
||||
Mobile string
|
||||
Password string
|
||||
Nickname string
|
||||
Avatar string
|
||||
Salt string // 密码盐
|
||||
Tokens int64 // 剩余tokens
|
||||
TotalTokens int64 // 总消耗 tokens
|
||||
Calls int // 剩余对话次数
|
||||
ImgCalls int // 剩余绘图次数
|
||||
ChatConfig string `gorm:"column:chat_config_json"` // 聊天配置 json
|
||||
|
||||
Reference in New Issue
Block a user