From ff96fada02af83c04af0863762471a0e55be054a Mon Sep 17 00:00:00 2001 From: GeekMaster Date: Tue, 29 Jul 2025 11:35:11 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E9=A6=96=E9=A1=B5=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=E5=90=8C=E6=97=B6=E6=94=AF=E6=8C=81=20iconfo?= =?UTF-8?q?nt=20=E5=92=8C=E8=87=AA=E5=AE=9A=E4=B9=89=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=202.=20=E6=89=80=E6=9C=89=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E5=A4=96=E9=94=AE=E5=AD=97=E6=AE=B5=E9=83=BD=E6=94=B9=E6=88=90?= =?UTF-8?q?int(11)=20=E8=80=8C=E4=B8=8D=E6=98=AF=20bigint?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/service/suno/service.go | 10 ++- api/store/model/chat_item.go | 8 +-- api/store/model/chat_message.go | 4 +- api/store/model/chat_model.go | 2 +- api/store/model/chat_role.go | 4 +- api/store/model/dalle_job.go | 4 +- api/store/model/file.go | 4 +- api/store/model/invite_code.go | 4 +- api/store/model/invite_log.go | 6 +- api/store/model/jimeng_job.go | 2 +- api/store/model/mj_job.go | 4 +- api/store/model/power_log.go | 20 +++--- api/store/model/redeem.go | 8 +-- api/store/model/sd_job.go | 24 +++---- api/store/model/suno_job.go | 48 ++++++------- api/store/model/user_login_log.go | 4 +- api/store/model/video_job.go | 4 +- web/src/views/Index.vue | 72 ++------------------ web/src/views/admin/jimeng/JimengSetting.vue | 29 ++++++++ 19 files changed, 118 insertions(+), 143 deletions(-) diff --git a/api/service/suno/service.go b/api/service/suno/service.go index 6ad07457..6bf11c5e 100644 --- a/api/service/suno/service.go +++ b/api/service/suno/service.go @@ -126,7 +126,7 @@ func (s *Service) Create(task types.SunoTask) (RespVo, error) { return RespVo{}, errors.New("no available API KEY for Suno") } - reqBody := map[string]interface{}{ + reqBody := map[string]any{ "task_id": task.RefTaskId, "continue_clip_id": task.RefSongId, "continue_at": task.ExtendSecs, @@ -330,7 +330,13 @@ func (s *Service) SyncTaskProgress() { job.SongId = v.Id job.Duration = int(v.Metadata.Duration) job.Prompt = v.Metadata.Prompt - job.Tags = v.Metadata.Tags + // 修复 tags 字段过长导致插入数据库失败 + if len(v.Metadata.Tags) > 255 { + job.Tags = v.Metadata.Tags[:255] + } else { + job.Tags = v.Metadata.Tags + } + job.ModelName = v.ModelName job.RawData = utils.JsonEncode(v) job.CoverURL = v.ImageLargeUrl diff --git a/api/store/model/chat_item.go b/api/store/model/chat_item.go index 6e75a41e..2d457bdd 100644 --- a/api/store/model/chat_item.go +++ b/api/store/model/chat_item.go @@ -5,12 +5,12 @@ import ( ) type ChatItem struct { - Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"` + Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"` ChatId string `gorm:"column:chat_id;type:char(40);uniqueIndex;not null;comment:会话 ID" json:"chat_id"` - UserId uint `gorm:"column:user_id;type:int;not null;comment:用户 ID" json:"user_id"` - RoleId uint `gorm:"column:role_id;type:int;not null;comment:角色 ID" json:"role_id"` + UserId uint `gorm:"column:user_id;type:int(11);not null;comment:用户 ID" json:"user_id"` + RoleId uint `gorm:"column:role_id;type:int(11);not null;comment:角色 ID" json:"role_id"` Title string `gorm:"column:title;type:varchar(100);not null;comment:会话标题" json:"title"` - 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(11);not null;default:0;comment:模型 ID" json:"model_id"` Model string `gorm:"column:model;type:varchar(30);comment:模型名称" json:"model"` CreatedAt time.Time `gorm:"column:created_at;type:datetime;not null;comment:创建时间" json:"created_at"` UpdatedAt time.Time `gorm:"column:updated_at;type:datetime;not null;comment:更新时间" json:"updated_at"` diff --git a/api/store/model/chat_message.go b/api/store/model/chat_message.go index b6567a65..b5257951 100644 --- a/api/store/model/chat_message.go +++ b/api/store/model/chat_message.go @@ -6,11 +6,11 @@ import ( type ChatMessage struct { Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"` - UserId uint `gorm:"column:user_id;type:int;not null;comment:用户 ID" json:"user_id"` + UserId uint `gorm:"column:user_id;type:int(11);not null;comment:用户 ID" json:"user_id"` ChatId string `gorm:"column:chat_id;type:char(40);not null;index;comment:会话 ID" json:"chat_id"` Type string `gorm:"column:type;type:varchar(10);not null;comment:类型:prompt|reply" json:"type"` Icon string `gorm:"column:icon;type:varchar(255);not null;comment:角色图标" json:"icon"` - RoleId uint `gorm:"column:role_id;type:int;not null;comment:角色 ID" json:"role_id"` + RoleId uint `gorm:"column:role_id;type:int(11);not null;comment:角色 ID" json:"role_id"` Model string `gorm:"column:model;type:varchar(255);comment:模型名称" json:"model"` Content string `gorm:"column:content;type:text;not null;comment:聊天内容" json:"content"` Tokens int `gorm:"column:tokens;type:smallint;not null;comment:耗费 token 数量" json:"tokens"` diff --git a/api/store/model/chat_model.go b/api/store/model/chat_model.go index cf42e154..2e495906 100644 --- a/api/store/model/chat_model.go +++ b/api/store/model/chat_model.go @@ -18,7 +18,7 @@ type ChatModel struct { MaxTokens int `gorm:"column:max_tokens;type:int;not null;default:1024;comment:最大响应长度" json:"max_tokens"` MaxContext int `gorm:"column:max_context;type:int;not null;default:4096;comment:最大上下文长度" json:"max_context"` Open bool `gorm:"column:open;type:tinyint(1);not null;comment:是否开放模型" json:"open"` - KeyId uint `gorm:"column:key_id;type:int;not null;comment:绑定API KEY ID" json:"key_id"` + KeyId uint `gorm:"column:key_id;type:int(11);not null;comment:绑定API KEY ID" json:"key_id"` Options string `gorm:"column:options;type:text;not null;comment:模型自定义选项" json:"options"` CreatedAt time.Time `gorm:"column:created_at;type:datetime" json:"created_at"` UpdatedAt time.Time `gorm:"column:updated_at;type:datetime" json:"updated_at"` diff --git a/api/store/model/chat_role.go b/api/store/model/chat_role.go index 46e6b262..7ff16646 100644 --- a/api/store/model/chat_role.go +++ b/api/store/model/chat_role.go @@ -7,14 +7,14 @@ 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"` + Tid uint `gorm:"column:tid;type:int(11);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"` + ModelId uint `gorm:"column:model_id;type:int(11);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"` } diff --git a/api/store/model/dalle_job.go b/api/store/model/dalle_job.go index 893832f8..aa244f0e 100644 --- a/api/store/model/dalle_job.go +++ b/api/store/model/dalle_job.go @@ -3,8 +3,8 @@ package model import "time" type DallJob struct { - Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"` - UserId uint `gorm:"column:user_id;type:int;not null;comment:用户ID" json:"user_id"` + Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"` + UserId uint `gorm:"column:user_id;type:int(11);not null;comment:用户ID" json:"user_id"` Prompt string `gorm:"column:prompt;type:text;not null;comment:提示词" json:"prompt"` TaskInfo string `gorm:"column:task_info;type:text;not null;comment:任务详情" json:"task_info"` ImgURL string `gorm:"column:img_url;type:varchar(255);not null;comment:图片地址" json:"img_url"` diff --git a/api/store/model/file.go b/api/store/model/file.go index 4e529d9c..cb68fafa 100644 --- a/api/store/model/file.go +++ b/api/store/model/file.go @@ -3,8 +3,8 @@ package model import "time" type File struct { - Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"` - UserId uint `gorm:"column:user_id;type:int;not null;comment:用户 ID" json:"user_id"` + Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"` + UserId uint `gorm:"column:user_id;type:int(11);not null;comment:用户 ID" json:"user_id"` Name string `gorm:"column:name;type:varchar(255);not null;comment:文件名" json:"name"` ObjKey string `gorm:"column:obj_key;type:varchar(100);comment:文件标识" json:"obj_key"` URL string `gorm:"column:url;type:varchar(255);not null;comment:文件地址" json:"url"` diff --git a/api/store/model/invite_code.go b/api/store/model/invite_code.go index b5bce1e7..f016f74a 100644 --- a/api/store/model/invite_code.go +++ b/api/store/model/invite_code.go @@ -3,8 +3,8 @@ package model import "time" type InviteCode struct { - Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"` - UserId uint `gorm:"column:user_id;type:int;not null;comment:用户ID" json:"user_id"` + Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"` + UserId uint `gorm:"column:user_id;type:int(11);not null;comment:用户ID" json:"user_id"` Code string `gorm:"column:code;type:char(8);uniqueIndex;not null;comment:邀请码" json:"code"` Hits int `gorm:"column:hits;type:int;not null;comment:点击次数" json:"hits"` RegNum int `gorm:"column:reg_num;type:smallint;not null;comment:注册数量" json:"reg_num"` diff --git a/api/store/model/invite_log.go b/api/store/model/invite_log.go index dd5b5ea1..c36e13c8 100644 --- a/api/store/model/invite_log.go +++ b/api/store/model/invite_log.go @@ -5,9 +5,9 @@ import ( ) type InviteLog struct { - Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"` - InviterId uint `gorm:"column:inviter_id;type:int;not null;comment:邀请人ID" json:"inviter_id"` - UserId uint `gorm:"column:user_id;type:int;not null;comment:注册用户ID" json:"user_id"` + Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"` + InviterId uint `gorm:"column:inviter_id;type:int(11);not null;comment:邀请人ID" json:"inviter_id"` + UserId uint `gorm:"column:user_id;type:int(11);not null;comment:注册用户ID" json:"user_id"` Username string `gorm:"column:username;type:varchar(30);not null;comment:用户名" json:"username"` InviteCode string `gorm:"column:invite_code;type:char(8);not null;comment:邀请码" json:"invite_code"` Remark string `gorm:"column:remark;type:varchar(255);not null;comment:备注" json:"remark"` diff --git a/api/store/model/jimeng_job.go b/api/store/model/jimeng_job.go index 93fe8c50..38e21e2f 100644 --- a/api/store/model/jimeng_job.go +++ b/api/store/model/jimeng_job.go @@ -7,7 +7,7 @@ import ( // JimengJob 即梦AI任务模型 type JimengJob struct { Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"` - UserId uint `gorm:"column:user_id;type:int;not null;index;comment:用户ID" json:"user_id"` + UserId uint `gorm:"column:user_id;type:int(11);not null;index;comment:用户ID" json:"user_id"` TaskId string `gorm:"column:task_id;type:varchar(100);not null;index;comment:任务ID" json:"task_id"` Type JMTaskType `gorm:"column:type;type:varchar(50);not null;comment:任务类型" json:"type"` ReqKey string `gorm:"column:req_key;type:varchar(100);comment:请求Key" json:"req_key"` diff --git a/api/store/model/mj_job.go b/api/store/model/mj_job.go index 44010b90..9bbe55fa 100644 --- a/api/store/model/mj_job.go +++ b/api/store/model/mj_job.go @@ -3,8 +3,8 @@ package model import "time" type MidJourneyJob struct { - Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"` - UserId uint `gorm:"column:user_id;type:int;not null;comment:用户 ID" json:"user_id"` + Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"` + UserId uint `gorm:"column:user_id;type:int(11);not null;comment:用户 ID" json:"user_id"` TaskId string `gorm:"column:task_id;type:varchar(20);uniqueIndex;comment:任务 ID" json:"task_id"` TaskInfo string `gorm:"column:task_info;type:text;not null;comment:任务详情" json:"task_info"` Type string `gorm:"column:type;type:varchar(20);default:image;comment:任务类别" json:"type"` diff --git a/api/store/model/power_log.go b/api/store/model/power_log.go index 3e5e403c..38220a80 100644 --- a/api/store/model/power_log.go +++ b/api/store/model/power_log.go @@ -7,16 +7,16 @@ import ( // PowerLog 算力消费日志 type PowerLog struct { - Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"` - UserId uint `gorm:"column:user_id;type:int;not null;comment:用户ID" json:"user_id"` - Username string `gorm:"column:username;type:varchar(30);not null;comment:用户名" json:"username"` - Type types.PowerType `gorm:"column:type;type:tinyint(1);not null;comment:类型(1:充值,2:消费,3:退费)" json:"type"` - Amount int `gorm:"column:amount;type:smallint;not null;comment:算力数值" json:"amount"` - Balance int `gorm:"column:balance;type:int;not null;comment:余额" json:"balance"` - Model string `gorm:"column:model;type:varchar(30);not null;comment:模型" json:"model"` - Remark string `gorm:"column:remark;type:varchar(512);not null;comment:备注" json:"remark"` - Mark types.PowerMark `gorm:"column:mark;type:tinyint(1);not null;comment:资金类型(0:支出,1:收入)" json:"mark"` - CreatedAt time.Time `gorm:"column:created_at;type:datetime;not null;comment:创建时间" json:"created_at"` + Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"` + UserId uint `gorm:"column:user_id;type:int(11);not null;comment:用户ID" json:"user_id"` + Username string `gorm:"column:username;type:varchar(30);not null;comment:用户名" json:"username"` + Type types.PowerType `gorm:"column:type;type:tinyint(1);not null;comment:类型(1:充值,2:消费,3:退费)" json:"type"` + Amount int `gorm:"column:amount;type:smallint;not null;comment:算力数值" json:"amount"` + Balance int `gorm:"column:balance;type:int;not null;comment:余额" json:"balance"` + Model string `gorm:"column:model;type:varchar(255);not null;comment:模型" json:"model"` + Remark string `gorm:"column:remark;type:varchar(512);not null;comment:备注" json:"remark"` + Mark types.PowerMark `gorm:"column:mark;type:tinyint(1);not null;comment:资金类型(0:支出,1:收入)" json:"mark"` + CreatedAt time.Time `gorm:"column:created_at;type:datetime;not null;comment:创建时间" json:"created_at"` } func (m *PowerLog) TableName() string { diff --git a/api/store/model/redeem.go b/api/store/model/redeem.go index 9c399460..2c0bc089 100644 --- a/api/store/model/redeem.go +++ b/api/store/model/redeem.go @@ -5,14 +5,14 @@ import "time" // 兑换码 type Redeem struct { - Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"` - UserId uint `gorm:"column:user_id;type:int;not null;comment:用户 ID" json:"user_id"` + Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"` + UserId uint `gorm:"column:user_id;type:int(11);not null;comment:用户 ID" json:"user_id"` Name string `gorm:"column:name;type:varchar(30);not null;comment:兑换码名称" json:"name"` Power int `gorm:"column:power;type:int;not null;comment:算力" json:"power"` Code string `gorm:"column:code;type:varchar(100);uniqueIndex;not null;comment:兑换码" json:"code"` - Enabled bool `gorm:"column:enabled;type:tinyint(1);not null;comment:是否启用" json:"enabled"` + Enabled bool `gorm:"column:enabled;type:tinyint(1);not null;comment:是否启用" json:"enabled"` CreatedAt time.Time `gorm:"column:created_at;type:datetime;not null" json:"created_at"` - RedeemedAt int64 `gorm:"column:redeemed_at;type:int;not null;comment:兑换时间" json:"redeemed_at"` + RedeemedAt int64 `gorm:"column:redeemed_at;type:int;not null;comment:兑换时间" json:"redeemed_at"` } func (m *Redeem) TableName() string { diff --git a/api/store/model/sd_job.go b/api/store/model/sd_job.go index 13fc4ae0..c681bf96 100644 --- a/api/store/model/sd_job.go +++ b/api/store/model/sd_job.go @@ -3,18 +3,18 @@ package model import "time" type SdJob struct { - Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"` - UserId uint `gorm:"column:user_id;type:int;not null;comment:用户 ID" json:"user_id"` - Type string `gorm:"column:type;type:varchar(20);default:txt2img;comment:任务类别" json:"type"` - TaskId string `gorm:"column:task_id;type:char(30);uniqueIndex;not null;comment:任务 ID" json:"task_id"` - TaskInfo string `gorm:"column:task_info;type:text;not null;comment:任务详情" json:"task_info"` - Prompt string `gorm:"column:prompt;type:text;not null;comment:会话提示词" json:"prompt"` - ImgURL string `gorm:"column:img_url;type:varchar(255);comment:图片URL" json:"img_url"` - Params string `gorm:"column:params;type:text;comment:绘画参数json" json:"params"` - Progress int `gorm:"column:progress;type:smallint;default:0;comment:任务进度" json:"progress"` - Publish int `gorm:"column:publish;type:tinyint(1);not null;comment:是否发布" json:"publish"` - ErrMsg string `gorm:"column:err_msg;type:varchar(1024);comment:错误信息" json:"err_msg"` - Power int `gorm:"column:power;type:smallint;not null;default:0;comment:消耗算力" json:"power"` + Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"` + UserId uint `gorm:"column:user_id;type:int(11);not null;comment:用户 ID" json:"user_id"` + Type string `gorm:"column:type;type:varchar(20);default:txt2img;comment:任务类别" json:"type"` + TaskId string `gorm:"column:task_id;type:char(30);uniqueIndex;not null;comment:任务 ID" json:"task_id"` + TaskInfo string `gorm:"column:task_info;type:text;not null;comment:任务详情" json:"task_info"` + Prompt string `gorm:"column:prompt;type:text;not null;comment:会话提示词" json:"prompt"` + ImgURL string `gorm:"column:img_url;type:varchar(255);comment:图片URL" json:"img_url"` + Params string `gorm:"column:params;type:text;comment:绘画参数json" json:"params"` + Progress int `gorm:"column:progress;type:smallint;default:0;comment:任务进度" json:"progress"` + Publish int `gorm:"column:publish;type:tinyint(1);not null;comment:是否发布" json:"publish"` + ErrMsg string `gorm:"column:err_msg;type:varchar(1024);comment:错误信息" json:"err_msg"` + Power int `gorm:"column:power;type:smallint;not null;default:0;comment:消耗算力" json:"power"` CreatedAt time.Time `gorm:"column:created_at;type:datetime;not null" json:"created_at"` } diff --git a/api/store/model/suno_job.go b/api/store/model/suno_job.go index aebcc016..131ea8a5 100644 --- a/api/store/model/suno_job.go +++ b/api/store/model/suno_job.go @@ -3,31 +3,31 @@ package model import "time" type SunoJob struct { - Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"` - UserId uint `gorm:"column:user_id;type:int;not null;comment:用户 ID" json:"user_id"` - Channel string `gorm:"column:channel;type:varchar(100);not null;comment:渠道" json:"channel"` - Title string `gorm:"column:title;type:varchar(100);comment:歌曲标题" json:"title"` - Type int `gorm:"column:type;type:tinyint(1);default:0;comment:任务类型,1:灵感创作,2:自定义创作" json:"type"` - TaskId string `gorm:"column:task_id;type:varchar(50);comment:任务 ID" json:"task_id"` - TaskInfo string `gorm:"column:task_info;type:text;not null;comment:任务详情" json:"task_info"` - RefTaskId string `gorm:"column:ref_task_id;type:char(50);comment:引用任务 ID" json:"ref_task_id"` - Tags string `gorm:"column:tags;type:varchar(100);comment:歌曲风格" json:"tags"` + Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"` + UserId uint `gorm:"column:user_id;type:int;not null;comment:用户 ID" json:"user_id"` + Channel string `gorm:"column:channel;type:varchar(100);not null;comment:渠道" json:"channel"` + Title string `gorm:"column:title;type:varchar(100);comment:歌曲标题" json:"title"` + Type int `gorm:"column:type;type:tinyint(1);default:0;comment:任务类型,1:灵感创作,2:自定义创作" json:"type"` + TaskId string `gorm:"column:task_id;type:varchar(50);comment:任务 ID" json:"task_id"` + TaskInfo string `gorm:"column:task_info;type:text;not null;comment:任务详情" json:"task_info"` + RefTaskId string `gorm:"column:ref_task_id;type:char(50);comment:引用任务 ID" json:"ref_task_id"` + Tags string `gorm:"column:tags;type:varchar(255);comment:歌曲风格" json:"tags"` Instrumental bool `gorm:"column:instrumental;type:tinyint(1);default:0;comment:是否为纯音乐" json:"instrumental"` - ExtendSecs int `gorm:"column:extend_secs;type:smallint;default:0;comment:延长秒数" json:"extend_secs"` - SongId string `gorm:"column:song_id;type:varchar(50);comment:要续写的歌曲 ID" json:"song_id"` - RefSongId string `gorm:"column:ref_song_id;type:varchar(50);not null;comment:引用的歌曲ID" json:"ref_song_id"` - Prompt string `gorm:"column:prompt;type:varchar(2000);not null;comment:提示词" json:"prompt"` - CoverURL string `gorm:"column:cover_url;type:varchar(512);comment:封面图地址" json:"cover_url"` - AudioURL string `gorm:"column:audio_url;type:varchar(512);comment:音频地址" json:"audio_url"` - ModelName string `gorm:"column:model_name;type:varchar(30);comment:模型地址" json:"model_name"` - Progress int `gorm:"column:progress;type:smallint;default:0;comment:任务进度" json:"progress"` - Duration int `gorm:"column:duration;type:smallint;not null;default:0;comment:歌曲时长" json:"duration"` - Publish int `gorm:"column:publish;type:tinyint(1);not null;comment:是否发布" json:"publish"` - ErrMsg string `gorm:"column:err_msg;type:varchar(1024);comment:错误信息" json:"err_msg"` - RawData string `gorm:"column:raw_data;type:text;comment:原始数据" json:"raw_data"` - Power int `gorm:"column:power;type:smallint;not null;default:0;comment:消耗算力" json:"power"` - PlayTimes int `gorm:"column:play_times;type:int;comment:播放次数" json:"play_times"` - CreatedAt time.Time `gorm:"column:created_at;type:datetime;not null" json:"created_at"` + ExtendSecs int `gorm:"column:extend_secs;type:smallint;default:0;comment:延长秒数" json:"extend_secs"` + SongId string `gorm:"column:song_id;type:varchar(50);comment:要续写的歌曲 ID" json:"song_id"` + RefSongId string `gorm:"column:ref_song_id;type:varchar(50);not null;comment:引用的歌曲ID" json:"ref_song_id"` + Prompt string `gorm:"column:prompt;type:varchar(2000);not null;comment:提示词" json:"prompt"` + CoverURL string `gorm:"column:cover_url;type:varchar(512);comment:封面图地址" json:"cover_url"` + AudioURL string `gorm:"column:audio_url;type:varchar(512);comment:音频地址" json:"audio_url"` + ModelName string `gorm:"column:model_name;type:varchar(30);comment:模型地址" json:"model_name"` + Progress int `gorm:"column:progress;type:smallint;default:0;comment:任务进度" json:"progress"` + Duration int `gorm:"column:duration;type:smallint;not null;default:0;comment:歌曲时长" json:"duration"` + Publish int `gorm:"column:publish;type:tinyint(1);not null;comment:是否发布" json:"publish"` + ErrMsg string `gorm:"column:err_msg;type:varchar(1024);comment:错误信息" json:"err_msg"` + RawData string `gorm:"column:raw_data;type:text;comment:原始数据" json:"raw_data"` + Power int `gorm:"column:power;type:smallint;not null;default:0;comment:消耗算力" json:"power"` + PlayTimes int `gorm:"column:play_times;type:int;comment:播放次数" json:"play_times"` + CreatedAt time.Time `gorm:"column:created_at;type:datetime;not null" json:"created_at"` } func (m *SunoJob) TableName() string { diff --git a/api/store/model/user_login_log.go b/api/store/model/user_login_log.go index 6e878752..2675c43e 100644 --- a/api/store/model/user_login_log.go +++ b/api/store/model/user_login_log.go @@ -5,8 +5,8 @@ import ( ) type UserLoginLog struct { - Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"` - UserId uint `gorm:"column:user_id;type:int;not null;comment:用户ID" json:"user_id"` + Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"` + UserId uint `gorm:"column:user_id;type:int(11);not null;comment:用户ID" json:"user_id"` Username string `gorm:"column:username;type:varchar(30);not null;comment:用户名" json:"username"` LoginIp string `gorm:"column:login_ip;type:char(16);not null;comment:登录IP" json:"login_ip"` LoginAddress string `gorm:"column:login_address;type:varchar(30);not null;comment:登录地址" json:"login_address"` diff --git a/api/store/model/video_job.go b/api/store/model/video_job.go index 500a26b7..7eb8b350 100644 --- a/api/store/model/video_job.go +++ b/api/store/model/video_job.go @@ -3,8 +3,8 @@ package model import "time" type VideoJob struct { - Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"` - UserId uint `gorm:"column:user_id;type:int;not null;comment:用户 ID" json:"user_id"` + Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"` + UserId uint `gorm:"column:user_id;type:int(11);not null;comment:用户 ID" json:"user_id"` Channel string `gorm:"column:channel;type:varchar(100);not null;comment:渠道" json:"channel"` TaskId string `gorm:"column:task_id;type:varchar(100);not null;comment:任务 ID" json:"task_id"` TaskInfo string `gorm:"column:task_info;type:text;comment:原始任务信息" json:"task_info"` diff --git a/web/src/views/Index.vue b/web/src/views/Index.vue index 61354a0e..81c6d4ec 100644 --- a/web/src/views/Index.vue +++ b/web/src/views/Index.vue @@ -69,7 +69,8 @@ class="nav-item-box" @click="router.push(item.url)" > - + +
{{ item.name }}
@@ -87,18 +88,13 @@ import { checkSession, getLicenseInfo, getSystemInfo } from '@/store/cache' import { removeUserToken } from '@/store/session' import { httpGet } from '@/utils/http' import { ElMessage } from 'element-plus' -import { onMounted, onUnmounted, ref } from 'vue' +import { onMounted, ref } from 'vue' import { useRouter } from 'vue-router' const router = useRouter() -// if (isMobile()) { -// router.push('/mobile/index') -// } - const title = ref('') const logo = ref('') -const slogan = ref('') const license = ref({ de_copy: true }) const isLogin = ref(false) @@ -107,24 +103,11 @@ const githubURL = ref(import.meta.env.VITE_GITHUB_URL) const giteeURL = ref(import.meta.env.VITE_GITEE_URL) const navs = ref([]) -const displayedChars = ref([]) -const initAnimation = ref('') -let timer = null // 定时器句柄 - -// 初始化间隔时间和随机时间数组 -const interTime = ref(50) -const interArr = [90, 100, 70, 88, 80, 110, 85, 400, 90, 99] - onMounted(() => { getSystemInfo() .then((res) => { title.value = res.data.title logo.value = res.data.logo - slogan.value = res.data.slogan - - // 确保获取数据后再启动定时器 - if (timer) clearInterval(timer) // 清除已有定时器 - timer = setInterval(setContent, interTime.value) }) .catch((e) => { ElMessage.error('获取系统配置失败:' + e.message) @@ -154,52 +137,9 @@ onMounted(() => { .catch(() => {}) }) -// 组件销毁时清除定时器 -onUnmounted(() => { - if (timer) { - clearInterval(timer) - timer = null - } -}) - -// 打字机内容逐字符显示 -const setContent = () => { - if (!slogan.value) { - if (timer) clearInterval(timer) - timer = setTimeout(setContent, 100) - return - } - - if (initAnimation.value.length >= slogan.value.length) { - // 文本已全部输出 - initAnimation.value = '' - displayedChars.value = [] - if (timer) clearInterval(timer) - timer = setInterval(setContent, interTime.value) - } else { - const nextChar = slogan.value.charAt(initAnimation.value.length) - initAnimation.value += nextChar // 逐字符追加 - displayedChars.value.push(nextChar) - interTime.value = interArr[Math.floor(Math.random() * interArr.length)] // 设置随机间隔 - if (timer) clearInterval(timer) - timer = setInterval(setContent, interTime.value) - } -} -// 计算彩虹色 -const rainbowColor = (index) => { - const hue = (index * 40) % 360 // 每个字符间隔40度,形成彩虹色 - return `hsl(${hue}, 90%, 50%)` // 色调(hue),饱和度(70%),亮度(50%) -} - -const logout = function () { - httpGet('/api/user/logout') - .then(() => { - removeUserToken() - router.push('/login') - }) - .catch((e) => { - ElMessage.error('注销失败:' + e.message) - }) +const logout = () => { + removeUserToken() + router.push('/login') } diff --git a/web/src/views/admin/jimeng/JimengSetting.vue b/web/src/views/admin/jimeng/JimengSetting.vue index 3a1d56c0..d63c09d4 100644 --- a/web/src/views/admin/jimeng/JimengSetting.vue +++ b/web/src/views/admin/jimeng/JimengSetting.vue @@ -12,6 +12,35 @@

秘钥配置

+ +

+ 1. 要使用即梦 AI 功能,需要先在火山引擎控制台开通 + 即梦 AI + 和 + 智能绘图 + 服务。 +

+

+ 2. AccessKey和SecretKey 请在火山引擎控制台 -> + 秘钥管理 + 获取。 +

+