From 9ccf1e8b82fe8b7b92acc81e170299750e578409 Mon Sep 17 00:00:00 2001 From: Bian Jiang Date: Wed, 1 Nov 2023 10:48:54 +0800 Subject: [PATCH] Fixed the workspace directory does not exist --- examples/agent_creator.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/agent_creator.py b/examples/agent_creator.py index 325e7c260..6269dac10 100644 --- a/examples/agent_creator.py +++ b/examples/agent_creator.py @@ -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