ソースを参照

Merge pull request #457 from antonio-mello-ai/fix/model-cache-xdg-cache-home

fix: respect XDG_CACHE_HOME for model cache directory
Tobias Lütke 1 ヶ月 前
コミット
f73386ae02
1 ファイル変更3 行追加1 行削除
  1. 3 1
      src/llm.ts

+ 3 - 1
src/llm.ts

@@ -209,7 +209,9 @@ export const DEFAULT_RERANK_MODEL_URI = DEFAULT_RERANK_MODEL;
 export const DEFAULT_GENERATE_MODEL_URI = DEFAULT_GENERATE_MODEL;
 
 // Local model cache directory
-const MODEL_CACHE_DIR = join(homedir(), ".cache", "qmd", "models");
+const MODEL_CACHE_DIR = process.env.XDG_CACHE_HOME
+  ? join(process.env.XDG_CACHE_HOME, "qmd", "models")
+  : join(homedir(), ".cache", "qmd", "models");
 export const DEFAULT_MODEL_CACHE_DIR = MODEL_CACHE_DIR;
 
 export type PullResult = {