-
-
+
+
+
Settings
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/lib/components/common/Modal.svelte b/src/lib/components/common/Modal.svelte
index 6a56dc423..597449d4a 100644
--- a/src/lib/components/common/Modal.svelte
+++ b/src/lib/components/common/Modal.svelte
@@ -28,7 +28,7 @@
}}
>
{
e.stopPropagation();
diff --git a/src/lib/components/layout/Navbar.svelte b/src/lib/components/layout/Navbar.svelte
index 43aa7d420..28503a70f 100644
--- a/src/lib/components/layout/Navbar.svelte
+++ b/src/lib/components/layout/Navbar.svelte
@@ -14,6 +14,7 @@
export let importChatHistory: Function;
export let exportChatHistory: Function;
export let deleteChatHistory: Function;
+ export let openSettings: Function;
onMount(() => {});
@@ -259,7 +260,12 @@
Clear conversations
-
+
-
-
-
-
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index ab79ac6e6..838237d5e 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -4,7 +4,10 @@
import { v4 as uuidv4 } from 'uuid';
import { marked } from 'marked';
- import { saveAs } from 'file-saver';
+
+ import fileSaver from 'file-saver';
+ const { saveAs } = fileSaver;
+
import hljs from 'highlight.js';
import 'highlight.js/styles/dark.min.css';
@@ -13,12 +16,14 @@
import { openDB, deleteDB } from 'idb';
import { ENDPOINT as SERVER_ENDPOINT } from '$lib/contants';
+ import SettingsModal from '$lib/components/chat/SettingsModal.svelte';
export let data: PageData;
$: ({ models, OLLAMA_ENDPOINT } = data);
let ENDPOINT;
let textareaElement;
+ let showSettings = false;
let db;
let selectedModel = '';
@@ -133,6 +138,23 @@
toast.success('Default model updated');
};
+ const saveSettings = (_system, _temperature) => {
+ system = _system;
+ temperature = _temperature;
+
+ let settings = localStorage.getItem('settings') ?? '{}';
+ if (settings) {
+ settings = JSON.parse(settings);
+ settings.system = system;
+ settings.temperature = temperature;
+ localStorage.setItem('settings', JSON.stringify(settings));
+ }
+
+ console.log(settings);
+
+ console.log('saved');
+ };
+
const createNewChat = () => {
if (messages.length > 0) {
chatId = uuidv4();
@@ -194,6 +216,10 @@
saveAs(blob, `chat-export-${Date.now()}.json`);
};
+ const openSettings = async () => {
+ showSettings = true;
+ };
+
//////////////////////////
// Ollama functions
//////////////////////////
@@ -455,14 +481,49 @@
{importChatHistory}
{exportChatHistory}
{deleteChatHistory}
+ {openSettings}
/>
+