@coreviz/cli 1.0.6 → 1.0.8

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/README.md CHANGED
@@ -66,6 +66,9 @@ Search local images using natural language:
66
66
  npx @coreviz/cli search "a person wearing a red t-shirt"
67
67
  ```
68
68
 
69
+ ![Screenshot of CoreViz CLI visually searching through a folder using AI.](./screenshots/search.png)
70
+
71
+
69
72
  This will index the images in your current directory (creating a `.index.db` file) and return the top matches for your query.
70
73
 
71
74
  ## Development
package/bin/cli.js CHANGED
@@ -296,9 +296,12 @@ program.command('describe <image-path>')
296
296
 
297
297
  program.command('search <query>')
298
298
  .description('Search for images in the current directory using AI')
299
- .action(async (query) => {
299
+ .option('-m, --mode <mode>', 'The mode to use for embedding. Defaults to "local".', 'local')
300
+ .action(async (query, options) => {
300
301
  intro(chalk.bgHex('#663399').white('CoreViz'));
301
302
 
303
+ const mode = options.mode || 'local';
304
+
302
305
  const session = config.get('session');
303
306
  if (!session || !session.access_token) {
304
307
  cancel('You are not logged in. Please run `coreviz login` first.');
@@ -345,6 +348,14 @@ program.command('search <query>')
345
348
  }
346
349
  }
347
350
 
351
+ if (mode === 'local') {
352
+ // You're using the local model, it might take a few minutes for the model to load on the first run.
353
+ spinner.text = "Loading local model, this might take a few minutes to load the first time...";
354
+ spinner.start();
355
+ await coreviz.embedLocal('text', { type: 'text', mode: mode });
356
+ spinner.stop();
357
+ }
358
+
348
359
  for (const file of files) {
349
360
  const filePath = path.join(process.cwd(), file);
350
361
  const stats = fs.statSync(filePath);
@@ -361,7 +372,7 @@ program.command('search <query>')
361
372
 
362
373
  try {
363
374
  const base64Image = readImageAsBase64(filePath);
364
- const { embedding } = await coreviz.embed(base64Image, { type: 'image', mode: 'local' });
375
+ const { embedding } = await coreviz.embed(base64Image, { type: 'image', mode: mode });
365
376
 
366
377
  upsertFile.run(file, mtime, JSON.stringify(embedding));
367
378
  } catch (error) {
@@ -373,7 +384,7 @@ program.command('search <query>')
373
384
  spinner.text = "Processing search query...";
374
385
 
375
386
  try {
376
- const { embedding: queryEmbedding } = await coreviz.embed(query, { type: 'text', mode: 'local' });
387
+ const { embedding: queryEmbedding } = await coreviz.embed(query, { type: 'text', mode: mode });
377
388
 
378
389
  const rows = db.prepare('SELECT path, embedding FROM images').all();
379
390
  const results = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coreviz/cli",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "type": "module",
5
5
  "description": "CoreViz CLI tool",
6
6
  "main": "index.js",
@@ -27,7 +27,7 @@
27
27
  "homepage": "https://github.com/CoreViz/cli#readme",
28
28
  "dependencies": {
29
29
  "@clack/prompts": "^0.11.0",
30
- "@coreviz/sdk": "^1.0.7",
30
+ "@coreviz/sdk": "^1.0.9",
31
31
  "better-auth": "^1.4.2",
32
32
  "better-sqlite3": "^12.4.6",
33
33
  "chalk": "^5.6.2",
Binary file