diff --git a/wwwroot/api/agent_chat.dspy b/wwwroot/api/agent_chat.dspy index cbd5a86..213aaf9 100644 --- a/wwwroot/api/agent_chat.dspy +++ b/wwwroot/api/agent_chat.dspy @@ -100,6 +100,11 @@ if action == 'send_message': yield json.dumps({"content": data.get('message', '')}, ensure_ascii=False) + '\n' elif t == 'ask_user': yield json.dumps({"content": "❓ " + data.get('message', '')}, ensure_ascii=False) + '\n' + elif t == 'confirm': + _tool = data.get('tool', '') + _params = data.get('params', {}) or {} + _cmd = _params.get('command', '') if isinstance(_params, dict) else '' + yield json.dumps({"content": "⚠️ 需要你确认执行命令:`" + str(_cmd)[:120] + "`\n请回复「确认」执行,或「取消」放弃。"}, ensure_ascii=False) + '\n' elif t == 'error': yield json.dumps({"error": data.get('message', '')}, ensure_ascii=False) + '\n' else: diff --git a/wwwroot/api/agent_chat_generic.dspy b/wwwroot/api/agent_chat_generic.dspy index 3cfa1d8..49621c8 100644 --- a/wwwroot/api/agent_chat_generic.dspy +++ b/wwwroot/api/agent_chat_generic.dspy @@ -38,6 +38,11 @@ if action == 'send_message': yield json.dumps({"content": data.get('message', '')}, ensure_ascii=False) + '\n' elif t == 'ask_user': yield json.dumps({"content": "❓ " + data.get('message', '')}, ensure_ascii=False) + '\n' + elif t == 'confirm': + _tool = data.get('tool', '') + _params = data.get('params', {}) or {} + _cmd = _params.get('command', '') if isinstance(_params, dict) else '' + yield json.dumps({"content": "⚠️ 需要你确认执行命令:`" + str(_cmd)[:120] + "`\n请回复「确认」执行,或「取消」放弃。"}, ensure_ascii=False) + '\n' elif t == 'error': yield json.dumps({"error": data.get('message', '')}, ensure_ascii=False) + '\n' else: