|
|
@@ -27,12 +27,20 @@ def get_web_search_tools() -> list:
|
|
|
"sources": ["douyin", "toutiao"],# 附加搜索来源(抖音百科、墨迹天气、头条图文等平台)
|
|
|
}]
|
|
|
# 私域知识库 --- 此处的知识库也需要映射
|
|
|
-def get_knowledge_search_tools(knowledge_resource_id: str) -> list:
|
|
|
- return [{
|
|
|
- "type": "knowledge_search",
|
|
|
- "knowledge_resource_id": knowledge_resource_id, # 替换为实际知识库ID
|
|
|
- "limit": 10, # 最多返回10条搜索结果
|
|
|
- }]
|
|
|
+def get_knowledge_search_tools(knowledge_resource_id: str, app_name: Optional[str] = None) -> list:
|
|
|
+ tool: Dict = {
|
|
|
+ "type": "knowledge_search",
|
|
|
+ "knowledge_resource_id": knowledge_resource_id, # 替换为实际知识库ID
|
|
|
+ "limit": 10, # 最多返回10条搜索结果
|
|
|
+ }
|
|
|
+ # 当 app_name 有值时,按 app_name 字段过滤,否则全局查询
|
|
|
+ if app_name:
|
|
|
+ tool["doc_filter"] = {
|
|
|
+ "op": "must",
|
|
|
+ "field": "app_name",
|
|
|
+ "conds": [app_name],
|
|
|
+ }
|
|
|
+ return [tool]
|
|
|
|
|
|
# 豆包助手工具
|
|
|
def get_doubao_tools() -> list:
|