refactor: 将客服后端重构为宿主可嵌入模块

- 注入数据库、运行时配置、统一响应、文件存储和平台 AI 能力,补充业务读写工具与客户快捷操作契约。

- 移除模块内重复的组织、客户、工单、标签、技能、旧工作流、MCP 和迁移实现,将身份权限与业务主体交由宿主管理。

- 使用 libSQL 重构向量存储,并完善图片消息、访客身份、排队调度、企业微信和支持聊天页面。

- 统一 HTTP、DTO 与 WebSocket 的 snake_case 协议,补齐模块初始化、业务动作和公共载荷等回归测试。
This commit is contained in:
t
2026-08-28 22:23:13 +08:00
parent 6845c728f8
commit 18c9354095
377 changed files with 13199 additions and 22881 deletions
+37 -37
View File
@@ -9,15 +9,15 @@ import (
type CreateKnowledgeBaseRequest struct {
Name string `json:"name"`
Description string `json:"description"`
KnowledgeType string `json:"knowledgeType"`
DefaultTopK int `json:"defaultTopK"`
DefaultScoreThreshold float64 `json:"defaultScoreThreshold"`
DefaultRerankLimit int `json:"defaultRerankLimit"`
ChunkProvider string `json:"chunkProvider"`
ChunkTargetTokens int `json:"chunkTargetTokens"`
ChunkMaxTokens int `json:"chunkMaxTokens"`
ChunkOverlapTokens int `json:"chunkOverlapTokens"`
AnswerMode int `json:"answerMode"`
KnowledgeType string `json:"knowledge_type"`
DefaultTopK int `json:"default_top_k"`
DefaultScoreThreshold float64 `json:"default_score_threshold"`
DefaultRerankLimit int `json:"default_rerank_limit"`
ChunkProvider string `json:"chunk_provider"`
ChunkTargetTokens int `json:"chunk_target_tokens"`
ChunkMaxTokens int `json:"chunk_max_tokens"`
ChunkOverlapTokens int `json:"chunk_overlap_tokens"`
AnswerMode int `json:"answer_mode"`
Remark string `json:"remark"`
}
@@ -27,8 +27,8 @@ type UpdateKnowledgeBaseRequest struct {
}
type CreateKnowledgeDirectoryRequest struct {
KnowledgeBaseID int64 `json:"knowledgeBaseId"`
ParentID int64 `json:"parentId"`
KnowledgeBaseID int64 `json:"knowledge_base_id"`
ParentID int64 `json:"parent_id"`
Name string `json:"name"`
Remark string `json:"remark"`
}
@@ -43,10 +43,10 @@ type DeleteKnowledgeDirectoryRequest struct {
}
type CreateKnowledgeDocumentRequest struct {
KnowledgeBaseID int64 `json:"knowledgeBaseId"`
DirectoryID int64 `json:"directoryId"`
KnowledgeBaseID int64 `json:"knowledge_base_id"`
DirectoryID int64 `json:"directory_id"`
Title string `json:"title"`
ContentType enums.KnowledgeDocumentContentType `json:"contentType"`
ContentType enums.KnowledgeDocumentContentType `json:"content_type"`
Content string `json:"content"`
}
@@ -56,8 +56,8 @@ type UpdateKnowledgeDocumentRequest struct {
}
type BatchMoveKnowledgeDocumentRequest struct {
KnowledgeBaseID int64 `json:"knowledgeBaseId"`
DirectoryID int64 `json:"directoryId"`
KnowledgeBaseID int64 `json:"knowledge_base_id"`
DirectoryID int64 `json:"directory_id"`
IDs []int64 `json:"ids"`
}
@@ -66,11 +66,11 @@ type BatchDeleteKnowledgeDocumentRequest struct {
}
type CreateKnowledgeFAQRequest struct {
KnowledgeBaseID int64 `json:"knowledgeBaseId"`
DirectoryID int64 `json:"directoryId"`
KnowledgeBaseID int64 `json:"knowledge_base_id"`
DirectoryID int64 `json:"directory_id"`
Question string `json:"question"`
Answer string `json:"answer"`
SimilarQuestions []string `json:"similarQuestions"`
SimilarQuestions []string `json:"similar_questions"`
Remark string `json:"remark"`
}
@@ -80,8 +80,8 @@ type UpdateKnowledgeFAQRequest struct {
}
type BatchMoveKnowledgeFAQRequest struct {
KnowledgeBaseID int64 `json:"knowledgeBaseId"`
DirectoryID int64 `json:"directoryId"`
KnowledgeBaseID int64 `json:"knowledge_base_id"`
DirectoryID int64 `json:"directory_id"`
IDs []int64 `json:"ids"`
}
@@ -105,33 +105,33 @@ type ImportKnowledgeFAQRequest struct {
}
type KnowledgeSearchRequest struct {
KnowledgeBaseIDs []int64 `json:"knowledgeBaseIds"`
KnowledgeBaseIDs []int64 `json:"knowledge_base_ids"`
Question string `json:"question"`
TopK int `json:"topK"`
ScoreThreshold float64 `json:"scoreThreshold"`
RerankLimit int `json:"rerankLimit"`
TopK int `json:"top_k"`
ScoreThreshold float64 `json:"score_threshold"`
RerankLimit int `json:"rerank_limit"`
Channel string `json:"channel"`
Scene string `json:"scene"`
SessionID string `json:"sessionId"`
ConversationID int64 `json:"conversationId"`
SessionID string `json:"session_id"`
ConversationID int64 `json:"conversation_id"`
}
type KnowledgeAnswerRequest struct {
KnowledgeBaseIDs []int64 `json:"knowledgeBaseIds"`
KnowledgeBaseIDs []int64 `json:"knowledge_base_ids"`
Question string `json:"question"`
TopK int `json:"topK"`
ScoreThreshold float64 `json:"scoreThreshold"`
RerankLimit int `json:"rerankLimit"`
TopK int `json:"top_k"`
ScoreThreshold float64 `json:"score_threshold"`
RerankLimit int `json:"rerank_limit"`
Channel string `json:"channel"`
Scene string `json:"scene"`
SessionID string `json:"sessionId"`
ConversationID int64 `json:"conversationId"`
AnswerMode int `json:"answerMode"`
SessionID string `json:"session_id"`
ConversationID int64 `json:"conversation_id"`
AnswerMode int `json:"answer_mode"`
}
type CreateKnowledgeFeedbackRequest struct {
RetrieveLogID int64 `json:"retrieveLogId"`
FeedbackType int `json:"feedbackType"`
FeedbackReason string `json:"feedbackReason"`
RetrieveLogID int64 `json:"retrieve_log_id"`
FeedbackType int `json:"feedback_type"`
FeedbackReason string `json:"feedback_reason"`
Remark string `json:"remark"`
}