dsh-codebase-chat 0.25.5 → 0.25.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2824,8 +2824,16 @@ function loadLocalModel() {
2824
2824
  throw new Error(`Local model not found: ${spec}`);
2825
2825
  }
2826
2826
  const { getLlama } = await importLlama();
2827
- const llama = await getLlama();
2828
- return llama.loadModel({ modelPath });
2827
+ const cpuOnly = /^(0|off|false|cpu)$/i.test(process.env.CODEBASE_LOCAL_GPU || "");
2828
+ const llama = await getLlama(cpuOnly ? { gpu: false } : {});
2829
+ try {
2830
+ return await llama.loadModel({ modelPath });
2831
+ } catch (err) {
2832
+ if (cpuOnly) throw err;
2833
+ console.error(`[local-llm] GPU load failed (${err instanceof Error ? err.message : err}) \u2014 falling back to CPU. Slower, but works. Set CODEBASE_LOCAL_GPU=off to skip GPU entirely.`);
2834
+ const cpuLlama = await getLlama({ gpu: false });
2835
+ return cpuLlama.loadModel({ modelPath });
2836
+ }
2829
2837
  })();
2830
2838
  modelPromise.catch(() => {
2831
2839
  modelPromise = null;