mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-08 15:05:17 +02:00
commit
4efb42a8f8
2 changed files with 8 additions and 2 deletions
|
|
@ -207,5 +207,11 @@ class WriteDesign(Action):
|
|||
prompt = prompt_template.format(context=context, format_example=format_example)
|
||||
# system_design = await self._aask(prompt)
|
||||
system_design = await self._aask_v1(prompt, "system_design", OUTPUT_MAPPING, format=format)
|
||||
# fix Python package name, we can't system_design.instruct_content.python_package_name = "xxx" since "Python package name" contain space, have to use setattr
|
||||
setattr(
|
||||
system_design.instruct_content,
|
||||
"Python package name",
|
||||
system_design.instruct_content.dict()["Python package name"].strip().strip("'").strip('"'),
|
||||
)
|
||||
await self._save(context, system_design)
|
||||
return system_design
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue