mirror of
https://github.com/yangjian102621/geekai.git
synced 2026-04-28 22:14:28 +08:00
修正模型外键的数据类型为 uint
This commit is contained in:
@@ -113,8 +113,8 @@ func (h *ChatAppHandler) List(c *gin.Context) {
|
|||||||
role.Id = v.Id
|
role.Id = v.Id
|
||||||
role.CreatedAt = v.CreatedAt.Unix()
|
role.CreatedAt = v.CreatedAt.Unix()
|
||||||
role.UpdatedAt = v.UpdatedAt.Unix()
|
role.UpdatedAt = v.UpdatedAt.Unix()
|
||||||
role.ModelName = modelNameMap[role.ModelId]
|
role.ModelName = modelNameMap[int(role.ModelId)]
|
||||||
role.TypeName = typeNameMap[role.Tid]
|
role.TypeName = typeNameMap[int(role.Tid)]
|
||||||
roles = append(roles, role)
|
roles = append(roles, role)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,18 +5,18 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type ChatRole struct {
|
type ChatRole struct {
|
||||||
Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
|
Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
|
||||||
Name string `gorm:"column:name;type:varchar(30);not null;comment:角色名称" json:"name"`
|
Name string `gorm:"column:name;type:varchar(30);not null;comment:角色名称" json:"name"`
|
||||||
Tid uint `gorm:"column:tid;type:int;not null;comment:分类ID" json:"tid"`
|
Tid uint `gorm:"column:tid;type:int;not null;comment:分类ID" json:"tid"`
|
||||||
Marker string `gorm:"column:marker;type:varchar(30);uniqueIndex;not null;comment:角色标识" json:"marker"`
|
Key string `gorm:"column:marker;type:varchar(30);uniqueIndex;not null;comment:角色标识" json:"marker"`
|
||||||
Context string `gorm:"column:context_json;type:text;not null;comment:角色语料 json" json:"context_json"`
|
Context string `gorm:"column:context_json;type:text;not null;comment:角色语料 json" json:"context_json"`
|
||||||
HelloMsg string `gorm:"column:hello_msg;type:varchar(255);not null;comment:打招呼信息" json:"hello_msg"`
|
HelloMsg string `gorm:"column:hello_msg;type:varchar(255);not null;comment:打招呼信息" json:"hello_msg"`
|
||||||
Icon string `gorm:"column:icon;type:varchar(255);not null;comment:角色图标" json:"icon"`
|
Icon string `gorm:"column:icon;type:varchar(255);not null;comment:角色图标" json:"icon"`
|
||||||
Enable bool `gorm:"column:enable;type:tinyint(1);not null;comment:是否被启用" json:"enable"`
|
Enable bool `gorm:"column:enable;type:tinyint(1);not null;comment:是否被启用" json:"enable"`
|
||||||
SortNum int `gorm:"column:sort_num;type:smallint;not null;default:0;comment:角色排序" json:"sort_num"`
|
SortNum int `gorm:"column:sort_num;type:smallint;not null;default:0;comment:角色排序" json:"sort_num"`
|
||||||
ModelId uint `gorm:"column:model_id;type:int;not null;default:0;comment:绑定模型ID" json:"model_id"`
|
ModelId uint `gorm:"column:model_id;type:int;not null;default:0;comment:绑定模型ID" json:"model_id"`
|
||||||
CreatedAt time.Time `gorm:"column:created_at;type:datetime;not null" json:"created_at"`
|
CreatedAt time.Time `gorm:"column:created_at;type:datetime;not null" json:"created_at"`
|
||||||
UpdatedAt time.Time `gorm:"column:updated_at;type:datetime;not null" json:"updated_at"`
|
UpdatedAt time.Time `gorm:"column:updated_at;type:datetime;not null" json:"updated_at"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *ChatRole) TableName() string {
|
func (m *ChatRole) TableName() string {
|
||||||
|
|||||||
@@ -2,9 +2,8 @@ package vo
|
|||||||
|
|
||||||
type AdminUser struct {
|
type AdminUser struct {
|
||||||
BaseVo
|
BaseVo
|
||||||
Username string `json:"username"`
|
Username string `json:"username"`
|
||||||
Status bool `json:"status"` // 当前状态
|
Status bool `json:"status"` // 当前状态
|
||||||
LastLoginAt int64 `json:"last_login_at"` // 最后登录时间
|
LastLoginAt int64 `json:"last_login_at"` // 最后登录时间
|
||||||
LastLoginIp string `json:"last_login_ip"` // 最后登录 IP
|
LastLoginIp string `json:"last_login_ip"` // 最后登录 IP
|
||||||
RoleIds interface{} `json:"role_ids"` //角色ids
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,14 +5,14 @@ import "geekai/core/types"
|
|||||||
type ChatRole struct {
|
type ChatRole struct {
|
||||||
BaseVo
|
BaseVo
|
||||||
Key string `json:"key"` // 角色唯一标识
|
Key string `json:"key"` // 角色唯一标识
|
||||||
Tid int `json:"tid"`
|
Tid uint `json:"tid"`
|
||||||
Name string `json:"name"` // 角色名称
|
Name string `json:"name"` // 角色名称
|
||||||
Context []types.Message `json:"context"` // 角色语料信息
|
Context []types.Message `json:"context"` // 角色语料信息
|
||||||
HelloMsg string `json:"hello_msg"` // 打招呼的消息
|
HelloMsg string `json:"hello_msg"` // 打招呼的消息
|
||||||
Icon string `json:"icon"` // 角色聊天图标
|
Icon string `json:"icon"` // 角色聊天图标
|
||||||
Enable bool `json:"enable"` // 是否启用被启用
|
Enable bool `json:"enable"` // 是否启用被启用
|
||||||
SortNum int `json:"sort"` // 排序
|
SortNum int `json:"sort"` // 排序
|
||||||
ModelId int `json:"model_id"` // 绑定模型 ID
|
ModelId uint `json:"model_id"` // 绑定模型 ID
|
||||||
ModelName string `json:"model_name"` // 模型名称
|
ModelName string `json:"model_name"` // 模型名称
|
||||||
TypeName string `json:"type_name"` // 分类名称
|
TypeName string `json:"type_name"` // 分类名称
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package vo
|
|||||||
type MidJourneyJob struct {
|
type MidJourneyJob struct {
|
||||||
Id uint `json:"id"`
|
Id uint `json:"id"`
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
UserId int `json:"user_id"`
|
UserId uint `json:"user_id"`
|
||||||
ChannelId string `json:"channel_id"`
|
ChannelId string `json:"channel_id"`
|
||||||
TaskId string `json:"task_id"`
|
TaskId string `json:"task_id"`
|
||||||
MessageId string `json:"message_id"`
|
MessageId string `json:"message_id"`
|
||||||
|
|||||||
@@ -3,14 +3,14 @@ package vo
|
|||||||
import "math"
|
import "math"
|
||||||
|
|
||||||
type Page struct {
|
type Page struct {
|
||||||
Items interface{} `json:"items"`
|
Items any `json:"items"`
|
||||||
Page int `json:"page"`
|
Page int `json:"page"`
|
||||||
PageSize int `json:"page_size"`
|
PageSize int `json:"page_size"`
|
||||||
Total int64 `json:"total"`
|
Total int64 `json:"total"`
|
||||||
TotalPage int `json:"total_page"`
|
TotalPage int `json:"total_page"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewPage(total int64, page int, pageSize int, items interface{}) Page {
|
func NewPage(total int64, page int, pageSize int, items any) Page {
|
||||||
totalPage := math.Ceil(float64(total) / float64(pageSize))
|
totalPage := math.Ceil(float64(total) / float64(pageSize))
|
||||||
return Page{
|
return Page{
|
||||||
Items: items,
|
Items: items,
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
type SdJob struct {
|
type SdJob struct {
|
||||||
Id uint `json:"id"`
|
Id uint `json:"id"`
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
UserId int `json:"user_id"`
|
UserId uint `json:"user_id"`
|
||||||
TaskId string `json:"task_id"`
|
TaskId string `json:"task_id"`
|
||||||
ImgURL string `json:"img_url"`
|
ImgURL string `json:"img_url"`
|
||||||
Params types.SdTaskParams `json:"params"`
|
Params types.SdTaskParams `json:"params"`
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package vo
|
|||||||
|
|
||||||
type SunoJob struct {
|
type SunoJob struct {
|
||||||
Id uint `json:"id"`
|
Id uint `json:"id"`
|
||||||
UserId int `json:"user_id"`
|
UserId uint `json:"user_id"`
|
||||||
Channel string `json:"channel"`
|
Channel string `json:"channel"`
|
||||||
Title string `json:"title"`
|
Title string `json:"title"`
|
||||||
Type int `json:"type"`
|
Type int `json:"type"`
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package vo
|
|||||||
|
|
||||||
type VideoJob struct {
|
type VideoJob struct {
|
||||||
Id uint `json:"id"`
|
Id uint `json:"id"`
|
||||||
UserId int `json:"user_id"`
|
UserId uint `json:"user_id"`
|
||||||
Channel string `json:"channel"`
|
Channel string `json:"channel"`
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
TaskId string `json:"task_id"`
|
TaskId string `json:"task_id"`
|
||||||
|
|||||||
Reference in New Issue
Block a user