🎨 优化角色卡功能模块,后续待优化图像上传&前端流畅性待优化

This commit is contained in:
2026-02-11 05:33:38 +08:00
parent 56e821b222
commit cf3197929e
12 changed files with 576 additions and 198 deletions

View File

@@ -9,26 +9,31 @@ import (
// AICharacter AI 角色表
type AICharacter struct {
global.GVA_MODEL
Name string `json:"name" gorm:"type:varchar(500);not null;comment:角色名称"`
Description string `json:"description" gorm:"type:text;comment:角色描述"`
Personality string `json:"personality" gorm:"type:text;comment:角色性格"`
Scenario string `json:"scenario" gorm:"type:text;comment:角色场景"`
Avatar string `json:"avatar" gorm:"type:varchar(1024);comment:角色头像"`
CreatorID *uint `json:"creatorId" gorm:"index;comment:创建者ID"`
Creator *AppUser `json:"creator" gorm:"foreignKey:CreatorID"`
CreatorName string `json:"creatorName" gorm:"type:varchar(200);comment:创建者名称"`
CreatorNotes string `json:"creatorNotes" gorm:"type:text;comment:创建者备注"`
CardData datatypes.JSON `json:"cardData" gorm:"type:jsonb;not null;comment:角色卡片数据"`
Tags pq.StringArray `json:"tags" gorm:"type:text[];comment:角色标签"`
IsPublic bool `json:"isPublic" gorm:"default:false;index;comment:是否公开"`
Version int `json:"version" gorm:"default:1;comment:角色版本"`
FirstMessage string `json:"firstMessage" gorm:"type:text;comment:第一条消息"`
ExampleMessages pq.StringArray `json:"exampleMessages" gorm:"type:text[];comment:消息示例"`
TotalChats int `json:"totalChats" gorm:"default:0;comment:对话总数"`
TotalLikes int `json:"totalLikes" gorm:"default:0;comment:点赞总数"`
UsageCount int `json:"usageCount" gorm:"default:0;comment:使用次数"`
FavoriteCount int `json:"favoriteCount" gorm:"default:0;comment:收藏次数"`
TokenCount int `json:"tokenCount" gorm:"default:0;comment:Token数量"`
Name string `json:"name" gorm:"type:varchar(500);not null;comment:角色名称"`
Description string `json:"description" gorm:"type:text;comment:角色描述"`
Personality string `json:"personality" gorm:"type:text;comment:角色性格"`
Scenario string `json:"scenario" gorm:"type:text;comment:角色场景"`
Avatar string `json:"avatar" gorm:"type:varchar(1024);comment:角色头像"`
CreatorID *uint `json:"creatorId" gorm:"index;comment:创建者ID"`
Creator *AppUser `json:"creator" gorm:"foreignKey:CreatorID"`
CreatorName string `json:"creatorName" gorm:"type:varchar(200);comment:创建者名称"`
CreatorNotes string `json:"creatorNotes" gorm:"type:text;comment:创建者备注"`
CardData datatypes.JSON `json:"cardData" gorm:"type:jsonb;not null;comment:角色卡片数据"`
Tags pq.StringArray `json:"tags" gorm:"type:text[];comment:角色标签"`
IsPublic bool `json:"isPublic" gorm:"default:false;index;comment:是否公开"`
Version int `json:"version" gorm:"default:1;comment:角色版本"`
FirstMessage string `json:"firstMessage" gorm:"type:text;comment:第一条消息"`
ExampleMessages pq.StringArray `json:"exampleMessages" gorm:"type:text[];comment:消息示例"`
SystemPrompt string `json:"systemPrompt" gorm:"type:text;comment:系统提示词"`
PostHistoryInstructions string `json:"postHistoryInstructions" gorm:"type:text;comment:后置历史指令"`
AlternateGreetings pq.StringArray `json:"alternateGreetings" gorm:"type:text[];comment:备用问候语"`
CharacterBook datatypes.JSON `json:"characterBook" gorm:"type:jsonb;comment:角色书/世界信息"`
Extensions datatypes.JSON `json:"extensions" gorm:"type:jsonb;comment:扩展数据(depth_prompt等)"`
TotalChats int `json:"totalChats" gorm:"default:0;comment:对话总数"`
TotalLikes int `json:"totalLikes" gorm:"default:0;comment:点赞总数"`
UsageCount int `json:"usageCount" gorm:"default:0;comment:使用次数"`
FavoriteCount int `json:"favoriteCount" gorm:"default:0;comment:收藏次数"`
TokenCount int `json:"tokenCount" gorm:"default:0;comment:Token数量"`
}
func (AICharacter) TableName() string {