fix: fixed conflicts

This commit is contained in:
RockYang
2023-07-10 10:11:17 +08:00
64 changed files with 14 additions and 21 deletions

9
api/store/vo/api_key.go Normal file
View File

@@ -0,0 +1,9 @@
package vo
// ApiKey OpenAI API 模型
type ApiKey struct {
BaseVo
UserId uint `json:"user_id"` //用户ID系统添加的用户 ID 为 0
Value string `json:"value"` // API Key 的值
LastUsedAt int64 `json:"last_used_at"` // 最后使用时间
}

7
api/store/vo/base.go Normal file
View File

@@ -0,0 +1,7 @@
package vo
type BaseVo struct {
Id uint `json:"id"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}

View File

@@ -0,0 +1,16 @@
package vo
type HistoryMessage struct {
BaseVo
ChatId string `json:"chat_id"`
UserId uint `json:"user_id"`
RoleId uint `json:"role_id"`
Type string `json:"type"`
Icon string `json:"icon"`
Tokens int `json:"tokens"`
Content string `json:"content"`
}
func (HistoryMessage) TableName() string {
return "chatgpt_chat_history"
}

11
api/store/vo/chat_item.go Normal file
View File

@@ -0,0 +1,11 @@
package vo
type ChatItem struct {
BaseVo
UserId uint `json:"user_id"`
Icon string `json:"icon"`
RoleId uint `json:"role_id"`
ChatId string `json:"chat_id"`
Model string `json:"model"`
Title string `json:"title"`
}

14
api/store/vo/chat_role.go Normal file
View File

@@ -0,0 +1,14 @@
package vo
import "chatplus/core/types"
type ChatRole struct {
BaseVo
Key string `json:"key"` // 角色唯一标识
Name string `json:"name"` // 角色名称
Context []types.Message `json:"context"` // 角色语料信息
HelloMsg string `json:"hello_msg"` // 打招呼的消息
Icon string `json:"icon"` // 角色聊天图标
Enable bool `json:"enable"` // 是否启用被启用
Sort int `json:"sort"` // 排序
}

10
api/store/vo/config.go Normal file
View File

@@ -0,0 +1,10 @@
package vo
import "chatplus/core/types"
type Config struct {
Id uint `json:"id"`
Key string `json:"key"`
ChatConfig types.ChatConfig `json:"chat_config"`
SystemConfig types.SystemConfig `json:"system_config"`
}

22
api/store/vo/page.go Normal file
View File

@@ -0,0 +1,22 @@
package vo
import "math"
type Page struct {
Items interface{} `json:"items"`
Page int `json:"page"`
PageSize int `json:"page_size"`
Total int64 `json:"total"`
TotalPage int `json:"total_page"`
}
func NewPage(total int64, page int, pageSize int, items interface{}) Page {
totalPage := math.Ceil(float64(total) / float64(pageSize))
return Page{
Items: items,
Page: page,
PageSize: pageSize,
Total: total,
TotalPage: int(totalPage),
}
}

20
api/store/vo/user.go Normal file
View File

@@ -0,0 +1,20 @@
package vo
import "chatplus/core/types"
type User struct {
BaseVo
Username string `json:"username"`
Mobile string `json:"mobile"`
Nickname string `json:"nickname"`
Avatar string `json:"avatar"`
Salt string `json:"salt"` // 密码盐
Tokens int64 `json:"tokens"` // 剩余tokens
Calls int `json:"calls"` // 剩余对话次数
ChatConfig types.ChatConfig `json:"chat_config"` // 聊天配置
ChatRoles []string `json:"chat_roles"` // 聊天角色集合
ExpiredTime int64 `json:"expired_time"` // 账户到期时间
Status bool `json:"status"` // 当前状态
LastLoginAt int64 `json:"last_login_at"` // 最后登录时间
LastLoginIp string `json:"last_login_ip"` // 最后登录 IP
}

View File

@@ -0,0 +1,9 @@
package vo
type UserLoginLog struct {
BaseVo
UserId uint `json:"user_id"`
Username string `json:"username"`
LoginIp string `json:"login_ip"`
LoginAddress string `json:"login_address"`
}