refactor: remove knowledge base references from AI agent model and related services
- Removed KnowledgeIDs from CreateAIAgentRequest and AIAgentResponse. - Updated buildAIAgentResponseWithLocale to eliminate knowledge base name retrieval. - Refactored AI agent repository and service to remove knowledge base handling. - Adjusted dashboard service to no longer track AI agents without knowledge bases. - Modified knowledge base service to check for workflow references instead of AI agent references. - Updated frontend components to remove knowledge base selection and display. - Enhanced workflow validation to ensure knowledge retrieve nodes have associated knowledge bases.
This commit is contained in:
@@ -32,7 +32,6 @@ func DefaultRegistry() *Registry {
|
||||
output("messageId", "消息 ID", VariableTypeInteger, "客户本轮消息的内部编号。"),
|
||||
output("aiAgentId", "AI Agent ID", VariableTypeInteger, "当前处理会话的 AI Agent 编号。"),
|
||||
output("userMessage", "用户消息", VariableTypeString, "客户本轮发送的原始消息内容。"),
|
||||
output("knowledgeBaseIds", "知识库 ID 列表", VariableTypeIntegerArray, "当前 AI Agent 已绑定的知识库编号列表。"),
|
||||
},
|
||||
},
|
||||
NodeSpec{
|
||||
@@ -120,6 +119,14 @@ func DefaultRegistry() *Registry {
|
||||
Description: "Retrieve knowledge for the current user message.",
|
||||
Icon: "BookOpenIcon",
|
||||
RiskLevel: NodeRiskLevelLow,
|
||||
ConfigSchema: map[string]any{
|
||||
"knowledgeBaseIds": map[string]any{
|
||||
"type": string(VariableTypeIntegerArray),
|
||||
"label": "知识库",
|
||||
"required": true,
|
||||
"description": "本节点检索时使用的知识库列表,按顺序表示优先级。",
|
||||
},
|
||||
},
|
||||
InputSchema: []VariableSpec{
|
||||
requiredInput("query", "检索问题", VariableTypeString, "用于检索知识库的客户问题或查询文本。"),
|
||||
},
|
||||
|
||||
@@ -23,8 +23,8 @@ func TestDefaultRegistryExposesStartOutputs(t *testing.T) {
|
||||
if !hasVariable(spec.OutputSchema, "userMessage", VariableTypeString) {
|
||||
t.Fatalf("expected start output userMessage:string, got %#v", spec.OutputSchema)
|
||||
}
|
||||
if !hasVariable(spec.OutputSchema, "knowledgeBaseIds", VariableTypeIntegerArray) {
|
||||
t.Fatalf("expected start output knowledgeBaseIds:array<int>, got %#v", spec.OutputSchema)
|
||||
if hasVariableName(spec.OutputSchema, "knowledgeBaseIds") {
|
||||
t.Fatalf("did not expect start output knowledgeBaseIds after knowledge binding moved to retrieve node, got %#v", spec.OutputSchema)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,9 @@ func TestDefaultRegistryExposesKnowledgeRetrieveInputsAndOutputs(t *testing.T) {
|
||||
if !hasVariable(spec.OutputSchema, "items", VariableTypeObjectArray) {
|
||||
t.Fatalf("expected knowledge_retrieve output items:array<object>, got %#v", spec.OutputSchema)
|
||||
}
|
||||
if spec.ConfigSchema == nil {
|
||||
t.Fatalf("expected knowledge_retrieve config schema")
|
||||
}
|
||||
}
|
||||
|
||||
func TestDefaultRegistryExposesSendReplyRequiredInput(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user