语言检测并动态更新语种 TODO 后续切换为llm识别用户语种意图模式

This commit is contained in:
zcr
2026-05-04 14:53:38 +08:00
parent dcf29a3b84
commit cbee81ee44
7 changed files with 304 additions and 11 deletions

View File

@@ -79,8 +79,8 @@ from langchain.tools import tool
@tool
async def topic_research(topic: List[str], max_urls: int = 5) -> str:
"""
深度调研工具DuckDuckGo版本
根据多个主题关键词进行搜索,返回去重后的高质量 URL 列表JSON字符串
In-depth research tool (DuckDuckGo version).
Search based on multiple topic keywords and return a high-quality URL list (JSON string) after deduplication.
"""
# DuckDuckGo 是同步库,需要丢到线程池

View File

@@ -13,7 +13,7 @@ collection = db["user_profiles"]
@tool
def query_report_profile(config: RunnableConfig, ) -> dict:
"""
查询用户报告画像
Query user report portrait
"""
thread_id = config['configurable']['thread_id']
doc = collection.find_one({"thread_id": thread_id})
@@ -28,7 +28,7 @@ def query_report_profile(config: RunnableConfig, ) -> dict:
@tool
def update_report_profile(config: RunnableConfig, profile: dict) -> dict:
"""
更新用户画像信息
Update user portrait information
"""
thread_id = config['configurable']['thread_id']
collection.update_one(
@@ -47,7 +47,7 @@ def update_report_profile(config: RunnableConfig, profile: dict) -> dict:
@tool
def check_profile_complete(profile: dict) -> dict:
"""
判断画像是否完整
Determine whether the image is complete
"""
required = ["style", "room_type", "budget"]
missing = [f for f in required if f not in profile]