优化查询代码,优化工具代码
All checks were successful
构建并部署 AI Agent 服务 / deploy (push) Successful in 5m33s

This commit is contained in:
2026-05-08 22:30:26 +08:00
parent bfb2ddbe76
commit b30f7b00a7
11 changed files with 375 additions and 511 deletions

View File

@@ -0,0 +1,18 @@
"""
联网搜索工具
"""
from langchain_core.tools import tool
from backend.app.logger import info
@tool
def web_search(query: str) -> str:
"""联网搜索获取最新信息"""
info(f"[Tool] web_search: {query[:30]}...")
try:
from backend.app.core.web_search import web_search as search_fn
return search_fn(query, max_results=5)
except Exception as e:
info(f"[Tool] web_search 失败: {e}")
return f"联网搜索失败: {str(e)}"