|
|
@@ -340,8 +340,11 @@
|
|
|
" # 解析行动\n",
|
|
|
" action_match = re.search(r\"Action: (.*)\", llm_output, re.DOTALL)\n",
|
|
|
" if not action_match:\n",
|
|
|
- " print(\"❌ 解析错误:模型输出中未找到 Action。\")\n",
|
|
|
- " break\n",
|
|
|
+ " observation = \"错误: 未能解析到 Action 字段。请确保你的回复严格遵循 'Thought: ... Action: ...' 的格式。\"\n",
|
|
|
+ " observation_str = f\"Observation: {observation}\"\n",
|
|
|
+ " print(f\"{observation_str}\\n\" + \"=\"*40)\n",
|
|
|
+ " assistant.prompt_history.append(observation_str)\n",
|
|
|
+ " continue\n",
|
|
|
" \n",
|
|
|
" action_str = action_match.group(1).strip()\n",
|
|
|
" tool_name, kwargs = parse_action(action_str)\n",
|