Merge branch 'main' into feature-invoice-ocr-assistant

This commit is contained in:
Stitch-z 2023-10-10 14:27:26 +08:00
commit 96d4f3b7e4
8 changed files with 109 additions and 21 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
@ -238,7 +238,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