Skip to content

Commit

Permalink
Revert to need of absolute path in writefile. Automatically making di…
Browse files Browse the repository at this point in the history
…r instead
  • Loading branch information
Aman Rusia committed Nov 6, 2024
1 parent fe8916c commit a046663
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion gpt_action_json_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
"servers": [
{
"url": "https://604f-2401-4900-1c8e-e61d-40fc-eab7-f5c2-c8ad.ngrok-free.app"
"url": "https://bf94-103-212-152-58.ngrok-free.app"
}
],
"paths": {
Expand Down
2 changes: 1 addition & 1 deletion gpt_instructions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Instructions:
- Ask user for confirmation before running anything major


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

Instructions for `BashCommand`:
- Execute a bash command. This is stateful (beware with subsequent calls).
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
authors = [{ name = "Aman Rusia", email = "[email protected]" }]
name = "wcgw"
version = "1.0.0"
version = "1.0.1"
description = "What could go wrong giving full shell access to chatgpt?"
readme = "README.md"
requires-python = ">=3.10, <3.13"
Expand Down
9 changes: 7 additions & 2 deletions src/wcgw/client/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import base64
import json
import mimetypes
from pathlib import Path
import re
import sys
import threading
Expand Down Expand Up @@ -404,11 +405,15 @@ def read_image_from_shell(file_path: str) -> ImageData:

def write_file(writefile: Writefile) -> str:
if not os.path.isabs(writefile.file_path):
path_ = os.path.join(CWD, writefile.file_path)
return "Failure: file_path should be absolute path"
else:
path_ = writefile.file_path

path = Path(path_)
path.parent.mkdir(parents=True, exist_ok=True)

try:
with open(path_, "w") as f:
with path.open("w") as f:
f.write(writefile.file_content)
except OSError as e:
return f"Error: {e}"
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a046663

Please sign in to comment.