31 lines
1.3 KiB
Go
31 lines
1.3 KiB
Go
package model
|
||
|
||
// Embedding 向量嵌入模型,用于知识库检索
|
||
type Embedding struct {
|
||
ID string `json:"id"` // 向量唯一标识
|
||
ContentHash string `json:"content_hash"` // 内容哈希(去重)
|
||
Embedding string `json:"embedding"` // 向量嵌入(JSON数组)
|
||
SourceType string `json:"source_type"` // 来源类型(document/resume/text)
|
||
SourceID string `json:"source_id"` // 来源ID
|
||
SourceName string `json:"source_name"` // 来源名称
|
||
UserID string `json:"user_id"` // 关联的用户ID
|
||
CreatedAt string `json:"created_at"` // 创建时间
|
||
}
|
||
|
||
// ChunkWithScore 带相似度评分的文档片段,用于向量检索排序
|
||
type ChunkWithScore struct {
|
||
Content string `json:"content"` // 片段内容
|
||
Score float64 `json:"score"` // 相似度评分
|
||
Metadata string `json:"metadata"` // 元数据(含向量JSON)
|
||
SourceID string `json:"source_id"` // 来源ID
|
||
SourceName string `json:"source_name"` // 来源名称
|
||
SourceType string `json:"source_type"` // 来源类型
|
||
}
|
||
|
||
// KnowledgeBaseStats 知识库统计信息
|
||
type KnowledgeBaseStats struct {
|
||
TotalDocuments int `json:"total_documents"` // 文档总数
|
||
TotalChunks int `json:"total_chunks"` // 切片总数
|
||
TotalEmbeddings int `json:"total_embeddings"` // 向量总数
|
||
}
|