Skip to content

🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming

Save requirements.txt and api_spec_and_tasks.md

Hallimedebfc3ea8047a5
diff --git a/metagpt/actions/project_management.py b/metagpt/actions/project_management.py
index 1dc18dc90..0d206d1e7 100644
--- a/metagpt/actions/project_management.py
+++ b/metagpt/actions/project_management.py
@@ -45,9 +45,7 @@ FORMAT_EXAMPLE = '''
---
## Required Python third-party packages
```python
-"""
flask==1.1.2
-"""
```
## Required Other language third-party packages
@@ -111,11 +109,16 @@ class WriteTasks(Action):
def _save(self, context, rsp):
ws_name = CodeParser.parse_str(block="Python package name", text=context[-1].content)
file_path = WORKSPACE_ROOT / ws_name / 'docs/api_spec_and_tasks.md'
- file_path.write_text(rsp)
+ file_path.write_text(rsp.content)
+
+ # Write requirements.txt
+ requirements_path = WORKSPACE_ROOT / ws_name / 'requirements.txt'
+ requirements_path.write_text(rsp.instruct_content.dict().get("Required Python third-party packages"))
async def run(self, context):
prompt = PROMPT_TEMPLATE.format(context=context, format_example=FORMAT_EXAMPLE)
rsp = await self._aask_v1(prompt, "task", OUTPUT_MAPPING)
+ self._save(context, rsp)
return rsp