feat: 工具调用改为独立 SSE 事件并以中文状态条展示

This commit is contained in:
2026-09-20 11:45:00 +08:00
parent 9b240b35a9
commit de0bbb1a9c
9 changed files with 179 additions and 19 deletions
+26
View File
@@ -0,0 +1,26 @@
"""工具名 → 用户可见中文状态文案(不暴露内部 name)。"""
from __future__ import annotations
_LABELS: dict[str, str] = {
"memory_search": "检索记忆",
"memory_load": "载入记忆",
"memory_save": "保存记忆",
"get_current_time": "确认业务日期",
"catalog_search": "查找店铺/商品",
}
def tool_status_label(name: str) -> str:
"""将工具名映射为前端状态条文案。"""
key = (name or "").strip()
if not key:
return "处理中"
if key in _LABELS:
return _LABELS[key]
lower = key.lower()
if lower.startswith("catalog_"):
return "查找店铺/商品"
if "order" in lower or "sales" in lower or "bi_" in lower or "stat" in lower:
return "查询经营数据"
return "查询经营数据"