diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 033b43888..c90742d9a 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -6,16 +6,30 @@ import type { PageData } from './$types'; import { ENDPOINT } from '$lib/contants'; - import { tick } from 'svelte'; + import { onMount, tick } from 'svelte'; export let data: PageData; $: ({ models } = data); let textareaElement; let selectedModel = ''; + let systemPrompt = ''; + let temperature = ''; let prompt = ''; let messages = []; + onMount(() => { + let settings = localStorage.getItem('settings'); + if (settings) { + settings = JSON.parse(settings); + console.log(settings); + + selectedModel = settings.model ?? ''; + systemPrompt = settings.systemPrompt ?? ''; + temperature = settings.temperature ?? ''; + } + }); + ////////////////////////// // Helper functions ////////////////////////// @@ -71,6 +85,22 @@ ); }; + ////////////////////////// + // Web functions + ////////////////////////// + + const saveDefaultModel = () => { + let settings = localStorage.getItem('settings') ?? '{}'; + if (settings) { + settings = JSON.parse(settings); + settings.model = selectedModel; + localStorage.setItem('settings', JSON.stringify(settings)); + } + + console.log('saved'); + toast.success('Default model updated'); + }; + ////////////////////////// // Ollama functions ////////////////////////// @@ -248,18 +278,24 @@
- +
+ +
+ +
+
@@ -358,7 +394,7 @@ {#if messages.length != 0 && messages.at(-1).role == 'assistant' && messages.at(-1).done == true}