Add option to use HuggingFace's inference endpoint for generating embeddings (#609)

* Support using hosted Huggingface inference endpoint for embeddings generation
* Since the huggingface inference endpoint is model-specific, make the URL an optional property of the search model config
* Handle ECONNREFUSED error in desktop app
* Drive API key via the search model config model and use more generic names
This commit is contained in:
sabaimran
2024-01-15 19:28:24 -08:00
committed by GitHub
parent 02187b19bb
commit 50575b749b
5 changed files with 84 additions and 3 deletions

View File

@@ -208,7 +208,10 @@ function pushDataToKhoj (regenerate = false) {
})
.catch(error => {
console.error(error);
if (error.response.status == 429) {
if (error.code == 'ECONNREFUSED') {
const win = BrowserWindow.getAllWindows()[0];
if (win) win.webContents.send('update-state', state);
} else if (error.response.status == 429) {
const win = BrowserWindow.getAllWindows()[0];
if (win) win.webContents.send('needsSubscription', true);
if (win) win.webContents.send('update-state', state);