Skip to content

Commit a046663

Browse files
author
Aman Rusia
committed
Revert to need of absolute path in writefile. Automatically making dir instead
1 parent fe8916c commit a046663

File tree

5 files changed

+11
-6
lines changed

5 files changed

+11
-6
lines changed

gpt_action_json_schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
},
77
"servers": [
88
{
9-
"url": "https://604f-2401-4900-1c8e-e61d-40fc-eab7-f5c2-c8ad.ngrok-free.app"
9+
"url": "https://bf94-103-212-152-58.ngrok-free.app"
1010
}
1111
],
1212
"paths": {

gpt_instructions.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Instructions:
77
- Ask user for confirmation before running anything major
88

99

10-
To execute bash commands OR write files use the provided api `wcgw.arcfu.com`
10+
To execute bash commands OR write files use the provided api.
1111

1212
Instructions for `BashCommand`:
1313
- Execute a bash command. This is stateful (beware with subsequent calls).

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
22
authors = [{ name = "Aman Rusia", email = "[email protected]" }]
33
name = "wcgw"
4-
version = "1.0.0"
4+
version = "1.0.1"
55
description = "What could go wrong giving full shell access to chatgpt?"
66
readme = "README.md"
77
requires-python = ">=3.10, <3.13"

src/wcgw/client/tools.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import base64
33
import json
44
import mimetypes
5+
from pathlib import Path
56
import re
67
import sys
78
import threading
@@ -404,11 +405,15 @@ def read_image_from_shell(file_path: str) -> ImageData:
404405

405406
def write_file(writefile: Writefile) -> str:
406407
if not os.path.isabs(writefile.file_path):
407-
path_ = os.path.join(CWD, writefile.file_path)
408+
return "Failure: file_path should be absolute path"
408409
else:
409410
path_ = writefile.file_path
411+
412+
path = Path(path_)
413+
path.parent.mkdir(parents=True, exist_ok=True)
414+
410415
try:
411-
with open(path_, "w") as f:
416+
with path.open("w") as f:
412417
f.write(writefile.file_content)
413418
except OSError as e:
414419
return f"Error: {e}"

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)