Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
feat: improved nav consistency on mobile (#1726)
Browse files* feat: improved nav consistency on mobile
* fix: padding
* fix: headings consistency
* feat: add animations
- src/lib/components/AssistantSettings.svelte +1 -1
- src/lib/components/DisclaimerModal.svelte +1 -1
- src/lib/components/LoginModal.svelte +1 -1
- src/lib/components/Modal.svelte +10 -3
- src/lib/components/OverloadedModal.svelte +1 -1
- src/lib/components/SystemPromptModal.svelte +1 -1
- src/routes/settings/(nav)/+layout.svelte +169 -141
- src/routes/settings/(nav)/application/+page.svelte +4 -5
- src/routes/settings/(nav)/assistants/[assistantId]/edit/{[email protected] → +page.svelte} +0 -0
- src/routes/settings/(nav)/assistants/new/{[email protected] → +page.svelte} +0 -0
- src/routes/settings/+layout.svelte +2 -1
- src/routes/tools/[toolId]/+page.svelte +1 -1
- src/routes/tools/[toolId]/edit/+page.svelte +1 -0
src/lib/components/AssistantSettings.svelte
CHANGED
|
@@ -99,7 +99,7 @@
|
|
| 99 |
</script>
|
| 100 |
|
| 101 |
<form
|
| 102 |
-
class="relative flex h-full flex-col overflow-y-auto p-
|
| 103 |
enctype="multipart/form-data"
|
| 104 |
onsubmit={async (e) => {
|
| 105 |
e.preventDefault();
|
|
|
|
| 99 |
</script>
|
| 100 |
|
| 101 |
<form
|
| 102 |
+
class="relative flex h-full flex-col overflow-y-auto md:p-8 md:pt-0"
|
| 103 |
enctype="multipart/form-data"
|
| 104 |
onsubmit={async (e) => {
|
| 105 |
e.preventDefault();
|
src/lib/components/DisclaimerModal.svelte
CHANGED
|
@@ -11,7 +11,7 @@
|
|
| 11 |
const settings = useSettingsStore();
|
| 12 |
</script>
|
| 13 |
|
| 14 |
-
<Modal on:close>
|
| 15 |
<div
|
| 16 |
class="from-primary-500/40 via-primary-500/10 to-primary-500/0 flex w-full flex-col items-center gap-6 bg-gradient-to-b px-5 pb-8 pt-9 text-center sm:px-6"
|
| 17 |
>
|
|
|
|
| 11 |
const settings = useSettingsStore();
|
| 12 |
</script>
|
| 13 |
|
| 14 |
+
<Modal on:close width="max-w-[400px]">
|
| 15 |
<div
|
| 16 |
class="from-primary-500/40 via-primary-500/10 to-primary-500/0 flex w-full flex-col items-center gap-6 bg-gradient-to-b px-5 pb-8 pt-9 text-center sm:px-6"
|
| 17 |
>
|
src/lib/components/LoginModal.svelte
CHANGED
|
@@ -11,7 +11,7 @@
|
|
| 11 |
const settings = useSettingsStore();
|
| 12 |
</script>
|
| 13 |
|
| 14 |
-
<Modal on:close>
|
| 15 |
<div
|
| 16 |
class="from-primary-500/40 via-primary-500/10 to-primary-500/0 flex w-full flex-col items-center gap-6 bg-gradient-to-b px-5 pb-8 pt-9 text-center"
|
| 17 |
>
|
|
|
|
| 11 |
const settings = useSettingsStore();
|
| 12 |
</script>
|
| 13 |
|
| 14 |
+
<Modal on:close width="max-w-[400px]">
|
| 15 |
<div
|
| 16 |
class="from-primary-500/40 via-primary-500/10 to-primary-500/0 flex w-full flex-col items-center gap-6 bg-gradient-to-b px-5 pb-8 pt-9 text-center"
|
| 17 |
>
|
src/lib/components/Modal.svelte
CHANGED
|
@@ -4,13 +4,15 @@
|
|
| 4 |
import { fade, fly } from "svelte/transition";
|
| 5 |
import Portal from "./Portal.svelte";
|
| 6 |
import { browser } from "$app/environment";
|
|
|
|
| 7 |
|
| 8 |
interface Props {
|
| 9 |
width?: string;
|
|
|
|
| 10 |
children?: import("svelte").Snippet;
|
| 11 |
}
|
| 12 |
|
| 13 |
-
let { width = "max-w-sm", children }: Props = $props();
|
| 14 |
|
| 15 |
let backdropEl: HTMLDivElement | undefined = $state();
|
| 16 |
let modalEl: HTMLDivElement | undefined = $state();
|
|
@@ -56,7 +58,7 @@
|
|
| 56 |
handleBackdropClick(e);
|
| 57 |
}}
|
| 58 |
transition:fade|local={{ easing: cubicOut, duration: 300 }}
|
| 59 |
-
class="fixed inset-0 z-40 flex items-center justify-center bg-black/80
|
| 60 |
>
|
| 61 |
<div
|
| 62 |
role="dialog"
|
|
@@ -65,10 +67,15 @@
|
|
| 65 |
onkeydown={handleKeydown}
|
| 66 |
in:fly={{ y: 100 }}
|
| 67 |
class={[
|
| 68 |
-
"max-h-[
|
| 69 |
width,
|
| 70 |
]}
|
| 71 |
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
{@render children?.()}
|
| 73 |
</div>
|
| 74 |
</div>
|
|
|
|
| 4 |
import { fade, fly } from "svelte/transition";
|
| 5 |
import Portal from "./Portal.svelte";
|
| 6 |
import { browser } from "$app/environment";
|
| 7 |
+
import CarbonClose from "~icons/carbon/close";
|
| 8 |
|
| 9 |
interface Props {
|
| 10 |
width?: string;
|
| 11 |
+
closeButton?: boolean;
|
| 12 |
children?: import("svelte").Snippet;
|
| 13 |
}
|
| 14 |
|
| 15 |
+
let { width = "max-w-sm", children, closeButton = false }: Props = $props();
|
| 16 |
|
| 17 |
let backdropEl: HTMLDivElement | undefined = $state();
|
| 18 |
let modalEl: HTMLDivElement | undefined = $state();
|
|
|
|
| 58 |
handleBackdropClick(e);
|
| 59 |
}}
|
| 60 |
transition:fade|local={{ easing: cubicOut, duration: 300 }}
|
| 61 |
+
class="fixed inset-0 z-40 flex items-center justify-center bg-black/80 backdrop-blur-sm dark:bg-black/50"
|
| 62 |
>
|
| 63 |
<div
|
| 64 |
role="dialog"
|
|
|
|
| 67 |
onkeydown={handleKeydown}
|
| 68 |
in:fly={{ y: 100 }}
|
| 69 |
class={[
|
| 70 |
+
"relative mx-auto max-h-[95dvh] max-w-[90dvw] overflow-y-auto overflow-x-hidden rounded-2xl bg-white shadow-2xl outline-none",
|
| 71 |
width,
|
| 72 |
]}
|
| 73 |
>
|
| 74 |
+
{#if closeButton}
|
| 75 |
+
<button class="absolute right-4 top-4 z-50" onclick={() => dispatch("close")}>
|
| 76 |
+
<CarbonClose class="size-6 text-gray-700" />
|
| 77 |
+
</button>
|
| 78 |
+
{/if}
|
| 79 |
{@render children?.()}
|
| 80 |
</div>
|
| 81 |
</div>
|
src/lib/components/OverloadedModal.svelte
CHANGED
|
@@ -8,7 +8,7 @@
|
|
| 8 |
let { onClose }: { onClose: () => void } = $props();
|
| 9 |
</script>
|
| 10 |
|
| 11 |
-
<Modal on:close={onClose}>
|
| 12 |
<div
|
| 13 |
class="from-primary-500/40 via-primary-500/10 to-primary-500/0 flex w-full flex-col items-center gap-3 bg-gradient-to-b px-5 pb-4 pt-9 text-center sm:px-6"
|
| 14 |
>
|
|
|
|
| 8 |
let { onClose }: { onClose: () => void } = $props();
|
| 9 |
</script>
|
| 10 |
|
| 11 |
+
<Modal on:close={onClose} width="max-w-[400px]">
|
| 12 |
<div
|
| 13 |
class="from-primary-500/40 via-primary-500/10 to-primary-500/0 flex w-full flex-col items-center gap-3 bg-gradient-to-b px-5 pb-4 pt-9 text-center sm:px-6"
|
| 14 |
>
|
src/lib/components/SystemPromptModal.svelte
CHANGED
|
@@ -22,7 +22,7 @@
|
|
| 22 |
</button>
|
| 23 |
|
| 24 |
{#if isOpen}
|
| 25 |
-
<Modal on:close={() => (isOpen = false)} width="w-full max-w-
|
| 26 |
<div class="flex w-full flex-col gap-5 p-6">
|
| 27 |
<div class="flex items-start justify-between text-xl font-semibold text-gray-800">
|
| 28 |
<h2>System Prompt</h2>
|
|
|
|
| 22 |
</button>
|
| 23 |
|
| 24 |
{#if isOpen}
|
| 25 |
+
<Modal on:close={() => (isOpen = false)} width="w-full max-w-xl">
|
| 26 |
<div class="flex w-full flex-col gap-5 p-6">
|
| 27 |
<div class="flex items-start justify-between text-xl font-semibold text-gray-800">
|
| 28 |
<h2>System Prompt</h2>
|
src/routes/settings/(nav)/+layout.svelte
CHANGED
|
@@ -17,6 +17,8 @@
|
|
| 17 |
import { isDesktop } from "$lib/utils/isDesktop";
|
| 18 |
import { debounce } from "$lib/utils/debounce";
|
| 19 |
|
|
|
|
|
|
|
| 20 |
interface Props {
|
| 21 |
data: LayoutData;
|
| 22 |
children?: import("svelte").Snippet;
|
|
@@ -65,9 +67,9 @@
|
|
| 65 |
</script>
|
| 66 |
|
| 67 |
<div
|
| 68 |
-
class="grid h-full w-full grid-cols-1 grid-rows-[auto,1fr] content-start gap-x-
|
| 69 |
>
|
| 70 |
-
<div class="col-span-1 mb-
|
| 71 |
{#if showContent && browser}
|
| 72 |
<button
|
| 73 |
class="btn rounded-lg md:hidden"
|
|
@@ -80,7 +82,9 @@
|
|
| 80 |
<CarbonChevronLeft class="text-xl text-gray-900 hover:text-black" />
|
| 81 |
</button>
|
| 82 |
{/if}
|
| 83 |
-
<h2 class="text-xl font-bold">
|
|
|
|
|
|
|
| 84 |
<button
|
| 85 |
class="btn rounded-lg"
|
| 86 |
aria-label="Close settings"
|
|
@@ -91,166 +95,190 @@
|
|
| 91 |
<CarbonClose class="text-xl text-gray-900 hover:text-black" />
|
| 92 |
</button>
|
| 93 |
</div>
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
class="
|
| 104 |
-
{model.id === page.params.model ? '!bg-gray-100 !text-gray-800' : ''}"
|
| 105 |
>
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
{#if $settings.customPrompts?.[model.id]}
|
| 109 |
-
<CarbonTextLongParagraph
|
| 110 |
-
class="size-6 rounded-md border border-gray-300 p-1 text-gray-800"
|
| 111 |
-
/>
|
| 112 |
-
{/if}
|
| 113 |
-
{#if model.id === $settings.activeModel}
|
| 114 |
-
<div
|
| 115 |
-
class="rounded-lg bg-black px-2 py-1.5 text-xs font-semibold leading-none text-white"
|
| 116 |
-
>
|
| 117 |
-
Active
|
| 118 |
-
</div>
|
| 119 |
-
{/if}
|
| 120 |
-
</a>
|
| 121 |
-
{/each}
|
| 122 |
-
<!-- if its huggingchat, the number of assistants owned by the user must be non-zero to show the UI -->
|
| 123 |
-
{#if data.enableAssistants}
|
| 124 |
-
<h3 bind:this={assistantsSection} class="pl-3 pt-5 text-[.8rem] text-gray-800 sm:pl-1">
|
| 125 |
-
Assistants
|
| 126 |
</h3>
|
| 127 |
-
<!-- My Assistants -->
|
| 128 |
-
<h4 class="py-2 pl-5 text-[.7rem] text-gray-600 sm:pl-1">My Assistants</h4>
|
| 129 |
|
| 130 |
-
{#each data.
|
| 131 |
<a
|
| 132 |
-
href="{base}/settings/
|
| 133 |
-
class="group flex h-10 flex-none items-center gap-2
|
| 134 |
-
{
|
| 135 |
>
|
| 136 |
-
{
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
class="
|
| 141 |
/>
|
| 142 |
-
{:else}
|
| 143 |
-
<div
|
| 144 |
-
class="flex size-6 items-center justify-center rounded-full bg-gray-300 font-bold uppercase text-gray-500"
|
| 145 |
-
>
|
| 146 |
-
{assistant.name[0]}
|
| 147 |
-
</div>
|
| 148 |
{/if}
|
| 149 |
-
|
| 150 |
-
{#if assistant._id.toString() === $settings.activeModel}
|
| 151 |
<div
|
| 152 |
-
class="
|
| 153 |
>
|
| 154 |
Active
|
| 155 |
</div>
|
| 156 |
{/if}
|
| 157 |
</a>
|
| 158 |
{/each}
|
| 159 |
-
{#if
|
| 160 |
-
<
|
| 161 |
-
|
| 162 |
-
class="
|
| 163 |
-
{page.url.pathname === `${base}/settings/assistants/new` ? '!bg-gray-100 !text-gray-800' : ''}"
|
| 164 |
>
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 169 |
|
| 170 |
-
|
| 171 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 172 |
|
| 173 |
-
|
| 174 |
-
<
|
| 175 |
-
|
| 176 |
-
class="group flex h-10 flex-none items-center gap-2 pl-2 pr-2 text-sm text-gray-500 hover:bg-gray-100 md:rounded-xl
|
| 177 |
-
{assistant._id.toString() === page.params.assistantId ? '!bg-gray-100 !text-gray-800' : ''}"
|
| 178 |
>
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 218 |
} else {
|
| 219 |
-
|
|
|
|
| 220 |
}
|
| 221 |
-
}
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 230 |
</a>
|
| 231 |
-
{/
|
| 232 |
-
<a
|
| 233 |
-
href="{base}/assistants"
|
| 234 |
-
class="group flex h-10 flex-none items-center gap-2 pl-3 pr-2 text-sm text-gray-500 hover:bg-gray-100 md:rounded-xl"
|
| 235 |
-
><CarbonArrowUpRight class="mr-1.5 shrink-0 text-xs " />
|
| 236 |
-
<div class="truncate">Browse Assistants</div>
|
| 237 |
-
</a>
|
| 238 |
-
{/if}
|
| 239 |
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
{page.url.pathname === `${base}/settings/application` ? '!bg-gray-100 !text-gray-800' : ''}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 245 |
>
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
</div>
|
| 250 |
-
<div
|
| 251 |
-
class="col-span-1 w-full overflow-y-auto overflow-x-clip px-1 md:col-span-2 md:row-span-2"
|
| 252 |
-
class:max-md:hidden={!showContent && browser}
|
| 253 |
-
>
|
| 254 |
-
{@render children?.()}
|
| 255 |
-
</div>
|
| 256 |
</div>
|
|
|
|
| 17 |
import { isDesktop } from "$lib/utils/isDesktop";
|
| 18 |
import { debounce } from "$lib/utils/debounce";
|
| 19 |
|
| 20 |
+
import { fly } from "svelte/transition";
|
| 21 |
+
|
| 22 |
interface Props {
|
| 23 |
data: LayoutData;
|
| 24 |
children?: import("svelte").Snippet;
|
|
|
|
| 67 |
</script>
|
| 68 |
|
| 69 |
<div
|
| 70 |
+
class="mx-auto grid h-full w-full max-w-[1400px] grid-cols-1 grid-rows-[auto,1fr] content-start gap-x-6 overflow-hidden p-4 md:grid-cols-3 md:grid-rows-[auto,1fr] md:p-4"
|
| 71 |
>
|
| 72 |
+
<div class="col-span-1 mb-3 flex items-center justify-between md:col-span-3 md:mb-4">
|
| 73 |
{#if showContent && browser}
|
| 74 |
<button
|
| 75 |
class="btn rounded-lg md:hidden"
|
|
|
|
| 82 |
<CarbonChevronLeft class="text-xl text-gray-900 hover:text-black" />
|
| 83 |
</button>
|
| 84 |
{/if}
|
| 85 |
+
<h2 class="absolute left-0 right-0 mx-auto w-fit text-center text-xl font-bold md:hidden">
|
| 86 |
+
Settings
|
| 87 |
+
</h2>
|
| 88 |
<button
|
| 89 |
class="btn rounded-lg"
|
| 90 |
aria-label="Close settings"
|
|
|
|
| 95 |
<CarbonClose class="text-xl text-gray-900 hover:text-black" />
|
| 96 |
</button>
|
| 97 |
</div>
|
| 98 |
+
{#if !(showContent && browser && !isDesktop(window))}
|
| 99 |
+
<div
|
| 100 |
+
class="col-span-1 flex flex-col overflow-y-auto whitespace-nowrap max-md:-mx-4 max-md:h-full md:pr-6"
|
| 101 |
+
class:max-md:hidden={showContent && browser}
|
| 102 |
+
in:fly={{ x: -100, duration: 200 }}
|
| 103 |
+
out:fly={{ x: -100, duration: 200 }}
|
| 104 |
+
>
|
| 105 |
+
<!-- Section Headers -->
|
| 106 |
+
<h3
|
| 107 |
+
class="px-4 pb-2 pt-3 text-center text-[.8rem] font-medium text-gray-800 md:px-3 md:text-left"
|
|
|
|
| 108 |
>
|
| 109 |
+
Models
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
</h3>
|
|
|
|
|
|
|
| 111 |
|
| 112 |
+
{#each data.models.filter((el) => !el.unlisted) as model}
|
| 113 |
<a
|
| 114 |
+
href="{base}/settings/{model.id}"
|
| 115 |
+
class="group flex h-10 flex-none items-center gap-2 px-4 text-sm text-gray-500 hover:bg-gray-100 md:rounded-xl md:px-3
|
| 116 |
+
{model.id === page.params.model ? '!bg-gray-100 !text-gray-800' : ''}"
|
| 117 |
>
|
| 118 |
+
<div class="mr-auto truncate">{model.displayName}</div>
|
| 119 |
+
|
| 120 |
+
{#if $settings.customPrompts?.[model.id]}
|
| 121 |
+
<CarbonTextLongParagraph
|
| 122 |
+
class="size-6 rounded-md border border-gray-300 p-1 text-gray-800"
|
| 123 |
/>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
{/if}
|
| 125 |
+
{#if model.id === $settings.activeModel}
|
|
|
|
| 126 |
<div
|
| 127 |
+
class="rounded-lg bg-black px-2 py-1.5 text-xs font-semibold leading-none text-white"
|
| 128 |
>
|
| 129 |
Active
|
| 130 |
</div>
|
| 131 |
{/if}
|
| 132 |
</a>
|
| 133 |
{/each}
|
| 134 |
+
{#if data.enableAssistants}
|
| 135 |
+
<h3
|
| 136 |
+
bind:this={assistantsSection}
|
| 137 |
+
class="mt-6 px-4 pb-2 text-center text-[.8rem] font-medium text-gray-800 md:px-3 md:text-left"
|
|
|
|
| 138 |
>
|
| 139 |
+
Assistants
|
| 140 |
+
</h3>
|
| 141 |
+
<!-- My Assistants -->
|
| 142 |
+
<h4
|
| 143 |
+
class="px-4 pb-1 pt-2 text-center text-[.7rem] font-medium text-gray-600 md:px-3 md:text-left"
|
| 144 |
+
>
|
| 145 |
+
My Assistants
|
| 146 |
+
</h4>
|
| 147 |
|
| 148 |
+
{#each data.assistants.filter((assistant) => assistant.createdByMe) as assistant}
|
| 149 |
+
<a
|
| 150 |
+
href="{base}/settings/assistants/{assistant._id.toString()}"
|
| 151 |
+
class="group flex h-10 flex-none items-center gap-2 px-4 text-sm text-gray-500 hover:bg-gray-100 md:rounded-xl md:px-3
|
| 152 |
+
{assistant._id.toString() === page.params.assistantId ? '!bg-gray-100 !text-gray-800' : ''}"
|
| 153 |
+
>
|
| 154 |
+
{#if assistant.avatar}
|
| 155 |
+
<img
|
| 156 |
+
src="{base}/settings/assistants/{assistant._id.toString()}/avatar.jpg?hash={assistant.avatar}"
|
| 157 |
+
alt="Avatar"
|
| 158 |
+
class="h-6 w-6 rounded-full"
|
| 159 |
+
/>
|
| 160 |
+
{:else}
|
| 161 |
+
<div
|
| 162 |
+
class="flex size-6 items-center justify-center rounded-full bg-gray-300 font-bold uppercase text-gray-500"
|
| 163 |
+
>
|
| 164 |
+
{assistant.name[0]}
|
| 165 |
+
</div>
|
| 166 |
+
{/if}
|
| 167 |
+
<div class="truncate text-gray-900">{assistant.name}</div>
|
| 168 |
+
{#if assistant._id.toString() === $settings.activeModel}
|
| 169 |
+
<div
|
| 170 |
+
class="ml-auto rounded-lg bg-black px-2 py-1.5 text-xs font-semibold leading-none text-white"
|
| 171 |
+
>
|
| 172 |
+
Active
|
| 173 |
+
</div>
|
| 174 |
+
{/if}
|
| 175 |
+
</a>
|
| 176 |
+
{/each}
|
| 177 |
+
{#if !data.loginEnabled || (data.loginEnabled && !!data.user)}
|
| 178 |
+
<a
|
| 179 |
+
href="{base}/settings/assistants/new"
|
| 180 |
+
class="group flex h-10 flex-none items-center gap-2 px-4 text-sm text-gray-500 hover:bg-gray-100 md:rounded-xl md:px-3
|
| 181 |
+
{page.url.pathname === `${base}/settings/assistants/new` ? '!bg-gray-100 !text-gray-800' : ''}"
|
| 182 |
+
>
|
| 183 |
+
<CarbonAdd />
|
| 184 |
+
<div class="truncate">Create new assistant</div>
|
| 185 |
+
</a>
|
| 186 |
+
{/if}
|
| 187 |
|
| 188 |
+
<!-- Other Assistants -->
|
| 189 |
+
<h4
|
| 190 |
+
class="mt-4 px-4 pb-1 pt-2 text-center text-[.7rem] font-medium text-gray-600 md:px-3 md:text-left"
|
|
|
|
|
|
|
| 191 |
>
|
| 192 |
+
Other Assistants
|
| 193 |
+
</h4>
|
| 194 |
+
|
| 195 |
+
{#each data.assistants.filter((assistant) => !assistant.createdByMe) as assistant}
|
| 196 |
+
<a
|
| 197 |
+
href="{base}/settings/assistants/{assistant._id.toString()}"
|
| 198 |
+
class="group flex h-10 flex-none items-center gap-2 px-4 text-sm text-gray-500 hover:bg-gray-100 md:rounded-xl md:px-3
|
| 199 |
+
{assistant._id.toString() === page.params.assistantId ? '!bg-gray-100 !text-gray-800' : ''}"
|
| 200 |
+
>
|
| 201 |
+
{#if assistant.avatar}
|
| 202 |
+
<img
|
| 203 |
+
src="{base}/settings/assistants/{assistant._id.toString()}/avatar.jpg?hash={assistant.avatar}"
|
| 204 |
+
alt="Avatar"
|
| 205 |
+
class="h-6 w-6 rounded-full"
|
| 206 |
+
/>
|
| 207 |
+
{:else}
|
| 208 |
+
<div
|
| 209 |
+
class="flex size-6 items-center justify-center rounded-full bg-gray-300 font-bold uppercase text-gray-500"
|
| 210 |
+
>
|
| 211 |
+
{assistant.name[0]}
|
| 212 |
+
</div>
|
| 213 |
+
{/if}
|
| 214 |
+
<div class="truncate">{assistant.name}</div>
|
| 215 |
+
{#if assistant._id.toString() === $settings.activeModel}
|
| 216 |
+
<div
|
| 217 |
+
class="ml-auto rounded-lg bg-black px-2 py-1.5 text-xs font-semibold leading-none text-white"
|
| 218 |
+
>
|
| 219 |
+
Active
|
| 220 |
+
</div>
|
| 221 |
+
{/if}
|
| 222 |
+
<button
|
| 223 |
+
type="submit"
|
| 224 |
+
aria-label="Remove assistant from your list"
|
| 225 |
+
class={[
|
| 226 |
+
"rounded-full p-1 text-xs hover:bg-gray-500 hover:bg-opacity-20",
|
| 227 |
+
assistant._id.toString() === page.params.assistantId
|
| 228 |
+
? "block"
|
| 229 |
+
: "hidden group-hover:block",
|
| 230 |
+
assistant._id.toString() !== $settings.activeModel && "ml-auto",
|
| 231 |
+
]}
|
| 232 |
+
onclick={(event) => {
|
| 233 |
+
event.stopPropagation();
|
| 234 |
+
fetch(`${base}/api/assistant/${assistant._id}/subscribe`, {
|
| 235 |
+
method: "DELETE",
|
| 236 |
+
}).then((r) => {
|
| 237 |
+
if (r.ok) {
|
| 238 |
+
if (assistant._id.toString() === page.params.assistantId) {
|
| 239 |
+
goto(`${base}/settings`, { invalidateAll: true });
|
| 240 |
+
} else {
|
| 241 |
+
invalidateAll();
|
| 242 |
+
}
|
| 243 |
} else {
|
| 244 |
+
console.error(r);
|
| 245 |
+
$error = r.statusText;
|
| 246 |
}
|
| 247 |
+
});
|
| 248 |
+
}}
|
| 249 |
+
>
|
| 250 |
+
<CarbonClose class="size-4 text-gray-500" />
|
| 251 |
+
</button>
|
| 252 |
+
</a>
|
| 253 |
+
{/each}
|
| 254 |
+
<a
|
| 255 |
+
href="{base}/assistants"
|
| 256 |
+
class="group flex h-10 flex-none items-center gap-2 px-4 text-sm text-gray-500 hover:bg-gray-100 md:rounded-xl md:px-3"
|
| 257 |
+
>
|
| 258 |
+
<CarbonArrowUpRight class="mr-1.5 shrink-0 text-xs" />
|
| 259 |
+
<div class="truncate">Browse Assistants</div>
|
| 260 |
</a>
|
| 261 |
+
{/if}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 262 |
|
| 263 |
+
<div class="my-2 mt-auto w-full border-b border-gray-200"></div>
|
| 264 |
+
<a
|
| 265 |
+
href="{base}/settings/application"
|
| 266 |
+
class="group flex h-10 flex-none items-center gap-2 px-4 text-sm text-gray-500 hover:bg-gray-100 max-md:order-first md:rounded-xl md:px-3
|
| 267 |
{page.url.pathname === `${base}/settings/application` ? '!bg-gray-100 !text-gray-800' : ''}"
|
| 268 |
+
>
|
| 269 |
+
<UserIcon class="text-sm" />
|
| 270 |
+
Application Settings
|
| 271 |
+
</a>
|
| 272 |
+
</div>
|
| 273 |
+
{/if}
|
| 274 |
+
{#if showContent}
|
| 275 |
+
<div
|
| 276 |
+
class="col-span-1 w-full overflow-y-auto overflow-x-clip px-1 md:col-span-2 md:row-span-2"
|
| 277 |
+
class:max-md:hidden={!showContent && browser}
|
| 278 |
+
in:fly={{ x: 100, duration: 200 }}
|
| 279 |
+
out:fly={{ x: 100, duration: 200 }}
|
| 280 |
>
|
| 281 |
+
{@render children?.()}
|
| 282 |
+
</div>
|
| 283 |
+
{/if}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 284 |
</div>
|
src/routes/settings/(nav)/application/+page.svelte
CHANGED
|
@@ -13,9 +13,8 @@
|
|
| 13 |
</script>
|
| 14 |
|
| 15 |
<div class="flex w-full flex-col gap-5">
|
| 16 |
-
|
| 17 |
-
<
|
| 18 |
-
{#if !!envPublic.PUBLIC_COMMIT_SHA}
|
| 19 |
<a
|
| 20 |
href={`https://github.com/huggingface/chat-ui/commit/${envPublic.PUBLIC_COMMIT_SHA}`}
|
| 21 |
target="_blank"
|
|
@@ -26,8 +25,8 @@
|
|
| 26 |
>{envPublic.PUBLIC_COMMIT_SHA.slice(0, 7)}</span
|
| 27 |
>
|
| 28 |
</a>
|
| 29 |
-
|
| 30 |
-
|
| 31 |
<div class="flex h-full max-w-2xl flex-col gap-2 max-sm:pt-0">
|
| 32 |
{#if envPublic.PUBLIC_APP_DATA_SHARING === "1"}
|
| 33 |
<label class="flex items-center">
|
|
|
|
| 13 |
</script>
|
| 14 |
|
| 15 |
<div class="flex w-full flex-col gap-5">
|
| 16 |
+
{#if !!envPublic.PUBLIC_COMMIT_SHA}
|
| 17 |
+
<div class="flex flex-col items-start justify-between text-xl font-semibold text-gray-800">
|
|
|
|
| 18 |
<a
|
| 19 |
href={`https://github.com/huggingface/chat-ui/commit/${envPublic.PUBLIC_COMMIT_SHA}`}
|
| 20 |
target="_blank"
|
|
|
|
| 25 |
>{envPublic.PUBLIC_COMMIT_SHA.slice(0, 7)}</span
|
| 26 |
>
|
| 27 |
</a>
|
| 28 |
+
</div>
|
| 29 |
+
{/if}
|
| 30 |
<div class="flex h-full max-w-2xl flex-col gap-2 max-sm:pt-0">
|
| 31 |
{#if envPublic.PUBLIC_APP_DATA_SHARING === "1"}
|
| 32 |
<label class="flex items-center">
|
src/routes/settings/(nav)/assistants/[assistantId]/edit/{[email protected] → +page.svelte}
RENAMED
|
File without changes
|
src/routes/settings/(nav)/assistants/new/{[email protected] → +page.svelte}
RENAMED
|
File without changes
|
src/routes/settings/+layout.svelte
CHANGED
|
@@ -5,6 +5,7 @@
|
|
| 5 |
import CarbonCheckmark from "~icons/carbon/checkmark";
|
| 6 |
|
| 7 |
import Modal from "$lib/components/Modal.svelte";
|
|
|
|
| 8 |
interface Props {
|
| 9 |
children?: import("svelte").Snippet;
|
| 10 |
}
|
|
@@ -24,7 +25,7 @@
|
|
| 24 |
|
| 25 |
<Modal
|
| 26 |
on:close={() => goto(previousPage)}
|
| 27 |
-
width="
|
| 28 |
>
|
| 29 |
{@render children?.()}
|
| 30 |
{#if $settings.recentlySaved}
|
|
|
|
| 5 |
import CarbonCheckmark from "~icons/carbon/checkmark";
|
| 6 |
|
| 7 |
import Modal from "$lib/components/Modal.svelte";
|
| 8 |
+
|
| 9 |
interface Props {
|
| 10 |
children?: import("svelte").Snippet;
|
| 11 |
}
|
|
|
|
| 25 |
|
| 26 |
<Modal
|
| 27 |
on:close={() => goto(previousPage)}
|
| 28 |
+
width="h-[95dvh] w-[90dvw] pb-0 overflow-hidden rounded-2xl bg-white shadow-2xl outline-none sm:h-[95dvh] xl:w-[1200px] 2xl:h-[75dvh]"
|
| 29 |
>
|
| 30 |
{@render children?.()}
|
| 31 |
{#if $settings.recentlySaved}
|
src/routes/tools/[toolId]/+page.svelte
CHANGED
|
@@ -67,7 +67,7 @@
|
|
| 67 |
/>
|
| 68 |
{/if}
|
| 69 |
|
| 70 |
-
<Modal on:close={() => goto(previousPage)} width="min-w-xl">
|
| 71 |
<div class="w-full min-w-64 p-8">
|
| 72 |
<div class="flex h-full flex-col gap-2">
|
| 73 |
<div class="flex flex-col sm:flex-row sm:gap-6">
|
|
|
|
| 67 |
/>
|
| 68 |
{/if}
|
| 69 |
|
| 70 |
+
<Modal on:close={() => goto(previousPage)} width="min-w-xl" closeButton>
|
| 71 |
<div class="w-full min-w-64 p-8">
|
| 72 |
<div class="flex h-full flex-col gap-2">
|
| 73 |
<div class="flex flex-col sm:flex-row sm:gap-6">
|
src/routes/tools/[toolId]/edit/+page.svelte
CHANGED
|
@@ -8,6 +8,7 @@
|
|
| 8 |
<Modal
|
| 9 |
on:close={() => window.history.back()}
|
| 10 |
width="h-[95dvh] w-[90dvw] overflow-hidden rounded-2xl bg-white shadow-2xl outline-none sm:h-[85dvh] xl:w-[1200px] 2xl:h-[75dvh]"
|
|
|
|
| 11 |
>
|
| 12 |
<ToolEdit
|
| 13 |
tool={data.tool}
|
|
|
|
| 8 |
<Modal
|
| 9 |
on:close={() => window.history.back()}
|
| 10 |
width="h-[95dvh] w-[90dvw] overflow-hidden rounded-2xl bg-white shadow-2xl outline-none sm:h-[85dvh] xl:w-[1200px] 2xl:h-[75dvh]"
|
| 11 |
+
closeButton
|
| 12 |
>
|
| 13 |
<ToolEdit
|
| 14 |
tool={data.tool}
|