diff --git a/src/lib/components/chat/ModelSelector/Selector.svelte b/src/lib/components/chat/ModelSelector/Selector.svelte index 96af8c763..8507f7a21 100644 --- a/src/lib/components/chat/ModelSelector/Selector.svelte +++ b/src/lib/components/chat/ModelSelector/Selector.svelte @@ -42,9 +42,11 @@ let searchValue = ''; let ollamaVersion = null; - $: filteredItems = searchValue - ? items.filter((item) => item.value.toLowerCase().includes(searchValue.toLowerCase())) - : items; + $: filteredItems = items.filter((item) => + searchValue + ? item.value.toLowerCase().includes(searchValue.toLowerCase()) + : true && !(item.model?.info?.meta?.hidden ?? false) + ); const pullModelHandler = async () => { const sanitizedModelTag = searchValue.trim().replace(/^ollama\s+(run|pull)\s+/, ''); diff --git a/src/lib/components/icons/EllipsisHorizontal.svelte b/src/lib/components/icons/EllipsisHorizontal.svelte new file mode 100644 index 000000000..6a7d532e3 --- /dev/null +++ b/src/lib/components/icons/EllipsisHorizontal.svelte @@ -0,0 +1,19 @@ + + + diff --git a/src/lib/components/workspace/Models.svelte b/src/lib/components/workspace/Models.svelte index 7c4829e3a..2fe8cef27 100644 --- a/src/lib/components/workspace/Models.svelte +++ b/src/lib/components/workspace/Models.svelte @@ -12,6 +12,8 @@ import { goto } from '$app/navigation'; import { getModels } from '$lib/apis'; + import EllipsisHorizontal from '../icons/EllipsisHorizontal.svelte'; + import ModelMenu from './Models/ModelMenu.svelte'; const i18n = getContext('i18n'); @@ -74,6 +76,41 @@ ); }; + const hideModelHandler = async (model) => { + let info = model.info; + + if (!info) { + info = { + id: model.id, + name: model.name, + meta: { + suggestion_prompts: null + }, + params: {} + }; + } + + info.meta = { + ...info.meta, + hidden: !(info?.meta?.hidden ?? false) + }; + + console.log(info); + + const res = await updateModelById(localStorage.token, info.id, info); + + if (res) { + toast.success( + $i18n.t(`Model {{name}} is now {{status}}`, { + name: info.id, + status: info.meta.hidden ? 'hidden' : 'visible' + }) + ); + } + + await models.set(await getModels(localStorage.token)); + }; + const downloadModels = async (models) => { let blob = new Blob([JSON.stringify(models)], { type: 'application/json' @@ -177,7 +214,11 @@ href={`/?models=${encodeURIComponent(model.id)}`} >