gptscript-ai/gptscript

Using "~" in `--cache-dir` does not work properly

Closed this issue · 1 comments

Steps to reproduce the problem:

  1. Use "~" in --cache-dir like - gptscript --cache-dir=~/testcache vision.gpt
tools: github.com/gptscript-ai/vision

Describe the picture in file /users/sangeethahariharan/Downloads/sunrise.jpeg for me

This fails with following errors:

17:39:46 started  [main]
17:39:46 sent     [main]
         content  [1] content | Waiting for model response...
         content  [1] content | tool call vision -> {"images":"file:///users/sangeethahariharan/Downloads/sunrise.jpeg","prompt":"Describe the picture in detail."}
17:39:48 started  [vision(2)] [input={"images":"file:///users/sangeethahariharan/Downloads/sunrise.jpeg","prompt":"Describe the picture in detail."}]
17:39:48 Cloning https://github.com/gptscript-ai/vision.git
17:39:49 Fetching 46ac5323baf9da743f238a313b5b78608b2d4dbf at https://github.com/gptscript-ai/vision.git
17:39:49 Checking out 46ac5323baf9da743f238a313b5b78608b2d4dbf to ~/testcache/repos/46ac5323baf9da743f238a313b5b78608b2d4dbf/node21
17:39:49 Downloading Node 21.x
2024/03/11 17:39:51 fork/exec ~/testcache/repos/runtimes/node/673f54c844864777b8630b9478e27283532f0d475ea502e114cdac1c75b75bad/node-v21.7.0-darwin-x64/bin/npm: no such file or directory

~ is not used as home dir and I see directory ~ created under the current working directory which gets used as the cache dir.

pwd
/Users/sangeethahariharan/gptscriprelease/gptscript/examples/~/testcache/repos/runtimes/node/673f54c844864777b8630b9478e27283532f0d475ea502e114cdac1c75b75bad
sangeethahariharan@Sangeethas-MacBook-Pro-2 673f54c844864777b8630b9478e27283532f0d475ea502e114cdac1c75b75bad % ls -ltr
total 0

Note - Using ~ with image-generation tool seems to not break the tool from working using ~ created under the current working directory .

Expected Behavior:
~ should be translated to home dir and we should be able to use the tools successfully .

gptscript version - v0.0.0-dev-a5a0538d-dirty

Able to use "~" in --cache-dir successfully.