diff --git a/code/chapter1/FirstAgentTest.py b/code/chapter1/FirstAgentTest.py index 43098741..6a0682bf 100644 --- a/code/chapter1/FirstAgentTest.py +++ b/code/chapter1/FirstAgentTest.py @@ -189,7 +189,7 @@ def generate(self, prompt: str, system_prompt: str) -> str: action_str = action_match.group(1).strip() if action_str.startswith("Finish"): - final_answer = re.match(r"Finish\[(.*)\]", action_str).group(1) + final_answer = re.match(r"Finish\[(.*)\]", action_str, re.DOTALL).group(1) print(f"任务完成,最终答案: {final_answer}") break