feat(agent): 对话应答结束后追加完毕行(Text otext+i18n,词条见pipeline-app/i18n/*/i18n.json)

This commit is contained in:
yumoqing 2026-09-05 10:59:02 +08:00
parent 28237cd6ea
commit 95824fb732
2 changed files with 8 additions and 0 deletions

View File

@ -60,6 +60,7 @@ if action == 'send_message':
if any(kw == _pl or (kw in _pl and not _is_project_mgmt) for kw in stop_keywords):
async def _stop_stream():
yield json.dumps({"content": "已停止当前任务。"}, ensure_ascii=False) + '\n'
yield json.dumps({"widgettype": "Text", "options": {"otext": "## 完毕 ##", "text": "## 完毕 ##", "i18n": True, "halign": "left", "css": "agent-done", "style": {"color": "#94a3b8"}}}, ensure_ascii=False) + '\n'
return await stream_response(request, _stop_stream, 'text/plain; charset=utf-8')
uid = await get_user()
@ -134,6 +135,9 @@ if action == 'send_message':
yield json.dumps({"error": data.get('message', '')}, ensure_ascii=False) + '\n'
else:
yield json.dumps({"content": chunk}, ensure_ascii=False) + '\n'
# 应答输出结束后追加一行「## 完毕 ##」Text 控件 otext+i18n前端按当前语言翻译
# (词条见 pipeline-app/i18n/*/i18n.jsonmsg.txt 以 # 开头的键会被当注释,故只放 i18n.json
yield json.dumps({"widgettype": "Text", "options": {"otext": "## 完毕 ##", "text": "## 完毕 ##", "i18n": True, "halign": "left", "css": "agent-done", "style": {"color": "#94a3b8"}}}, ensure_ascii=False) + '\n'
return await stream_response(request, agent_stream, 'text/plain; charset=utf-8')

View File

@ -21,6 +21,7 @@ if action == 'send_message':
if prompt.strip().lower() in stop_kw:
async def _stop():
yield json.dumps({"content": "已停止。"}, ensure_ascii=False) + '\n'
yield json.dumps({"widgettype": "Text", "options": {"otext": "## 完毕 ##", "text": "## 完毕 ##", "i18n": True, "halign": "left", "css": "agent-done", "style": {"color": "#94a3b8"}}}, ensure_ascii=False) + '\n'
return await stream_response(request, _stop, 'text/plain; charset=utf-8')
from pipeline_service.gateway import get_gateway
@ -85,6 +86,9 @@ if action == 'send_message':
yield json.dumps({"error": data.get('message', '')}, ensure_ascii=False) + '\n'
else:
yield json.dumps({"content": chunk}, ensure_ascii=False) + '\n'
# 应答输出结束后追加一行「## 完毕 ##」Text 控件 otext+i18n前端按当前语言翻译
# (词条见 pipeline-app/i18n/*/i18n.jsonmsg.txt 以 # 开头的键会被当注释,故只放 i18n.json
yield json.dumps({"widgettype": "Text", "options": {"otext": "## 完毕 ##", "text": "## 完毕 ##", "i18n": True, "halign": "left", "css": "agent-done", "style": {"color": "#94a3b8"}}}, ensure_ascii=False) + '\n'
return await stream_response(request, agent_stream, 'text/plain; charset=utf-8')