From da8f7cff2fc303f84fc929703cd8231321f88daf Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Mon, 18 Nov 2024 22:49:38 -0800 Subject: [PATCH] refac --- src/lib/components/chat/Placeholder.svelte | 247 ++++++++++----------- 1 file changed, 121 insertions(+), 126 deletions(-) diff --git a/src/lib/components/chat/Placeholder.svelte b/src/lib/components/chat/Placeholder.svelte index 5b7bb52ae..6782ea628 100644 --- a/src/lib/components/chat/Placeholder.svelte +++ b/src/lib/components/chat/Placeholder.svelte @@ -75,7 +75,6 @@ await tick(); }; - let mounted = false; let selectedModelIdx = 0; $: if (selectedModels.length > 0) { @@ -84,147 +83,143 @@ $: models = selectedModels.map((id) => $_models.find((m) => m.id === id)); - onMount(() => { - mounted = true; - }); + onMount(() => {}); -{#if mounted} -
- {#if $temporaryChatEnabled} - -
- Temporary Chat -
-
- {/if} - -
+ {#if $temporaryChatEnabled} + -
-
-
-
- {#each models as model, modelIdx} - tag.name.toUpperCase()) - .join(', ')} - placement="top" - > - - - {/each} -
-
+
+ Temporary Chat +
+ + {/if} -
- {#if models[selectedModelIdx]?.name} - {models[selectedModelIdx]?.name} - {:else} - {$i18n.t('Hello, {{name}}', { name: $user.name })} - {/if} -
-
- -
-
- {#if models[selectedModelIdx]?.info?.meta?.description ?? null} +
+
+
+
+
+ {#each models as model, modelIdx} tag.name.toUpperCase()) + .join(', ')} placement="top" > -
{ + selectedModelIdx = modelIdx; + }} > - {@html marked.parse( - sanitizeResponseContent(models[selectedModelIdx]?.info?.meta?.description) - )} -
+ logo +
- - {#if models[selectedModelIdx]?.info?.meta?.user} -
- By - {#if models[selectedModelIdx]?.info?.meta?.user.community} - {models[selectedModelIdx]?.info?.meta?.user.name - ? models[selectedModelIdx]?.info?.meta?.user.name - : `@${models[selectedModelIdx]?.info?.meta?.user.username}`} - {:else} - {models[selectedModelIdx]?.info?.meta?.user.name} - {/if} -
- {/if} - {/if} + {/each}
-
- { - dispatch('upload', e.detail); - }} - on:submit={(e) => { - dispatch('submit', e.detail); - }} - /> +
+ {#if models[selectedModelIdx]?.name} + {models[selectedModelIdx]?.name} + {:else} + {$i18n.t('Hello, {{name}}', { name: $user.name })} + {/if}
-
-
-
- { - selectSuggestionPrompt(e.detail); + +
+
+ {#if models[selectedModelIdx]?.info?.meta?.description ?? null} + +
+ {@html marked.parse( + sanitizeResponseContent(models[selectedModelIdx]?.info?.meta?.description) + )} +
+
+ + {#if models[selectedModelIdx]?.info?.meta?.user} +
+ By + {#if models[selectedModelIdx]?.info?.meta?.user.community} + {models[selectedModelIdx]?.info?.meta?.user.name + ? models[selectedModelIdx]?.info?.meta?.user.name + : `@${models[selectedModelIdx]?.info?.meta?.user.username}`} + {:else} + {models[selectedModelIdx]?.info?.meta?.user.name} + {/if} +
+ {/if} + {/if} +
+
+ +
+ { + dispatch('upload', e.detail); + }} + on:submit={(e) => { + dispatch('submit', e.detail); }} />
-{/if} +
+
+ { + selectSuggestionPrompt(e.detail); + }} + /> +
+
+