fix: agent会话dspy加confirm事件处理分支(友好提示而非原始JSON)
This commit is contained in:
parent
085623f700
commit
6daac16190
@ -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:
|
||||
|
||||
@ -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:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user