From abbfd1dc58bf532a8301c7c0d25caec0e8e82189 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Sat, 2 Dec 2023 00:58:43 -0800 Subject: [PATCH 01/20] fix: copy code button issue --- src/lib/components/chat/Messages.svelte | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/components/chat/Messages.svelte b/src/lib/components/chat/Messages.svelte index caefcdce..cc27bdee 100644 --- a/src/lib/components/chat/Messages.svelte +++ b/src/lib/components/chat/Messages.svelte @@ -40,7 +40,7 @@ blocks.forEach((block) => { // only add button if browser supports Clipboard API - if (navigator.clipboard && block.childNodes.length < 2) { + if (navigator.clipboard && block.childNodes.length < 2 && block.id !== 'user-message') { let code = block.querySelector('code'); code.style.borderTopRightRadius = 0; code.style.borderTopLeftRadius = 0; @@ -425,7 +425,7 @@ {/each} {/if} -
{message.content}
+
{message.content}
{#if message.parentId !== null && message.parentId in history.messages && (history.messages[message.parentId]?.childrenIds.length ?? 0) > 1} From d73c9cc7dc4519cf6be3d252eaf6006d683f9b8d Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Sat, 2 Dec 2023 14:25:49 -0500 Subject: [PATCH 02/20] doc: roadmap updated --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 02498a3d..ca9b9c1e 100644 --- a/README.md +++ b/README.md @@ -205,10 +205,14 @@ See [TROUBLESHOOTING.md](/TROUBLESHOOTING.md) for information on how to troubles ## What's Next? ๐Ÿš€ -### To-Do List ๐Ÿ“ +### Roadmap ๐Ÿ“ -Here are some exciting tasks on our to-do list: +Here are some exciting tasks on our roadmap: + +- ๐Ÿ—ƒ๏ธ **Modelfile Builder**: Easily create Ollama modelfiles via the web UI. Create and add your own character to Ollama by customizing system prompts, conversation starters, and more. +- ๐Ÿ”„ **Multi-Modal Support**: Seamlessly engage with models that support multimodal interactions, including images (e.g., LLava). +- ๐Ÿ“š **RAG Integration**: Experience first-class retrieval augmented generation support, enabling chat with your documents. - ๐Ÿ” **Access Control**: Securely manage requests to Ollama by utilizing the backend as a reverse proxy gateway, ensuring only authenticated users can send specific requests. - ๐Ÿงช **Research-Centric Features**: Empower researchers in the fields of LLM and HCI with a comprehensive web UI for conducting user studies. Stay tuned for ongoing feature enhancements (e.g., surveys, analytics, and participant tracking) to facilitate their research. - ๐Ÿ“ˆ **User Study Tools**: Providing specialized tools, like heat maps and behavior tracking modules, to empower researchers in capturing and analyzing user behavior patterns with precision and accuracy. From 1c0cc16f8c5198ada5d09d52edf9a8ddf1c52605 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Sat, 2 Dec 2023 14:47:23 -0800 Subject: [PATCH 03/20] feat: more advanced params added --- .../components/chat/Settings/Advanced.svelte | 480 ++++++++++++++++++ src/lib/components/chat/SettingsModal.svelte | 320 +++--------- src/routes/(app)/+page.svelte | 14 +- src/routes/(app)/c/[id]/+page.svelte | 14 +- 4 files changed, 556 insertions(+), 272 deletions(-) create mode 100644 src/lib/components/chat/Settings/Advanced.svelte diff --git a/src/lib/components/chat/Settings/Advanced.svelte b/src/lib/components/chat/Settings/Advanced.svelte new file mode 100644 index 00000000..b65ab3be --- /dev/null +++ b/src/lib/components/chat/Settings/Advanced.svelte @@ -0,0 +1,480 @@ + + +
+
+
+
Seed
+
+ +
+
+
+ +
+
+
Stop Sequence
+
+ +
+
+
+ +
+
+
Temperature
+ + +
+ + {#if options.temperature !== ''} +
+
+ +
+
+ +
+
+ {/if} +
+ +
+
+
Mirostat
+ + +
+ + {#if options.mirostat !== ''} +
+
+ +
+
+ +
+
+ {/if} +
+ +
+
+
Mirostat Eta
+ + +
+ + {#if options.mirostat_eta !== ''} +
+
+ +
+
+ +
+
+ {/if} +
+ +
+
+
Mirostat Tau
+ + +
+ + {#if options.mirostat_tau !== ''} +
+
+ +
+
+ +
+
+ {/if} +
+ +
+
+
Top K
+ + +
+ + {#if options.top_k !== ''} +
+
+ +
+
+ +
+
+ {/if} +
+ +
+
+
Top P
+ + +
+ + {#if options.top_p !== ''} +
+
+ +
+
+ +
+
+ {/if} +
+ +
+
+
Repeat Penalty
+ + +
+ + {#if options.repeat_penalty !== ''} +
+
+ +
+
+ +
+
+ {/if} +
+ +
+
+
Repeat Last N
+ + +
+ + {#if options.repeat_last_n !== ''} +
+
+ +
+
+ +
+
+ {/if} +
+ +
+
+
Tfs Z
+ + +
+ + {#if options.tfs_z !== ''} +
+
+ +
+
+ +
+
+ {/if} +
+ +
+
+
Context Length
+ + +
+ + {#if options.num_ctx !== ''} +
+
+ +
+
+ +
+
+ {/if} +
+
diff --git a/src/lib/components/chat/SettingsModal.svelte b/src/lib/components/chat/SettingsModal.svelte index 31da70fe..844a3153 100644 --- a/src/lib/components/chat/SettingsModal.svelte +++ b/src/lib/components/chat/SettingsModal.svelte @@ -6,6 +6,7 @@ import { onMount } from 'svelte'; import { config, models, settings, user } from '$lib/stores'; import { splitStream, getGravatarURL } from '$lib/utils'; + import Advanced from './Settings/Advanced.svelte'; export let show = false; @@ -25,12 +26,21 @@ // Advanced let requestFormat = ''; - let seed = 0; - let temperature = ''; - let repeat_penalty = ''; - let top_k = ''; - let top_p = ''; - let num_ctx = ''; + let options = { + // Advanced + seed: 0, + temperature: '', + repeat_penalty: '', + repeat_last_n: '', + mirostat: '', + mirostat_eta: '', + mirostat_tau: '', + top_k: '', + top_p: '', + stop: '', + tfs_z: '', + num_ctx: '' + }; // Models let modelTag = ''; @@ -218,28 +228,6 @@ models.set(await getModels()); }; - $: if (show) { - let settings = JSON.parse(localStorage.getItem('settings') ?? '{}'); - console.log(settings); - - theme = localStorage.theme ?? 'dark'; - API_BASE_URL = settings.API_BASE_URL ?? OLLAMA_API_BASE_URL; - system = settings.system ?? ''; - - requestFormat = settings.requestFormat ?? ''; - seed = settings.seed ?? 0; - temperature = settings.temperature ?? ''; - repeat_penalty = settings.repeat_penalty ?? ''; - top_k = settings.top_k ?? ''; - top_p = settings.top_p ?? ''; - num_ctx = settings.num_ctx ?? ''; - - titleAutoGenerate = settings.titleAutoGenerate ?? true; - speechAutoSend = settings.speechAutoSend ?? false; - gravatarEmail = settings.gravatarEmail ?? ''; - OPENAI_API_KEY = settings.OPENAI_API_KEY ?? ''; - } - const getModels = async (url = '', type = 'all') => { let models = []; const res = await fetch(`${url ? url : $settings?.API_BASE_URL ?? OLLAMA_API_BASE_URL}/tags`, { @@ -306,6 +294,26 @@ onMount(() => { let settings = JSON.parse(localStorage.getItem('settings') ?? '{}'); + console.log(settings); + + theme = localStorage.theme ?? 'dark'; + API_BASE_URL = settings.API_BASE_URL ?? OLLAMA_API_BASE_URL; + system = settings.system ?? ''; + + requestFormat = settings.requestFormat ?? ''; + + options.seed = settings.seed ?? 0; + options.temperature = settings.temperature ?? ''; + options.repeat_penalty = settings.repeat_penalty ?? ''; + options.top_k = settings.top_k ?? ''; + options.top_p = settings.top_p ?? ''; + options.num_ctx = settings.num_ctx ?? ''; + options = { ...options, ...settings.options }; + + titleAutoGenerate = settings.titleAutoGenerate ?? true; + speechAutoSend = settings.speechAutoSend ?? false; + gravatarEmail = settings.gravatarEmail ?? ''; + OPENAI_API_KEY = settings.OPENAI_API_KEY ?? ''; authEnabled = settings.authHeader !== undefined ? true : false; if (authEnabled) { @@ -497,7 +505,7 @@
About
-
+
{#if selectedTab === 'general'}
@@ -612,234 +620,11 @@
{:else if selectedTab === 'advanced'} -
-
-
-
-
Seed
-
- -
-
-
- -
-
-
Temperature
- - -
- - {#if temperature !== ''} -
-
- -
-
- -
-
- {/if} -
- -
-
-
Repeat Penalty
- - -
- - {#if repeat_penalty !== ''} -
-
- -
-
- -
-
- {/if} -
- -
-
-
Top K
- - -
- - {#if top_k !== ''} -
-
- -
-
- -
-
- {/if} -
- -
-
-
Top P
- - -
- - {#if top_p !== ''} -
-
- -
-
- -
-
- {/if} -
- -
-
-
Context Length
- - -
- - {#if num_ctx !== ''} -
-
- -
-
- -
-
- {/if} -
+
+
+
Parameters
+
@@ -871,17 +656,28 @@
+
@@ -127,7 +127,7 @@
@@ -170,7 +170,7 @@
@@ -213,7 +213,7 @@ @@ -256,7 +256,7 @@ @@ -299,7 +299,7 @@ @@ -342,7 +342,7 @@ @@ -385,7 +385,7 @@ @@ -428,7 +428,7 @@ @@ -471,7 +471,7 @@ diff --git a/src/lib/components/layout/Sidebar.svelte b/src/lib/components/layout/Sidebar.svelte index 656d3f45..bb54dbc1 100644 --- a/src/lib/components/layout/Sidebar.svelte +++ b/src/lib/components/layout/Sidebar.svelte @@ -24,7 +24,7 @@ let showDropdown = false; - let showDeleteHistoryConfirm = false; + let showDeleteHistoryConfirm = false; onMount(async () => { if (window.innerWidth > 1280) { @@ -121,11 +121,11 @@ - +
@@ -449,91 +449,92 @@
Export
- {#if showDeleteHistoryConfirm} -
-
- - - - Are you sure? -
- -
- - -
-
- {:else} - - {/if} + {#if showDeleteHistoryConfirm} +
+
+ + + + Are you sure? +
+ +
+ + +
+
+ {:else} + + {/if} {#if $user !== undefined}
diff --git a/src/routes/(app)/modelfiles/create/+page.svelte b/src/routes/(app)/modelfiles/create/+page.svelte new file mode 100644 index 00000000..3a2e60fc --- /dev/null +++ b/src/routes/(app)/modelfiles/create/+page.svelte @@ -0,0 +1,475 @@ + + +
+
+
+ { + let reader = new FileReader(); + reader.onload = (event) => { + let originalImageUrl = `${event.target.result}`; + + const img = new Image(); + img.src = originalImageUrl; + + img.onload = function () { + const canvas = document.createElement('canvas'); + const ctx = canvas.getContext('2d'); + + // Set canvas dimensions to the original image dimensions + canvas.width = img.width; + canvas.height = img.height; + + // Draw the original image on the canvas + ctx.drawImage(img, 0, 0); + + // Get the base64 representation of the compressed image + const compressedSrc = canvas.toDataURL('image/jpeg', 0.1); + + // Display the compressed image + imageUrl = compressedSrc; + + inputFiles = null; + }; + }; + + if ( + inputFiles && + inputFiles.length > 0 && + ['image/gif', 'image/jpeg', 'image/png'].includes(inputFiles[0]['type']) + ) { + reader.readAsDataURL(inputFiles[0]); + } else { + console.log(`Unsupported File Type '${inputFiles[0]['type']}'.`); + inputFiles = null; + } + }} + /> + +
My Modelfiles
+ + +
+ +
{ + submitHandler(); + }} + > +
+
+ +
+
+ +
+
Name*
+ +
+ +
+
+ +
+
Description*
+ +
+ +
+
+ +
+
+
Modelfile
+ + +
+ + + + {#if raw} +
+
Content*
+ +
+