feat: 新增 AgentQA 请求字段支持

This commit is contained in:
wizardchen
2026-01-07 19:16:39 +08:00
parent d51140e033
commit 69cd5ed998
2 changed files with 33 additions and 8 deletions
+18 -6
View File
@@ -12,14 +12,26 @@ import (
"strings"
)
// MentionedItem represents a mentioned item in the request
type MentionedItem struct {
ID string `json:"id"`
Name string `json:"name"`
Type string `json:"type"` // "kb" for knowledge base, "file" for file
KBType string `json:"kb_type"` // "document" or "faq" (only for kb type)
}
// AgentQARequest agent Q&A request payload.
type AgentQARequest struct {
Query string `json:"query"` // Required query text
KnowledgeBaseIDs []string `json:"knowledge_base_ids,omitempty"` // Optional KBs for this query
AgentEnabled bool `json:"agent_enabled"` // Whether to run in agent mode
WebSearchEnabled bool `json:"web_search_enabled"` // Whether to enable web search
SummaryModelID string `json:"summary_model_id,omitempty"` // Optional summary model override
MCPServiceIDs []string `json:"mcp_service_ids,omitempty"` // Optional MCP service allow list
Query string `json:"query"` // Required query text
KnowledgeBaseIDs []string `json:"knowledge_base_ids,omitempty"` // Optional KBs for this query
KnowledgeIDs []string `json:"knowledge_ids,omitempty"` // Optional specific knowledge IDs for this query
AgentEnabled bool `json:"agent_enabled"` // Whether to run in agent mode
AgentID string `json:"agent_id,omitempty"` // Optional custom agent ID
WebSearchEnabled bool `json:"web_search_enabled"` // Whether to enable web search
SummaryModelID string `json:"summary_model_id,omitempty"` // Optional summary model override
MentionedItems []MentionedItem `json:"mentioned_items,omitempty"` // @mentioned knowledge bases and files
DisableTitle bool `json:"disable_title,omitempty"` // Whether to disable auto title generation
MCPServiceIDs []string `json:"mcp_service_ids,omitempty"` // Optional MCP service allow list (deprecated)
}
// AgentResponseType defines the type of agent response
+15 -2
View File
@@ -50,10 +50,14 @@ Agent 模式支持更智能的问答,包括工具调用、网络搜索、多
**请求参数**:
- `query`: 查询文本(必填)
- `knowledge_base_ids`: 知识库 ID 数组,可动态指定本次查询使用的知识库(可选)
- `knowledge_ids`: 知识文件 ID 数组,可动态指定本次查询使用的具体知识文件(可选)
- `agent_enabled`: 是否启用 Agent 模式(可选,默认 false)
- `agent_id`: 自定义 Agent ID,指定使用的自定义智能体(可选)
- `web_search_enabled`: 是否启用网络搜索(可选,默认 false)
- `summary_model_id`: 覆盖会话默认的摘要模型 ID(可选)
- `mcp_service_ids`: MCP 服务白名单(可选)
- `mentioned_items`: @提及的知识库和文件列表(可选)
- `disable_title`: 是否禁用自动标题生成(可选,默认 false)
- `mcp_service_ids`: MCP 服务白名单(可选,已废弃)
**请求**:
@@ -65,7 +69,16 @@ curl --location 'http://localhost:8080/api/v1/agent-chat/ceb9babb-1e30-41d7-817d
"query": "帮我查询今天的天气",
"agent_enabled": true,
"web_search_enabled": true,
"knowledge_base_ids": ["kb-00000001"]
"knowledge_base_ids": ["kb-00000001"],
"agent_id": "agent-001",
"mentioned_items": [
{
"id": "kb-00000001",
"name": "天气知识库",
"type": "kb",
"kb_type": "document"
}
]
}'
```