diff --git a/src/lib/components/chat/ModelSelector/ModelItem.svelte b/src/lib/components/chat/ModelSelector/ModelItem.svelte
new file mode 100644
index 0000000000..cdf0c4479a
--- /dev/null
+++ b/src/lib/components/chat/ModelSelector/ModelItem.svelte
@@ -0,0 +1,264 @@
+
+
+
diff --git a/src/lib/components/chat/ModelSelector/ModelItemMenu.svelte b/src/lib/components/chat/ModelSelector/ModelItemMenu.svelte
new file mode 100644
index 0000000000..8c077f1a7e
--- /dev/null
+++ b/src/lib/components/chat/ModelSelector/ModelItemMenu.svelte
@@ -0,0 +1,79 @@
+
+
+ {
+ if (state === false) {
+ onClose();
+ }
+ }}
+ typeahead={false}
+>
+
+
+
+
+
+
+
+ {
+ toggleSidebarHandler();
+ }}
+ >
+ {#if ($pinnedModels ?? []).includes(model?.id)}
+
+ {:else}
+
+ {/if}
+
+
+ {#if ($pinnedModels ?? []).includes(model?.id)}
+ {$i18n.t('Hide from Sidebar')}
+ {:else}
+ {$i18n.t('Keep in Sidebar')}
+ {/if}
+
+
+
+ {
+ copyLinkHandler();
+ }}
+ >
+
+
+ {$i18n.t('Copy Link')}
+
+
+
diff --git a/src/lib/components/chat/ModelSelector/Selector.svelte b/src/lib/components/chat/ModelSelector/Selector.svelte
index 86504cceb8..d27e43b815 100644
--- a/src/lib/components/chat/ModelSelector/Selector.svelte
+++ b/src/lib/components/chat/ModelSelector/Selector.svelte
@@ -3,12 +3,13 @@
import { marked } from 'marked';
import Fuse from 'fuse.js';
+ import dayjs from '$lib/dayjs';
+ import relativeTime from 'dayjs/plugin/relativeTime';
+ dayjs.extend(relativeTime);
+
import { flyAndScale } from '$lib/utils/transitions';
import { createEventDispatcher, onMount, getContext, tick } from 'svelte';
-
- import ChevronDown from '$lib/components/icons/ChevronDown.svelte';
- import Check from '$lib/components/icons/Check.svelte';
- import Search from '$lib/components/icons/Search.svelte';
+ import { goto } from '$app/navigation';
import { deleteModel, getOllamaVersion, pullModel, unloadModel } from '$lib/apis/ollama';
@@ -25,14 +26,14 @@
import { capitalizeFirstLetter, sanitizeResponseContent, splitStream } from '$lib/utils';
import { getModels } from '$lib/apis';
+ import ChevronDown from '$lib/components/icons/ChevronDown.svelte';
+ import Check from '$lib/components/icons/Check.svelte';
+ import Search from '$lib/components/icons/Search.svelte';
import Tooltip from '$lib/components/common/Tooltip.svelte';
import Switch from '$lib/components/common/Switch.svelte';
import ChatBubbleOval from '$lib/components/icons/ChatBubbleOval.svelte';
- import { goto } from '$app/navigation';
- import dayjs from '$lib/dayjs';
- import relativeTime from 'dayjs/plugin/relativeTime';
- import ArrowUpTray from '$lib/components/icons/ArrowUpTray.svelte';
- dayjs.extend(relativeTime);
+
+ import ModelItem from './ModelItem.svelte';
const i18n = getContext('i18n');
const dispatch = createEventDispatcher();
@@ -494,210 +495,19 @@
{/if}
{#each filteredItems as item, index}
- {
+ {
value = item.value;
selectedModelIdx = index;
show = false;
}}
- >
-
- {#if $mobile && (item?.model?.tags ?? []).length > 0}
-
- {#each item.model?.tags.sort((a, b) => a.name.localeCompare(b.name)) as tag}
-
- {tag.name}
-
- {/each}
-
- {/if}
-
-
-
-
-
-
-
-
-
-
-
-
-
- {#if item.model.owned_by === 'ollama'}
- {#if (item.model.ollama?.details?.parameter_size ?? '') !== ''}
-
-
- {item.model.ollama?.details?.parameter_size ?? ''}
-
-
- {/if}
- {#if item.model.ollama?.expires_at && new Date(item.model.ollama?.expires_at * 1000) > new Date()}
-
- {/if}
- {/if}
-
-
-
- {#if item.model?.direct}
-
-
-
- {:else if item.model.connection_type === 'external'}
-
-
-
- {/if}
-
- {#if item.model?.info?.meta?.description}
-
'
- )
- )}`}
- >
-
-
- {/if}
-
- {#if !$mobile && (item?.model?.tags ?? []).length > 0}
-
- {/if}
-
-
-
-
- {#if $user?.role === 'admin' && item.model.owned_by === 'ollama' && item.model.ollama?.expires_at && new Date(item.model.ollama?.expires_at * 1000) > new Date()}
-
- {
- unloadModelHandler(item.value);
- }}
- >
-
-
-
- {/if}
-
- {#if value === item.value}
-
-
-
- {/if}
-
-
+ />
{:else}
diff --git a/src/lib/components/layout/Sidebar.svelte b/src/lib/components/layout/Sidebar.svelte
index 1bbb714dff..291dbdc2fe 100644
--- a/src/lib/components/layout/Sidebar.svelte
+++ b/src/lib/components/layout/Sidebar.svelte
@@ -21,7 +21,9 @@
channels,
socket,
config,
- isApp
+ isApp,
+ pinnedModels,
+ models
} from '$lib/stores';
import { onMount, getContext, tick, onDestroy } from 'svelte';
@@ -644,6 +646,51 @@
{/if}
+ {#if ($pinnedModels ?? []).length > 0}
+
+ {#each $pinnedModels as modelId (modelId)}
+
+ {/each}
+
+ {/if}
+