Spaces:
Running
Running
<script lang="ts"> | |
import CarbonTrashCan from "~icons/carbon/trash-can"; | |
import CarbonArrowUpRight from "~icons/carbon/arrow-up-right"; | |
import { useSettingsStore } from "$lib/stores/settings"; | |
import Switch from "$lib/components/Switch.svelte"; | |
import { env as envPublic } from "$env/dynamic/public"; | |
import { goto } from "$app/navigation"; | |
import { error } from "$lib/stores/errors"; | |
import { base } from "$app/paths"; | |
let settings = useSettingsStore(); | |
</script> | |
<div class="flex w-full flex-col gap-5"> | |
<h2 class="text-center text-xl font-semibold text-gray-800 md:text-left">Application Settings</h2> | |
{#if !!envPublic.PUBLIC_COMMIT_SHA} | |
<div class="flex flex-col items-start justify-between text-xl font-semibold text-gray-800"> | |
<a | |
href={`https://github.com/huggingface/chat-ui/commit/${envPublic.PUBLIC_COMMIT_SHA}`} | |
target="_blank" | |
rel="noreferrer" | |
class="text-sm font-light text-gray-500" | |
> | |
Latest deployment <span class="gap-2 font-mono" | |
>{envPublic.PUBLIC_COMMIT_SHA.slice(0, 7)}</span | |
> | |
</a> | |
</div> | |
{/if} | |
<div class="flex h-full max-w-2xl flex-col gap-2 max-sm:pt-0"> | |
{#if envPublic.PUBLIC_APP_DATA_SHARING === "1"} | |
<label class="flex items-center"> | |
<Switch | |
name="shareConversationsWithModelAuthors" | |
bind:checked={$settings.shareConversationsWithModelAuthors} | |
/> | |
<div class="inline cursor-pointer select-none items-center gap-2 pl-2"> | |
Share conversations with model authors | |
</div> | |
</label> | |
<p class="text-sm text-gray-500"> | |
Sharing your data will help improve the training data and make open models better over time. | |
</p> | |
{/if} | |
<label class="mt-6 flex items-center"> | |
<Switch name="hideEmojiOnSidebar" bind:checked={$settings.hideEmojiOnSidebar} /> | |
<div class="inline cursor-pointer select-none items-center gap-2 pl-2 font-semibold"> | |
Hide emoticons in conversation topics | |
<p class="text-sm font-normal text-gray-500"> | |
Emoticons are shown in the sidebar by default, enable this to hide them. | |
</p> | |
</div> | |
</label> | |
<label class="mt-6 flex items-center"> | |
<Switch name="disableStream" bind:checked={$settings.disableStream} /> | |
<div class="inline cursor-pointer select-none items-center gap-2 pl-2 font-semibold"> | |
Disable streaming tokens | |
</div> | |
</label> | |
<label class="mt-6 flex items-center"> | |
<Switch name="directPaste" bind:checked={$settings.directPaste} /> | |
<div class="inline cursor-pointer select-none items-center gap-2 pl-2 font-semibold"> | |
Paste text directly into chat | |
<p class="text-sm font-normal text-gray-500"> | |
By default, when pasting long text into the chat, we treat it as a plaintext file. Enable | |
this to paste directly into the chat instead. | |
</p> | |
</div> | |
</label> | |
<div class="mt-12 flex flex-col gap-3"> | |
<a | |
href="https://huggingface.co/spaces/huggingchat/chat-ui/discussions" | |
target="_blank" | |
rel="noreferrer" | |
class="flex items-center underline decoration-gray-300 underline-offset-2 hover:decoration-gray-700" | |
><CarbonArrowUpRight class="mr-1.5 shrink-0 text-sm " /> Share your feedback on HuggingChat</a | |
> | |
<button | |
onclick={async (e) => { | |
e.preventDefault(); | |
confirm("Are you sure you want to delete all conversations?") && | |
(await fetch(`${base}/api/conversations`, { | |
method: "DELETE", | |
}) | |
.then(async () => { | |
await goto(`${base}/`, { invalidateAll: true }); | |
}) | |
.catch((err) => { | |
console.error(err); | |
$error = err.message; | |
})); | |
}} | |
type="submit" | |
class="flex items-center underline decoration-gray-300 underline-offset-2 hover:decoration-gray-700" | |
><CarbonTrashCan class="mr-2 inline text-sm text-red-500" />Delete all conversations</button | |
> | |
</div> | |
</div> | |
</div> | |