Download embedding model to ~/.codegraph/models on install
The nomic-ai model is now downloaded during npm install via a postinstall script and stored globally in ~/.codegraph/models (shared across projects) instead of per-project in .codegraph/models. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.5
parent
3c2022375a
commit
3ad4d5b35d
@@ -760,7 +760,6 @@ export class CodeGraph {
|
||||
if (!this.vectorManager) {
|
||||
this.vectorManager = createVectorManager(this.db.getDb(), this.queries, {
|
||||
embedder: {
|
||||
cacheDir: path.join(this.projectRoot, '.codegraph', 'models'),
|
||||
showProgress: true,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -7,6 +7,10 @@
|
||||
|
||||
import * as path from 'path';
|
||||
import * as fs from 'fs';
|
||||
import { homedir } from 'os';
|
||||
|
||||
// Global model cache directory (shared across all projects)
|
||||
const GLOBAL_MODELS_DIR = path.join(homedir(), '.codegraph', 'models');
|
||||
|
||||
// Dynamic import for @xenova/transformers (ESM-only package)
|
||||
// We use dynamic import to support CommonJS builds
|
||||
@@ -89,7 +93,7 @@ export class TextEmbedder {
|
||||
|
||||
constructor(options: EmbedderOptions = {}) {
|
||||
this.modelId = options.modelId || DEFAULT_MODEL;
|
||||
this.cacheDir = options.cacheDir || '.codegraph/models';
|
||||
this.cacheDir = options.cacheDir || GLOBAL_MODELS_DIR;
|
||||
this.showProgress = options.showProgress ?? false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user