Skip to content

Commit

Permalink
fix: create workspace symlink in log folder, load on resume (#368)
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare authored Dec 29, 2024
1 parent 0d642c2 commit 0347510
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion gptme/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,17 @@ def chat(

# change to workspace directory
# use if exists, create if @log, or use given path
# TODO: move this into LogManager? then just os.chdir(manager.workspace)
log_workspace = logdir / "workspace"
if log_workspace.exists():
assert not workspace or (
workspace == log_workspace
), f"Workspace already exists in {log_workspace}, wont override."
workspace = log_workspace
workspace = log_workspace.resolve()
else:
if not workspace:
workspace = Path.cwd()
log_workspace.symlink_to(workspace, target_is_directory=True)
assert workspace.exists(), f"Workspace path {workspace} does not exist"
console.log(f"Using workspace at {path_with_tilde(workspace)}")
os.chdir(workspace)
Expand Down

0 comments on commit 0347510

Please sign in to comment.