From 05daddb60cc85bdd4e8d23807d1d3f10b36357c7 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Sun, 27 Apr 2025 23:18:39 +0300 Subject: [PATCH] Fix KoboldCpp saved vectors retrieval --- public/scripts/extensions/vectors/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/public/scripts/extensions/vectors/index.js b/public/scripts/extensions/vectors/index.js index 491c4eb95..4d238ff4e 100644 --- a/public/scripts/extensions/vectors/index.js +++ b/public/scripts/extensions/vectors/index.js @@ -829,11 +829,12 @@ async function getAdditionalArgs(items) { * @returns {Promise} Saved hashes */ async function getSavedHashes(collectionId) { + const args = await getAdditionalArgs([]); const response = await fetch('/api/vector/list', { method: 'POST', headers: getRequestHeaders(), body: JSON.stringify({ - ...getVectorsRequestBody(), + ...getVectorsRequestBody(args), collectionId: collectionId, source: settings.source, }), @@ -1155,6 +1156,9 @@ function loadWebLlmModels() { * @returns {Promise>} Calculated embeddings */ async function createWebLlmEmbeddings(items) { + if (items.length === 0) { + return /** @type {Record} */ ({}); + } return executeWithWebLlmErrorHandling(async () => { const embeddings = await webllmProvider.embedTexts(items, settings.webllm_model); const result = /** @type {Record} */ ({});