refac
This commit is contained in:
1 parent
6fd8c599c1
commit
c89fd237b8
3 files changed
+65
-36
No files matched your search
@@ -42,10 +42,11 @@
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
export let id = '';
|
||||
export let value = '';
|
||||
export let value: string | null = '';
|
||||
export let placeholder = $i18n.t('Select a model');
|
||||
export let searchEnabled = true;
|
||||
export let searchPlaceholder = $i18n.t('Search a model');
|
||||
export let selectionOnly = false;
|
||||
|
||||
export let items: {
|
||||
label: string;
|
||||
@@ -398,7 +399,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
$: if (show) {
|
||||
$: if (show && !selectionOnly) {
|
||||
setOllamaVersion();
|
||||
}
|
||||
|
||||
@@ -742,6 +743,7 @@
|
||||
{pinModelHandler}
|
||||
{unloadModelHandler}
|
||||
{deleteModelHandler}
|
||||
{selectionOnly}
|
||||
onClick={() => {
|
||||
value = item.value;
|
||||
selectedModelIdx = index;
|
||||
@@ -754,7 +756,7 @@
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if !(searchValue.trim() in $MODEL_DOWNLOAD_POOL) && searchValue && ollamaVersion && $user?.role === 'admin'}
|
||||
{#if !selectionOnly && !(searchValue.trim() in $MODEL_DOWNLOAD_POOL) && searchValue && ollamaVersion && $user?.role === 'admin'}
|
||||
<Tooltip
|
||||
content={$i18n.t(`Pull "{{searchValue}}" from Ollama.com`, {
|
||||
searchValue: searchValue
|
||||
@@ -776,7 +778,7 @@
|
||||
</Tooltip>
|
||||
{/if}
|
||||
|
||||
{#each Object.keys($MODEL_DOWNLOAD_POOL) as model}
|
||||
{#each selectionOnly ? [] : Object.keys($MODEL_DOWNLOAD_POOL) as model}
|
||||
<div
|
||||
class="flex w-full justify-between font-medium select-none rounded-button py-2 pl-3 pr-1.5 text-sm text-gray-700 dark:text-gray-100 outline-hidden transition-all duration-75 rounded-xl cursor-pointer data-highlighted:bg-muted"
|
||||
>
|
||||
|
||||
Reference in new issue
Block a user