mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-11-08 02:03:42 +08:00
refactor: 调整项目目录结构,移除其他语言 API 目录
This commit is contained in:
9
api/store/model/api_key.go
Normal file
9
api/store/model/api_key.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package model
|
||||
|
||||
// ApiKey OpenAI API 模型
|
||||
type ApiKey struct {
|
||||
BaseModel
|
||||
UserId uint //用户ID,系统添加的用户 ID 为 0
|
||||
Value string // API Key 的值
|
||||
LastUsedAt int64 // 最后使用时间
|
||||
}
|
||||
9
api/store/model/base.go
Normal file
9
api/store/model/base.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
type BaseModel struct {
|
||||
Id uint `gorm:"primarykey;column:id"`
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
}
|
||||
16
api/store/model/chat_history.go
Normal file
16
api/store/model/chat_history.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package model
|
||||
|
||||
type HistoryMessage struct {
|
||||
BaseModel
|
||||
ChatId string // 会话 ID
|
||||
UserId uint // 用户 ID
|
||||
RoleId uint // 角色 ID
|
||||
Type string
|
||||
Icon string
|
||||
Tokens int
|
||||
Content string
|
||||
}
|
||||
|
||||
func (HistoryMessage) TableName() string {
|
||||
return "chatgpt_chat_history"
|
||||
}
|
||||
10
api/store/model/chat_item.go
Normal file
10
api/store/model/chat_item.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package model
|
||||
|
||||
type ChatItem struct {
|
||||
BaseModel
|
||||
ChatId string `gorm:"column:chat_id;unique"` // 会话 ID
|
||||
UserId uint // 用户 ID
|
||||
RoleId uint // 角色 ID
|
||||
Model string // 会话模型
|
||||
Title string // 会话标题
|
||||
}
|
||||
12
api/store/model/chat_role.go
Normal file
12
api/store/model/chat_role.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package model
|
||||
|
||||
type ChatRole struct {
|
||||
BaseModel
|
||||
Key string `gorm:"column:marker;unique"` // 角色唯一标识
|
||||
Name string // 角色名称
|
||||
Context string `gorm:"column:context_json"` // 角色语料信息 json
|
||||
HelloMsg string // 打招呼的消息
|
||||
Icon string // 角色聊天图标
|
||||
Enable bool // 是否启用被启用
|
||||
Sort int //排序数字
|
||||
}
|
||||
7
api/store/model/config.go
Normal file
7
api/store/model/config.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package model
|
||||
|
||||
type Config struct {
|
||||
Id uint `gorm:"primarykey;column:id"`
|
||||
Key string `gorm:"column:marker;unique"`
|
||||
Config string `gorm:"column:config_json"`
|
||||
}
|
||||
18
api/store/model/user.go
Normal file
18
api/store/model/user.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package model
|
||||
|
||||
type User struct {
|
||||
BaseModel
|
||||
Username string `gorm:"index:username,unique"`
|
||||
Password string
|
||||
Nickname string
|
||||
Avatar string
|
||||
Salt string // 密码盐
|
||||
Tokens int64 // 剩余tokens
|
||||
Calls int // 剩余对话次数
|
||||
ChatConfig string `gorm:"column:chat_config_json"` // 聊天配置 json
|
||||
ChatRoles string `gorm:"column:chat_roles_json"` // 聊天角色
|
||||
ExpiredTime int64 // 账户到期时间
|
||||
Status bool `gorm:"default:true"` // 当前状态
|
||||
LastLoginAt int64 // 最后登录时间
|
||||
LastLoginIp string // 最后登录 IP
|
||||
}
|
||||
9
api/store/model/user_login_log.go
Normal file
9
api/store/model/user_login_log.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package model
|
||||
|
||||
type UserLoginLog struct {
|
||||
BaseModel
|
||||
UserId uint
|
||||
Username string
|
||||
LoginIp string
|
||||
LoginAddress string
|
||||
}
|
||||
Reference in New Issue
Block a user