123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <script lang="ts">
- import { getBackendConfig } from '$lib/apis';
- import { setDefaultPromptSuggestions } from '$lib/apis/configs';
- import Switch from '$lib/components/common/Switch.svelte';
- import { config, models, settings, user } from '$lib/stores';
- import { createEventDispatcher, onMount, getContext, tick } from 'svelte';
- import { toast } from 'svelte-sonner';
- import ManageModal from './Personalization/ManageModal.svelte';
- import Tooltip from '$lib/components/common/Tooltip.svelte';
- const dispatch = createEventDispatcher();
- const i18n = getContext('i18n');
- export let saveSettings: Function;
- let showManageModal = false;
- // Addons
- let enableMemory = true;
- onMount(async () => {
- let settings = JSON.parse(localStorage.getItem('settings') ?? '{}');
- enableMemory = settings?.memory ?? true;
- });
- </script>
- <ManageModal bind:show={showManageModal} />
- <form
- class="flex flex-col h-full justify-between space-y-3 text-sm"
- on:submit|preventDefault={() => {
- dispatch('save');
- }}
- >
- <div class=" pr-1.5 overflow-y-scroll max-h-[25rem]">
- <div>
- <div class="flex items-center justify-between mb-1">
- <Tooltip
- content="This is an experimental feature, it may not function as expected and is subject to change at any time."
- >
- <div class="text-sm font-medium">
- {$i18n.t('Memory')}
- <span class=" text-xs text-gray-500">({$i18n.t('Experimental')})</span>
- </div>
- </Tooltip>
- <div class="mt-1">
- <Switch
- bind:state={enableMemory}
- on:change={async () => {
- saveSettings({ memory: enableMemory });
- }}
- />
- </div>
- </div>
- </div>
- <div class="text-xs text-gray-600 dark:text-gray-400">
- <div>
- LLMs will become more helpful as you chat, picking up on details and preferences to tailor
- its responses to you.
- </div>
- <!-- <div class="mt-3">
- To understand what LLM remembers or teach it something new, just chat with it:
- <div>- “Remember that I like concise responses.”</div>
- <div>- “I just got a puppy!”</div>
- <div>- “What do you remember about me?”</div>
- <div>- “Where did we leave off on my last project?”</div>
- </div> -->
- </div>
- <div class="mt-3 mb-1 ml-1">
- <button
- type="button"
- class=" px-3.5 py-1.5 font-medium hover:bg-black/5 dark:hover:bg-white/5 outline outline-1 outline-gray-300 dark:outline-gray-800 rounded-3xl"
- on:click={() => {
- showManageModal = true;
- }}
- >
- Manage
- </button>
- </div>
- </div>
- <div class="flex justify-end text-sm font-medium">
- <button
- class=" px-4 py-2 bg-emerald-700 hover:bg-emerald-800 text-gray-100 transition rounded-lg"
- type="submit"
- >
- {$i18n.t('Save')}
- </button>
- </div>
- </form>
|