diff --git a/src/routes/(app)/+layout.svelte b/src/routes/(app)/+layout.svelte index aab34a10..54922fd0 100644 --- a/src/routes/(app)/+layout.svelte +++ b/src/routes/(app)/+layout.svelte @@ -44,31 +44,28 @@ let showShortcuts = false; const getModels = async () => { - let models = []; - models.push( - ...(await getOllamaModels(localStorage.token).catch((error) => { - toast.error(error); - return []; - })) - ); + let models = await Promise.all([ + await getOllamaModels(localStorage.token).catch((error) => { + console.log(error); + return null; + }), + await getOpenAIModels(localStorage.token).catch((error) => { + console.log(error); + return null; + }), + await getLiteLLMModels(localStorage.token).catch((error) => { + console.log(error); + return null; + }) + ]); - // $settings.OPENAI_API_BASE_URL ?? 'https://api.openai.com/v1', - // $settings.OPENAI_API_KEY - - const openAIModels = await getOpenAIModels(localStorage.token).catch((error) => { - console.log(error); - return null; - }); - - models.push(...(openAIModels ? [{ name: 'hr' }, ...openAIModels] : [])); - - const liteLLMModels = await getLiteLLMModels(localStorage.token).catch((error) => { - console.log(error); - return null; - }); - - models.push(...(liteLLMModels ? [{ name: 'hr' }, ...liteLLMModels] : [])); + models = models + .filter((models) => models) + .reduce((a, e, i, arr) => a.concat(e, ...(i < arr.length - 1 ? [{ name: 'hr' }] : [])), []); + // models.push(...(ollamaModels ? [{ name: 'hr' }, ...ollamaModels] : [])); + // models.push(...(openAIModels ? [{ name: 'hr' }, ...openAIModels] : [])); + // models.push(...(liteLLMModels ? [{ name: 'hr' }, ...liteLLMModels] : [])); return models; }; @@ -125,8 +122,6 @@ await models.set(await getModels()); }); - await setOllamaVersion(); - document.addEventListener('keydown', function (event) { const isCtrlPressed = event.ctrlKey || event.metaKey; // metaKey is for Cmd key on Mac // Check if the Shift key is pressed @@ -258,60 +253,6 @@ - {:else if checkVersion(REQUIRED_OLLAMA_VERSION, ollamaVersion ?? '0')} -
-
-
-
-
- Connection Issue or Update Needed -
- -
- Oops! It seems like your Ollama needs a little attention. We've detected either a connection hiccup or observed that you're using an older - version. Ensure you're on the latest Ollama version - (version - {REQUIRED_OLLAMA_VERSION} or higher) or check your connection. - -
- Trouble accessing Ollama? - - Click here for help. - -
-
- -
- - - -
-
-
-
-
{:else if localDBChats.length > 0}