From d2248383fd9c048cb331e0fcbb3f8d2df9e27982 Mon Sep 17 00:00:00 2001 From: kwaroran Date: Mon, 29 Apr 2024 01:53:27 +0900 Subject: [PATCH] Fix return value for custom embedding URL in HypaProcesser --- src/ts/process/memory/hypamemory.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/ts/process/memory/hypamemory.ts b/src/ts/process/memory/hypamemory.ts index 90282e14..caf105dd 100644 --- a/src/ts/process/memory/hypamemory.ts +++ b/src/ts/process/memory/hypamemory.ts @@ -38,7 +38,7 @@ export class HypaProcesser{ } - async getEmbeds(input:string[]|string) { + async getEmbeds(input:string[]|string):Promise { if(this.model === 'MiniLM' || this.model === 'nomic'){ const inputs:string[] = Array.isArray(input) ? input : [input] let results:Float32Array[] = await runEmbedding(inputs, this.model === 'nomic' ? 'nomic-ai/nomic-embed-text-v1.5' : 'Xenova/all-MiniLM-L6-v2') @@ -47,8 +47,7 @@ export class HypaProcesser{ let gf = null; if(this.model === 'custom'){ if(!this.customEmbeddingUrl){ - alertError('Custom model requires a Custom Server URL') - return [0] + throw new Error('Custom model requires a Custom Server URL') } const {customEmbeddingUrl} = this const replaceUrl = customEmbeddingUrl.endsWith('/embeddings')?customEmbeddingUrl:appendLastPath(customEmbeddingUrl,'embeddings')