From 628ae15fd7894e3ca1a42a11b5aa0ca33a0b5168 Mon Sep 17 00:00:00 2001 From: GeekMaster Date: Thu, 8 May 2025 15:32:29 +0800 Subject: [PATCH] =?UTF-8?q?=E8=81=8A=E5=A4=A9=E8=AE=B0=E5=BD=95=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E5=90=8D=E7=A7=B0=E6=94=B9=E6=88=90=20255?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 3 +++ api/store/model/chat_history.go | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ff0f4eff..2ae19b84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,12 @@ # 更新日志 + ## v4.2.4 + - 功能新增:管理后台支持设置默认昵称 - 功能优化:支持 Suno v4.5 模型支持 - 功能新增:用户注册和用户登录增加用户协议和隐私政策功能,需要用户同意协议才可注册和登录。 - 功能优化:修改重新回答功能,撤回千面的问答内容为可编辑内容,撤回的内容不会增加额外的上下文 +- 功能优化:优化聊天记录的存储结构,增加模型名称字段,支持存储更长的模型名称 ## v4.2.3 diff --git a/api/store/model/chat_history.go b/api/store/model/chat_history.go index 393b99c9..63078c99 100644 --- a/api/store/model/chat_history.go +++ b/api/store/model/chat_history.go @@ -6,16 +6,16 @@ import ( type ChatMessage struct { Id int64 `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;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"` - Model string `gorm:"column:model;type:varchar(30);comment:模型名称" json:"model"` + RoleId uint `gorm:"column:role_id;type:int;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"` TotalTokens int `gorm:"column:total_tokens;type:int;not null;comment:消耗总Token长度" json:"total_tokens"` - UseContext bool `gorm:"column:use_context;type:tinyint(1);not null;comment:是否允许作为上下文语料" json:"use_context"` + UseContext bool `gorm:"column:use_context;type:tinyint(1);not null;comment:是否允许作为上下文语料" json:"use_context"` 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"` }