enh: new landing page

This commit is contained in:
Timothy J. Baek
2024-10-05 03:07:56 -07:00
parent 0bd88090bb
commit 0319e63999
6 changed files with 421 additions and 285 deletions

View File

@@ -70,6 +70,7 @@
import Navbar from '$lib/components/layout/Navbar.svelte';
import ChatControls from './ChatControls.svelte';
import EventConfirmDialog from '../common/ConfirmDialog.svelte';
import Placeholder from './Messages/Placeholder.svelte';
export let chatIdProp = '';
@@ -689,7 +690,6 @@
);
files = [];
prompt = '';
// Create user message
@@ -1954,49 +1954,85 @@
{/if}
<div class="flex flex-col flex-auto z-10 w-full">
<div
class=" pb-2.5 flex flex-col justify-between w-full flex-auto overflow-auto h-0 max-w-full z-10 scrollbar-hidden"
id="messages-container"
bind:this={messagesContainerElement}
on:scroll={(e) => {
autoScroll =
messagesContainerElement.scrollHeight - messagesContainerElement.scrollTop <=
messagesContainerElement.clientHeight + 5;
}}
>
<div class=" h-full w-full flex flex-col {chatIdProp ? 'py-4' : 'pt-2 pb-4'}">
<Messages
chatId={$chatId}
bind:history
bind:autoScroll
bind:prompt
{#if history.currentId}
<div
class=" pb-2.5 flex flex-col justify-between w-full flex-auto overflow-auto h-0 max-w-full z-10 scrollbar-hidden"
id="messages-container"
bind:this={messagesContainerElement}
on:scroll={(e) => {
autoScroll =
messagesContainerElement.scrollHeight - messagesContainerElement.scrollTop <=
messagesContainerElement.clientHeight + 5;
}}
>
<div class=" h-full w-full flex flex-col">
<Messages
chatId={$chatId}
bind:history
bind:autoScroll
bind:prompt
{selectedModels}
{sendPrompt}
{showMessage}
{continueResponse}
{regenerateResponse}
{mergeResponses}
{chatActionHandler}
bottomPadding={files.length > 0}
on:submit={(e) => {
if (e.detail) {
submitPrompt(e.detail);
}
}}
/>
</div>
</div>
<div class=" pb-[1.6rem]">
<MessageInput
{history}
{selectedModels}
{sendPrompt}
{showMessage}
{continueResponse}
{regenerateResponse}
{mergeResponses}
{chatActionHandler}
bottomPadding={files.length > 0}
on:submit={(e) => {
bind:files
bind:prompt
bind:autoScroll
bind:selectedToolIds
bind:webSearchEnabled
bind:atSelectedModel
availableToolIds={selectedModelIds.reduce((a, e, i, arr) => {
const model = $models.find((m) => m.id === e);
if (model?.info?.meta?.toolIds ?? false) {
return [...new Set([...a, ...model.info.meta.toolIds])];
}
return a;
}, [])}
transparentBackground={$settings?.backgroundImageUrl ?? false}
{stopResponse}
{createMessagePair}
on:submit={async (e) => {
if (e.detail) {
prompt = '';
await tick();
submitPrompt(e.detail);
}
}}
/>
</div>
</div>
<div class="">
<MessageInput
<div
class="absolute bottom-1.5 text-xs text-gray-500 text-center line-clamp-1 right-0 left-0"
>
{$i18n.t('LLMs can make mistakes. Verify important information.')}
</div>
</div>
{:else}
<Placeholder
{history}
{selectedModels}
bind:files
bind:prompt
bind:autoScroll
bind:selectedToolIds
bind:webSearchEnabled
bind:atSelectedModel
{selectedModels}
availableToolIds={selectedModelIds.reduce((a, e, i, arr) => {
const model = $models.find((m) => m.id === e);
if (model?.info?.meta?.toolIds ?? false) {
@@ -2005,14 +2041,17 @@
return a;
}, [])}
transparentBackground={$settings?.backgroundImageUrl ?? false}
{submitPrompt}
{stopResponse}
{createMessagePair}
on:call={async () => {
await showControls.set(true);
on:submit={async (e) => {
if (e.detail) {
prompt = '';
await tick();
submitPrompt(e.detail);
}
}}
/>
</div>
{/if}
</div>
</Pane>