From f91a6b63d122b78f79faee655214ce2c6f1ce67b Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Fri, 29 Dec 2023 23:03:48 -0800 Subject: [PATCH 1/5] feat: message components refac --- src/lib/components/chat/Messages.svelte | 830 +----------------- src/lib/components/chat/Messages/Name.svelte | 3 + .../chat/Messages/Placeholder.svelte | 71 ++ .../chat/Messages/ProfileImage.svelte | 7 + .../chat/Messages/ResponseMessage.svelte | 544 ++++++++++++ .../components/chat/Messages/Skeleton.svelte | 19 + .../chat/Messages/UserMessage.svelte | 195 ++++ src/routes/(app)/+page.svelte | 13 +- static/ollama-dark.png | Bin 0 -> 13509 bytes static/ollama.png | Bin 7487 -> 7788 bytes 10 files changed, 891 insertions(+), 791 deletions(-) create mode 100644 src/lib/components/chat/Messages/Name.svelte create mode 100644 src/lib/components/chat/Messages/Placeholder.svelte create mode 100644 src/lib/components/chat/Messages/ProfileImage.svelte create mode 100644 src/lib/components/chat/Messages/ResponseMessage.svelte create mode 100644 src/lib/components/chat/Messages/Skeleton.svelte create mode 100644 src/lib/components/chat/Messages/UserMessage.svelte create mode 100644 static/ollama-dark.png diff --git a/src/lib/components/chat/Messages.svelte b/src/lib/components/chat/Messages.svelte index df8a72b8..08589420 100644 --- a/src/lib/components/chat/Messages.svelte +++ b/src/lib/components/chat/Messages.svelte @@ -1,12 +1,5 @@ {#if messages.length == 0} -
-
- {#if selectedModelfile && selectedModelfile.imageUrl} - modelfile - {:else} - ollama - {/if} -
-
- {#if selectedModelfile} - - {selectedModelfile.title} - -
- {selectedModelfile.desc} -
- {#if selectedModelfile.user} - - {/if} - {:else} - How can I help you today? - {/if} -
-
+ {:else} {#each messages as message, messageIdx}
-
-
- {#if message.role === 'user'} - {#if $config === null || !($config?.auth ?? true)} - User profile - {:else} - User profile - {/if} - {:else if selectedModelfile} - Ollama profile - {:else} - Ollama profile - {/if} -
- -
-
- {#if message.role === 'user'} - You - {:else if selectedModelfile} - - {selectedModelfile.title} - - {:else} - Ollama {message.model ? ` ${message.model}` : ''} - {/if} -
- - {#if message.role !== 'user' && message.content === ''} -
-
-
-
- -
-
-
-
-
-
-
-
-
- -
-
-
-
- {:else} -
- {#if message.role == 'user'} - {#if message.files} -
- {#each message.files as file} -
- {#if file.type === 'image'} - input - {/if} -
- {/each} -
- {/if} - - {#if message?.edit === true} -
-