diff --git a/api/handler/admin/chat_app_handler.go b/api/handler/admin/chat_app_handler.go index 4bdda9d6..6763a694 100644 --- a/api/handler/admin/chat_app_handler.go +++ b/api/handler/admin/chat_app_handler.go @@ -113,8 +113,8 @@ func (h *ChatAppHandler) List(c *gin.Context) { role.Id = v.Id role.CreatedAt = v.CreatedAt.Unix() role.UpdatedAt = v.UpdatedAt.Unix() - role.ModelName = modelNameMap[role.ModelId] - role.TypeName = typeNameMap[role.Tid] + role.ModelName = modelNameMap[int(role.ModelId)] + role.TypeName = typeNameMap[int(role.Tid)] roles = append(roles, role) } } diff --git a/api/store/model/chat_role.go b/api/store/model/chat_role.go index f2234f83..46e6b262 100644 --- a/api/store/model/chat_role.go +++ b/api/store/model/chat_role.go @@ -5,18 +5,18 @@ import ( ) type ChatRole struct { - Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"` - 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"` - Marker 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"` - 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"` - 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"` - 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"` - UpdatedAt time.Time `gorm:"column:updated_at;type:datetime;not null" json:"updated_at"` + Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"` + 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"` + 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"` + 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"` + 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"` + 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"` + UpdatedAt time.Time `gorm:"column:updated_at;type:datetime;not null" json:"updated_at"` } func (m *ChatRole) TableName() string { diff --git a/api/store/vo/admin_user.go b/api/store/vo/admin_user.go index 24403be5..70c4a9ea 100644 --- a/api/store/vo/admin_user.go +++ b/api/store/vo/admin_user.go @@ -2,9 +2,8 @@ package vo type AdminUser struct { BaseVo - Username string `json:"username"` - Status bool `json:"status"` // 当前状态 - LastLoginAt int64 `json:"last_login_at"` // 最后登录时间 - LastLoginIp string `json:"last_login_ip"` // 最后登录 IP - RoleIds interface{} `json:"role_ids"` //角色ids + Username string `json:"username"` + Status bool `json:"status"` // 当前状态 + LastLoginAt int64 `json:"last_login_at"` // 最后登录时间 + LastLoginIp string `json:"last_login_ip"` // 最后登录 IP } diff --git a/api/store/vo/chat_role.go b/api/store/vo/chat_role.go index 9ab49cf6..a7d46756 100644 --- a/api/store/vo/chat_role.go +++ b/api/store/vo/chat_role.go @@ -5,14 +5,14 @@ import "geekai/core/types" type ChatRole struct { BaseVo Key string `json:"key"` // 角色唯一标识 - Tid int `json:"tid"` + Tid uint `json:"tid"` Name string `json:"name"` // 角色名称 Context []types.Message `json:"context"` // 角色语料信息 HelloMsg string `json:"hello_msg"` // 打招呼的消息 Icon string `json:"icon"` // 角色聊天图标 Enable bool `json:"enable"` // 是否启用被启用 SortNum int `json:"sort"` // 排序 - ModelId int `json:"model_id"` // 绑定模型 ID + ModelId uint `json:"model_id"` // 绑定模型 ID ModelName string `json:"model_name"` // 模型名称 TypeName string `json:"type_name"` // 分类名称 } diff --git a/api/store/vo/mj_job.go b/api/store/vo/mj_job.go index ab6d99d9..30c5c044 100644 --- a/api/store/vo/mj_job.go +++ b/api/store/vo/mj_job.go @@ -3,7 +3,7 @@ package vo type MidJourneyJob struct { Id uint `json:"id"` Type string `json:"type"` - UserId int `json:"user_id"` + UserId uint `json:"user_id"` ChannelId string `json:"channel_id"` TaskId string `json:"task_id"` MessageId string `json:"message_id"` diff --git a/api/store/vo/page.go b/api/store/vo/page.go index b47d49ee..d148e923 100644 --- a/api/store/vo/page.go +++ b/api/store/vo/page.go @@ -3,14 +3,14 @@ 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"` + Items any `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 { +func NewPage(total int64, page int, pageSize int, items any) Page { totalPage := math.Ceil(float64(total) / float64(pageSize)) return Page{ Items: items, diff --git a/api/store/vo/sd_job.go b/api/store/vo/sd_job.go index dc712dca..861d9712 100644 --- a/api/store/vo/sd_job.go +++ b/api/store/vo/sd_job.go @@ -7,7 +7,7 @@ import ( type SdJob struct { Id uint `json:"id"` Type string `json:"type"` - UserId int `json:"user_id"` + UserId uint `json:"user_id"` TaskId string `json:"task_id"` ImgURL string `json:"img_url"` Params types.SdTaskParams `json:"params"` diff --git a/api/store/vo/suno_job.go b/api/store/vo/suno_job.go index 70dca573..3827d358 100644 --- a/api/store/vo/suno_job.go +++ b/api/store/vo/suno_job.go @@ -2,7 +2,7 @@ package vo type SunoJob struct { Id uint `json:"id"` - UserId int `json:"user_id"` + UserId uint `json:"user_id"` Channel string `json:"channel"` Title string `json:"title"` Type int `json:"type"` diff --git a/api/store/vo/video_job.go b/api/store/vo/video_job.go index b7530132..8ca12291 100644 --- a/api/store/vo/video_job.go +++ b/api/store/vo/video_job.go @@ -2,7 +2,7 @@ package vo type VideoJob struct { Id uint `json:"id"` - UserId int `json:"user_id"` + UserId uint `json:"user_id"` Channel string `json:"channel"` Type string `json:"type"` TaskId string `json:"task_id"`