按照要求修改

This commit is contained in:
zhouzinimg 2023-10-16 22:53:28 +08:00
parent e2af76fb08
commit f3c7da32a0
41 changed files with 342 additions and 944 deletions

View file

@ -180,7 +180,7 @@ class OutputParser:
if start_index != -1 and end_index != -1:
# Extract the structure part
structure_text = text[start_index:end_index + 1]
structure_text = text[start_index : end_index + 1]
try:
# Attempt to convert the text to a Python data type using ast.literal_eval
@ -237,7 +237,7 @@ class CodeParser:
logger.error(f"{pattern} not match following text:")
logger.error(text)
# raise Exception
return ""
return text # just assume original text is code
return code
@classmethod

View file

@ -4,7 +4,7 @@
import copy
import pickle
from typing import Dict, List, Tuple
from typing import Dict, List
from metagpt.actions.action_output import ActionOutput
from metagpt.schema import Message
@ -37,8 +37,8 @@ def actionoutout_schema_to_mapping(schema: Dict) -> Dict:
elif property["type"] == "array" and property["items"]["type"] == "string":
mapping[field] = (List[str], ...)
elif property["type"] == "array" and property["items"]["type"] == "array":
# here only consider the `Tuple[str, str]` situation
mapping[field] = (List[Tuple[str, str]], ...)
# here only consider the `List[List[str]]` situation
mapping[field] = (List[List[str]], ...)
return mapping