jan icon indicating copy to clipboard operation
jan copied to clipboard

feat: Don't place critical files in home directory (XDG)

Open REALERvolker1 opened this issue 1 year ago • 5 comments

Problem Jan places files required for its operation directly in the user home directory, which is volatile and does not respect user and platform conventions. A much better idea would be to place the folders in the standard paths for such data.

Success Criteria Jan should place its files in the following directories per-platform

  • Linux -- $XDG_DATA_HOME/jan, falling back to ~/.local/share/jan
  • OSX -- ~/Library/jan
  • Windows -- %LOCALAPPDATA%/jan

Additionally, Jan should not create the folder ~/.npm/_cacache, or store any cache in or at least move it to the following locations:

  • Linux -- $XDG_CACHE_HOME/jan, falling back to ~/.cache/jan
  • OSX -- ~/Library/Caches/jan
  • Windows -- No platform-specified cache folder, should be in %LOCALAPPDATA%/jan/cache

This would help a lot for people on systems with a centrally-managed home or user directory, such as enterprise Windows and NixOS. Additionally, if an environment variable were added (for example, $JAN_HOME), it would make development a lot easier as you could programmatically make Jan load different data directories for testing.

Additional context XDG Base Directory Specification A wonderful Stack Overflow answer about this topic A useful typescript library

Given the age of this project, the best time to implement this is right now!

REALERvolker1 avatar Jan 04 '24 22:01 REALERvolker1

On this topic, considering the size of the expected usage, the data directory at least for models should be user-settable. I don't have that much space to spare on my windows boot drive!

acharneski avatar Jan 05 '24 01:01 acharneski

As someone who's already downloaded the Mixtral 8x7B (26 GB) mode, I'd rather point to it on my D: drive than have to redownload it to the system drive.

Being able to point to different directories where already-downloaded models exist would be a welcomed enhancement.

dijikul avatar Jan 05 '24 05:01 dijikul

We agree with all of the above. Tracking some sub issues across: #1381 #1010

freelerobot avatar Jan 05 '24 07:01 freelerobot

Just going to comment on this, I did not expect such a positive response! Thank you for planning this feature.

REALERvolker1 avatar Jan 06 '24 10:01 REALERvolker1

Fully agree with this. I just installed Jan and my work around was to create a symlink, "mklink /D C:\users\<user>\jan D:\AI\jan" I love symlinks on Windows! For anyone else wanting to do this, I had to move all the files from the original location to my target folder FIRST, and then delete the original folder "jan" in my home dir, then I was able to run the mklink command to properly create the symlink.

petermg avatar Jan 07 '24 06:01 petermg

Thank you so much for flagging this. This issue will be solved once we finish epic: Files & Links https://github.com/orgs/janhq/projects/5/views/16?pane=issue&itemId=49509878, you can check the implementation progress under the task list section. I will close this issue for now.

imtuyethan avatar Jan 16 '24 07:01 imtuyethan