voyageai-cli 1.33.2 → 1.33.4
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/package.json +1 -1
- package/src/commands/playground.js +4 -1
- package/src/lib/playground-rag-api.js +191 -43
- package/src/nano/nano-bridge.py +1 -1
- package/src/playground/index.html +1725 -954
- package/src/playground/js/kb-manager.js +13 -3
- package/src/playground/js/kb-ui.js +17 -1
|
@@ -9,11 +9,20 @@ class KBManager {
|
|
|
9
9
|
this.kbs = [];
|
|
10
10
|
this.isIngesting = false;
|
|
11
11
|
this.ingestionProgress = { current: 0, total: 0, currentFile: '' };
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
// Local state
|
|
14
14
|
this.loadLastKB();
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* Get the currently selected embedding model from the chat config UI.
|
|
19
|
+
* Falls back to 'voyage-4-large' if the element is missing.
|
|
20
|
+
*/
|
|
21
|
+
getEmbeddingModel() {
|
|
22
|
+
const sel = document.getElementById('chatEmbeddingModel');
|
|
23
|
+
return sel ? sel.value : 'voyage-4-large';
|
|
24
|
+
}
|
|
25
|
+
|
|
17
26
|
/**
|
|
18
27
|
* Load last used KB from localStorage
|
|
19
28
|
*/
|
|
@@ -97,6 +106,7 @@ class KBManager {
|
|
|
97
106
|
if (kbName) {
|
|
98
107
|
formData.append('kbName', kbName);
|
|
99
108
|
}
|
|
109
|
+
formData.append('embeddingModel', this.getEmbeddingModel());
|
|
100
110
|
|
|
101
111
|
try {
|
|
102
112
|
this.isIngesting = true;
|
|
@@ -175,7 +185,7 @@ class KBManager {
|
|
|
175
185
|
const res = await fetch('/api/rag/ingest-text', {
|
|
176
186
|
method: 'POST',
|
|
177
187
|
headers: { 'Content-Type': 'application/json' },
|
|
178
|
-
body: JSON.stringify({ text, kbName, title })
|
|
188
|
+
body: JSON.stringify({ text, kbName, title, embeddingModel: this.getEmbeddingModel() })
|
|
179
189
|
});
|
|
180
190
|
|
|
181
191
|
if (!res.ok) {
|
|
@@ -239,7 +249,7 @@ class KBManager {
|
|
|
239
249
|
const res = await fetch('/api/rag/ingest-url', {
|
|
240
250
|
method: 'POST',
|
|
241
251
|
headers: { 'Content-Type': 'application/json' },
|
|
242
|
-
body: JSON.stringify({ url, kbName })
|
|
252
|
+
body: JSON.stringify({ url, kbName, embeddingModel: this.getEmbeddingModel() })
|
|
243
253
|
});
|
|
244
254
|
|
|
245
255
|
if (!res.ok) {
|
|
@@ -499,6 +499,7 @@ class KBUIManager {
|
|
|
499
499
|
const progressBar = document.getElementById('kbPanelProgressBar');
|
|
500
500
|
const progressLabel = document.getElementById('kbPanelProgressLabel');
|
|
501
501
|
if (!progressContainer) return;
|
|
502
|
+
const warnings = [];
|
|
502
503
|
|
|
503
504
|
try {
|
|
504
505
|
progressContainer.style.display = 'block';
|
|
@@ -531,12 +532,27 @@ class KBUIManager {
|
|
|
531
532
|
|
|
532
533
|
if (progressBar) progressBar.style.width = `${percent}%`;
|
|
533
534
|
if (progressLabel) progressLabel.textContent = label;
|
|
535
|
+
} else if (event.type === 'warning') {
|
|
536
|
+
if (event.warning) warnings.push(event.warning);
|
|
537
|
+
if (progressLabel) progressLabel.textContent = event.warning || 'Upload completed with warnings';
|
|
534
538
|
} else if (event.type === 'complete') {
|
|
535
539
|
if (progressBar) progressBar.style.width = '100%';
|
|
536
|
-
|
|
540
|
+
const hasWarnings = warnings.length > 0 || event.docCount === 0;
|
|
541
|
+
if (progressLabel) {
|
|
542
|
+
progressLabel.textContent = hasWarnings
|
|
543
|
+
? `Complete with warnings: ${event.docCount} docs, ${event.chunkCount} chunks`
|
|
544
|
+
: `✓ Complete: ${event.docCount} docs, ${event.chunkCount} chunks`;
|
|
545
|
+
}
|
|
537
546
|
setTimeout(() => {
|
|
538
547
|
this.updatePanelUI();
|
|
539
548
|
progressContainer.style.display = 'none';
|
|
549
|
+
const messages = [...warnings];
|
|
550
|
+
if (event.docCount === 0) {
|
|
551
|
+
messages.unshift('No documents were stored from that upload.');
|
|
552
|
+
}
|
|
553
|
+
if (messages.length > 0) {
|
|
554
|
+
alert(messages.join('\n'));
|
|
555
|
+
}
|
|
540
556
|
}, 1000);
|
|
541
557
|
} else if (event.type === 'error') {
|
|
542
558
|
console.error('Ingestion error:', event.error);
|