From 1aa33a46675ee51077ca6351e25a8568767c3eb5 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Sat, 25 May 2024 00:44:21 -0700 Subject: [PATCH] refac --- src/lib/apis/index.ts | 2 +- src/lib/components/admin/Settings/Users.svelte | 2 +- src/lib/components/chat/Chat.svelte | 6 +++--- src/lib/components/chat/Settings/Interface.svelte | 7 ++----- src/lib/components/chat/Settings/Models.svelte | 5 +---- src/lib/components/documents/Settings/General.svelte | 5 +---- 6 files changed, 9 insertions(+), 18 deletions(-) diff --git a/src/lib/apis/index.ts b/src/lib/apis/index.ts index 88c1db3cd..5d94e7678 100644 --- a/src/lib/apis/index.ts +++ b/src/lib/apis/index.ts @@ -283,7 +283,7 @@ export interface ModelConfig { export interface ModelMeta { description?: string; - vision_capable?: boolean; + capabilities?: object; } export interface ModelParams {} diff --git a/src/lib/components/admin/Settings/Users.svelte b/src/lib/components/admin/Settings/Users.svelte index 6f4144634..f2a8bb19a 100644 --- a/src/lib/components/admin/Settings/Users.svelte +++ b/src/lib/components/admin/Settings/Users.svelte @@ -125,7 +125,7 @@ {#each $models.filter((model) => model.id) as model} {model.name} {/each} diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index 6a4d998a3..a6196bcfd 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -327,10 +327,10 @@ message.files?.some((file) => file.type === 'image') ); - if (hasImages && !(model.custom_info?.meta.vision_capable ?? true)) { + if (hasImages && !(model.info?.meta?.capabilities?.vision ?? true)) { toast.error( $i18n.t('Model {{modelName}} is not vision capable', { - modelName: model.custom_info?.name ?? model.name ?? model.id + modelName: model.name ?? model.id }) ); } @@ -857,7 +857,7 @@ responseMessage.error = true; responseMessage.content = $i18n.t(`Uh-oh! There was an issue connecting to {{provider}}.`, { - provider: model.custom_info?.name ?? model.name ?? model.id + provider: model.name ?? model.id }) + '\n' + errorMessage; diff --git a/src/lib/components/chat/Settings/Interface.svelte b/src/lib/components/chat/Settings/Interface.svelte index 8a7e5257c..e2cba7d46 100644 --- a/src/lib/components/chat/Settings/Interface.svelte +++ b/src/lib/components/chat/Settings/Interface.svelte @@ -298,10 +298,7 @@ {#each $models as model} {#if model.size != null} {/if} {/each} @@ -319,7 +316,7 @@ {#each $models as model} {#if model.name !== 'hr'} {/if} {/each} diff --git a/src/lib/components/chat/Settings/Models.svelte b/src/lib/components/chat/Settings/Models.svelte index 5cfee56db..25fd1743d 100644 --- a/src/lib/components/chat/Settings/Models.svelte +++ b/src/lib/components/chat/Settings/Models.svelte @@ -646,10 +646,7 @@ {/if} {#each $models.filter((m) => m.size != null && (selectedOllamaUrlIdx === null ? true : (m?.urls ?? []).includes(selectedOllamaUrlIdx))) as model} {model.name + ' (' + (model.size / 1024 ** 3).toFixed(1) + ' GB)'} {/each} diff --git a/src/lib/components/documents/Settings/General.svelte b/src/lib/components/documents/Settings/General.svelte index de4f10d79..02e0754c2 100644 --- a/src/lib/components/documents/Settings/General.svelte +++ b/src/lib/components/documents/Settings/General.svelte @@ -323,10 +323,7 @@ {/if} {#each $models.filter((m) => m.id && !m.external) as model} {model.name + ' (' + (model.size / 1024 ** 3).toFixed(1) + ' GB)'} {/each}