|
|
@@ -174,8 +174,11 @@ for i in range(5): # 设置最大循环次数
|
|
|
# 3.3. 解析并执行行动
|
|
|
action_match = re.search(r"Action: (.*)", llm_output, re.DOTALL)
|
|
|
if not action_match:
|
|
|
- print(f"任务完成: {llm_output.strip()}")
|
|
|
- break
|
|
|
+ observation = "错误: 未能解析到 Action 字段。请确保你的回复严格遵循 'Thought: ... Action: ...' 的格式。"
|
|
|
+ observation_str = f"Observation: {observation}"
|
|
|
+ print(f"{observation_str}\n" + "="*40)
|
|
|
+ prompt_history.append(observation_str)
|
|
|
+ continue
|
|
|
action_str = action_match.group(1).strip()
|
|
|
|
|
|
if action_str.startswith("finish"):
|