Skip to content

修复了code/chapter1/FirstAgentTest里面关于报错的bug#344

Open
yoyofancy wants to merge 1 commit intodatawhalechina:mainfrom
yoyofancy:main
Open

修复了code/chapter1/FirstAgentTest里面关于报错的bug#344
yoyofancy wants to merge 1 commit intodatawhalechina:mainfrom
yoyofancy:main

Conversation

@yoyofancy
Copy link

原代码为: r"Finish[(.)]", action_str).group(1)
报错为:Traceback (most recent call last):
File "/Users/mac/Documents/cs_self_learning/helloagent/旅游规划agent/ systemprompt.py", line 195, in
final_answer = re.match(r"Finish[(.
)]", action_str).group(1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'group'

打印action_str以后发现里面有很多换行键。
修改为:final_answer = re.match(r"Finish[(.*)]", action_str, re.DOTALL).group(1) 就可以解决了

原代码为:   r"Finish\[(.*)\]", action_str).group(1)
报错为:Traceback (most recent call last):
  File "/Users/mac/Documents/cs_self_learning/helloagent/旅游规划agent/ systemprompt.py", line 195, in <module>
    final_answer = re.match(r"Finish\[(.*)\]", action_str).group(1)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'group'

打印action_str以后发现里面有很多换行键。
修改为:final_answer = re.match(r"Finish\[(.*)\]", action_str, re.DOTALL).group(1)
就可以解决了
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant