Merge pull request #472 from border/main

Fixed the workspace directory does not exist
This commit is contained in:
Sirui Hong 2023-12-04 10:38:04 +08:00 committed by GitHub
commit 57e31474cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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