From 9de56550abc28cba8ec7b254903644bd9ca76e97 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Tue, 5 Dec 2023 16:36:44 -0800 Subject: [PATCH 1/2] feat: custom model chat styling updated --- src/lib/components/chat/Messages.svelte | 12 +++++++++++- src/routes/(app)/modelfiles/+page.svelte | 2 +- src/routes/(app)/modelfiles/create/+page.svelte | 9 ++++++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/lib/components/chat/Messages.svelte b/src/lib/components/chat/Messages.svelte index 6f827fd2..b58dd592 100644 --- a/src/lib/components/chat/Messages.svelte +++ b/src/lib/components/chat/Messages.svelte @@ -317,7 +317,17 @@
{#if selectedModelfile} - {selectedModelfile.desc} + + {selectedModelfile.title} + +
+ {selectedModelfile.desc} +
+ {#if selectedModelfile.user} + + {/if} {:else} How can I help you today? {/if} diff --git a/src/routes/(app)/modelfiles/+page.svelte b/src/routes/(app)/modelfiles/+page.svelte index ca46f393..5887eabb 100644 --- a/src/routes/(app)/modelfiles/+page.svelte +++ b/src/routes/(app)/modelfiles/+page.svelte @@ -7,7 +7,7 @@ const deleteModelHandler = async (tagName) => { let success = null; - const res = await fetch(`${OLLAMA_API_BASE_URL}/delete`, { + const res = await fetch(`${$settings?.API_BASE_URL ?? OLLAMA_API_BASE_URL}/delete`, { method: 'DELETE', headers: { 'Content-Type': 'text/event-stream', diff --git a/src/routes/(app)/modelfiles/create/+page.svelte b/src/routes/(app)/modelfiles/create/+page.svelte index a49d0fd1..6e4e3f7d 100644 --- a/src/routes/(app)/modelfiles/create/+page.svelte +++ b/src/routes/(app)/modelfiles/create/+page.svelte @@ -52,6 +52,8 @@ num_ctx: '' }; + let modelfileCreator = null; + $: tagName = title !== '' ? `${title.replace(/\s+/g, '-').toLowerCase()}:latest` : ''; $: if (!raw) { @@ -202,7 +204,8 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, ''); desc: desc, content: content, suggestionPrompts: suggestions.filter((prompt) => prompt.content !== ''), - categories: Object.keys(categories).filter((category) => categories[category]) + categories: Object.keys(categories).filter((category) => categories[category]), + user: modelfileCreator !== null ? modelfileCreator : undefined }); await goto('/modelfiles'); } @@ -237,6 +240,10 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, ''); } ]; + modelfileCreator = { + username: modelfile.user.username, + name: modelfile.user.name + }; for (const category of modelfile.categories) { categories[category.toLowerCase()] = true; } From b1081c2c8136809d8edcaae8a51ed2791f45750f Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Tue, 5 Dec 2023 16:39:26 -0800 Subject: [PATCH 2/2] feat: use display name if it exists --- src/lib/components/chat/Messages.svelte | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib/components/chat/Messages.svelte b/src/lib/components/chat/Messages.svelte index b58dd592..173ae05d 100644 --- a/src/lib/components/chat/Messages.svelte +++ b/src/lib/components/chat/Messages.svelte @@ -325,7 +325,11 @@
{#if selectedModelfile.user}
- By @{selectedModelfile.user.username} + By {selectedModelfile.user.name + ? selectedModelfile.user.name + : `@${selectedModelfile.user.username}`}
{/if} {:else}