feat: stop/cancel intent detection
This commit is contained in:
parent
6b7487d736
commit
662e1b5c04
@ -34,6 +34,14 @@ def _w_card(title, body, kind="info"):
|
||||
|
||||
if action == 'send_message':
|
||||
prompt = msg
|
||||
|
||||
# ── 意图识别:停止类指令 ──
|
||||
stop_keywords = ['停止', '取消', '停下', '终止', '停', 'stop', 'cancel', 'abort']
|
||||
if any(kw == prompt.strip().lower() or kw in prompt.strip().lower() for kw in stop_keywords):
|
||||
async def _stop_stream():
|
||||
yield json.dumps(_w_md("已停止当前任务。"), ensure_ascii=False) + '\n'
|
||||
return await stream_response(request, _stop_stream, 'text/plain; charset=utf-8')
|
||||
|
||||
uid = await get_user()
|
||||
if not uid:
|
||||
uid = 'user-01' # 测试兼容
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user