47 lines
2.3 KiB
Go
47 lines
2.3 KiB
Go
// Package entity - RAGFlow配置实体
|
||
// 功能:客服账号级RAGFlow配置,每个客服账号一个独立的对话实例
|
||
// 架构说明:
|
||
// - 租户级:一个知识库(dataset),存储所有话术
|
||
// - 客服级:每个客服有独立的Chat实例,通过document_ids筛选使用哪些话术
|
||
package entity
|
||
|
||
import (
|
||
"time"
|
||
|
||
"gitea.com/red-future/common/beans"
|
||
)
|
||
|
||
const RAGFlowConfigCollection = "ragflow_config"
|
||
|
||
// RAGFlowConfig RAGFlow配置实体(客服账号级别)
|
||
type RAGFlowConfig struct {
|
||
beans.MongoBaseDO `bson:",inline"` // TenantId继承自基础DO
|
||
|
||
// 客服账号标识
|
||
AccountName string `bson:"accountName" json:"accountName"` // 客服账号名称
|
||
Platform string `bson:"platform" json:"platform"` // 平台(xiaohongshu、douyin)
|
||
|
||
// 租户级知识库(整个租户共享)
|
||
DatasetId string `bson:"datasetId" json:"datasetId"` // 话术知识库ID(RAGFlow)
|
||
DatasetIds []string `bson:"datasetIds" json:"datasetIds"` // Chat绑定的知识库ID列表(与RAGFlow API保持一致)
|
||
DatasetName string `bson:"datasetName" json:"datasetName"` // 话术知识库名称
|
||
|
||
// 客服账号级对话实例(每个客服独立)
|
||
ChatId string `bson:"chatId" json:"chatId"` // RAGFlow对话实例ID
|
||
Prompt string `bson:"prompt" json:"prompt"` // 提示词内容(完整)
|
||
|
||
// 文档筛选(该客服使用哪些话术文档)
|
||
DocumentIds []string `bson:"documentIds" json:"documentIds"` // 绑定的话术文档ID列表(从租户知识库中筛选)
|
||
|
||
// 检索参数
|
||
SimilarityThreshold float64 `bson:"similarityThreshold" json:"similarityThreshold"` // 相似度阈值(默认0.2)
|
||
KeywordsSimilarityWeight float64 `bson:"keywordsSimilarityWeight" json:"keywordsSimilarityWeight"` // 关键词权重(默认0.7)
|
||
TopN int `bson:"topN" json:"topN"` // 返回chunk数量(默认8)
|
||
EmptyResponse string `bson:"emptyResponse" json:"emptyResponse"` // 无匹配时回复
|
||
|
||
// 同步状态
|
||
SyncStatus string `bson:"syncStatus" json:"syncStatus"` // synced/pending/failed
|
||
LastSyncTime *time.Time `bson:"lastSyncTime" json:"lastSyncTime"` // 最后同步时间
|
||
SyncError string `bson:"syncError" json:"syncError"` // 同步错误信息
|
||
}
|