Fixed the workspace directory does not exist

This commit is contained in:
Bian Jiang 2023-11-01 10:48:54 +08:00
parent ccc4c9e04d
commit 9ccf1e8b82

View file

@ -49,6 +49,8 @@ class CreateAgent(Action):
pattern = r'```python(.*)```'
match = re.search(pattern, rsp, re.DOTALL)
code_text = match.group(1) if match else ""
if not WORKSPACE_ROOT.exists():
WORKSPACE_ROOT.mkdir(parents=True)
with open(WORKSPACE_ROOT / "agent_created_agent.py", "w") as f:
f.write(code_text)
return code_text