Skip to content

Commit c4efa81

Browse files
committed
refac
1 parent 9ca8cf5 commit c4efa81

1 file changed

Lines changed: 78 additions & 0 deletions

File tree

src/lib/components/admin/Settings/Models.svelte

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,18 @@
4040
import EyeSlash from '$lib/components/icons/EyeSlash.svelte';
4141
import Eye from '$lib/components/icons/Eye.svelte';
4242
import ChevronDown from '$lib/components/icons/ChevronDown.svelte';
43+
import Check from '$lib/components/icons/Check.svelte';
4344
import CheckCircle from '$lib/components/icons/CheckCircle.svelte';
4445
import GarbageBin from '$lib/components/icons/GarbageBin.svelte';
4546
import Minus from '$lib/components/icons/Minus.svelte';
4647
import DocumentArrowUp from '$lib/components/icons/DocumentArrowUp.svelte';
4748
import Download from '$lib/components/icons/Download.svelte';
4849
import EllipsisVertical from '$lib/components/icons/EllipsisVertical.svelte';
4950
import Wrench from '$lib/components/icons/Wrench.svelte';
51+
import Pin from '$lib/components/icons/Pin.svelte';
52+
import PinSlash from '$lib/components/icons/PinSlash.svelte';
53+
import GlobeAlt from '$lib/components/icons/GlobeAlt.svelte';
54+
import LockClosed from '$lib/components/icons/LockClosed.svelte';
5055
import { WEBUI_API_BASE_URL } from '$lib/constants';
5156
import { goto } from '$app/navigation';
5257
@@ -1013,6 +1018,79 @@
10131018
{/if}
10141019
</button>
10151020
</Tooltip>
1021+
1022+
<Tooltip
1023+
content={defaultModelIdSet.has(model.id)
1024+
? $i18n.t('Remove Selected Model')
1025+
: $i18n.t('Set as Selected Model')}
1026+
>
1027+
<button
1028+
class="self-center w-fit text-sm p-1.5 rounded-xl hover:bg-black/5 dark:hover:bg-white/5 {defaultModelIdSet.has(
1029+
model.id
1030+
)
1031+
? 'text-gray-900 dark:text-white'
1032+
: 'text-gray-500 dark:text-gray-400 dark:hover:text-white'}"
1033+
type="button"
1034+
aria-label={defaultModelIdSet.has(model.id)
1035+
? $i18n.t('Remove Selected Model')
1036+
: $i18n.t('Set as Selected Model')}
1037+
on:click={() => {
1038+
toggleDefaultModelHandler(model);
1039+
}}
1040+
>
1041+
<Check className="size-3.5" />
1042+
</button>
1043+
</Tooltip>
1044+
1045+
<Tooltip
1046+
content={defaultPinnedModelIdSet.has(model.id)
1047+
? $i18n.t('Remove Pinned Model')
1048+
: $i18n.t('Set as Pinned Model')}
1049+
>
1050+
<button
1051+
class="self-center w-fit text-sm p-1.5 rounded-xl hover:bg-black/5 dark:hover:bg-white/5 {defaultPinnedModelIdSet.has(
1052+
model.id
1053+
)
1054+
? 'text-gray-900 dark:text-white'
1055+
: 'text-gray-500 dark:text-gray-400 dark:hover:text-white'}"
1056+
type="button"
1057+
aria-label={defaultPinnedModelIdSet.has(model.id)
1058+
? $i18n.t('Remove Pinned Model')
1059+
: $i18n.t('Set as Pinned Model')}
1060+
on:click={() => {
1061+
toggleDefaultPinnedModelHandler(model);
1062+
}}
1063+
>
1064+
{#if defaultPinnedModelIdSet.has(model.id)}
1065+
<PinSlash className="size-3.5" />
1066+
{:else}
1067+
<Pin className="size-3.5" />
1068+
{/if}
1069+
</button>
1070+
</Tooltip>
1071+
1072+
<Tooltip
1073+
content={isPublicModel(model)
1074+
? $i18n.t('Make Private')
1075+
: $i18n.t('Make Public')}
1076+
>
1077+
<button
1078+
class="self-center w-fit text-sm p-1.5 rounded-xl text-gray-500 hover:bg-black/5 dark:text-gray-400 dark:hover:bg-white/5 dark:hover:text-white"
1079+
type="button"
1080+
aria-label={isPublicModel(model)
1081+
? $i18n.t('Make Private')
1082+
: $i18n.t('Make Public')}
1083+
on:click={() => {
1084+
toggleModelPrivacyHandler(model);
1085+
}}
1086+
>
1087+
{#if isPublicModel(model)}
1088+
<LockClosed className="size-3.5" />
1089+
{:else}
1090+
<GlobeAlt className="size-3.5" />
1091+
{/if}
1092+
</button>
1093+
</Tooltip>
10161094
{/if}
10171095

10181096
<button

0 commit comments

Comments
 (0)