refactor: 调整项目目录结构,移除其他语言 API 目录

This commit is contained in:
RockYang
2023-07-10 09:42:11 +08:00
parent 2bb7ff3c13
commit d9e340ddc4
58 changed files with 0 additions and 15 deletions

View 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
View File

@@ -0,0 +1,9 @@
package model
import "time"
type BaseModel struct {
Id uint `gorm:"primarykey;column:id"`
CreatedAt time.Time
UpdatedAt time.Time
}

View 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"
}

View 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 // 会话标题
}

View 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 //排序数字
}

View 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
View 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
}

View File

@@ -0,0 +1,9 @@
package model
type UserLoginLog struct {
BaseModel
UserId uint
Username string
LoginIp string
LoginAddress string
}