mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-11 00:32:37 +02:00
fix state value extract for https://github.com/geekan/MetaGPT/issues/1067
This commit is contained in:
parent
5ee95b1461
commit
12551ab60c
1 changed files with 3 additions and 1 deletions
|
|
@ -340,7 +340,9 @@ def extract_state_value_from_output(content: str) -> str:
|
|||
content (str): llm's output from `Role._think`
|
||||
"""
|
||||
content = content.strip() # deal the output cases like " 0", "0\n" and so on.
|
||||
pattern = r"([0-9])" # TODO find the number using a more proper method not just extract from content using pattern
|
||||
pattern = (
|
||||
r"(?<!-)[0-9]" # TODO find the number using a more proper method not just extract from content using pattern
|
||||
)
|
||||
matches = re.findall(pattern, content, re.DOTALL)
|
||||
matches = list(set(matches))
|
||||
state = matches[0] if len(matches) > 0 else "-1"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue