🎨 重构用户端前端为vue开发,完善基础类和角色相关接口
This commit is contained in:
26
server/model/app/ai_memory.go
Normal file
26
server/model/app/ai_memory.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"git.echol.cn/loser/st/server/global"
|
||||
"github.com/pgvector/pgvector-go"
|
||||
"gorm.io/datatypes"
|
||||
)
|
||||
|
||||
// AIMemoryVector 向量记忆表(使用 pgvector)
|
||||
type AIMemoryVector struct {
|
||||
global.GVA_MODEL
|
||||
UserID uint `json:"userId" gorm:"not null;index;comment:所属用户ID"`
|
||||
User *AppUser `json:"user" gorm:"foreignKey:UserID"`
|
||||
CharacterID *uint `json:"characterId" gorm:"index;comment:所属角色ID"`
|
||||
Character *AICharacter `json:"character" gorm:"foreignKey:CharacterID"`
|
||||
ChatID *uint `json:"chatId" gorm:"index;comment:所属对话ID"`
|
||||
Chat *AIChat `json:"chat" gorm:"foreignKey:ChatID"`
|
||||
Content string `json:"content" gorm:"type:text;not null;comment:文本内容"`
|
||||
Embedding pgvector.Vector `json:"-" gorm:"type:vector(1536);comment:向量嵌入"`
|
||||
Metadata datatypes.JSON `json:"metadata" gorm:"type:jsonb;comment:元数据"`
|
||||
Importance float64 `json:"importance" gorm:"default:0.5;comment:重要性评分"`
|
||||
}
|
||||
|
||||
func (AIMemoryVector) TableName() string {
|
||||
return "ai_memory_vectors"
|
||||
}
|
||||
Reference in New Issue
Block a user