소스 검색

enh: new landing page

Timothy J. Baek 7 달 전
부모
커밋
0319e63999

+ 73 - 34
src/lib/components/chat/Chat.svelte

@@ -70,6 +70,7 @@
 	import Navbar from '$lib/components/layout/Navbar.svelte';
 	import Navbar from '$lib/components/layout/Navbar.svelte';
 	import ChatControls from './ChatControls.svelte';
 	import ChatControls from './ChatControls.svelte';
 	import EventConfirmDialog from '../common/ConfirmDialog.svelte';
 	import EventConfirmDialog from '../common/ConfirmDialog.svelte';
+	import Placeholder from './Messages/Placeholder.svelte';
 
 
 	export let chatIdProp = '';
 	export let chatIdProp = '';
 
 
@@ -689,7 +690,6 @@
 			);
 			);
 
 
 			files = [];
 			files = [];
-
 			prompt = '';
 			prompt = '';
 
 
 			// Create user message
 			// Create user message
@@ -1954,49 +1954,85 @@
 				{/if}
 				{/if}
 
 
 				<div class="flex flex-col flex-auto z-10 w-full">
 				<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}
 								{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) {
 									if (e.detail) {
+										prompt = '';
+										await tick();
 										submitPrompt(e.detail);
 										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}
 							{history}
+							{selectedModels}
 							bind:files
 							bind:files
 							bind:prompt
 							bind:prompt
 							bind:autoScroll
 							bind:autoScroll
 							bind:selectedToolIds
 							bind:selectedToolIds
 							bind:webSearchEnabled
 							bind:webSearchEnabled
 							bind:atSelectedModel
 							bind:atSelectedModel
-							{selectedModels}
 							availableToolIds={selectedModelIds.reduce((a, e, i, arr) => {
 							availableToolIds={selectedModelIds.reduce((a, e, i, arr) => {
 								const model = $models.find((m) => m.id === e);
 								const model = $models.find((m) => m.id === e);
 								if (model?.info?.meta?.toolIds ?? false) {
 								if (model?.info?.meta?.toolIds ?? false) {
@@ -2005,14 +2041,17 @@
 								return a;
 								return a;
 							}, [])}
 							}, [])}
 							transparentBackground={$settings?.backgroundImageUrl ?? false}
 							transparentBackground={$settings?.backgroundImageUrl ?? false}
-							{submitPrompt}
 							{stopResponse}
 							{stopResponse}
 							{createMessagePair}
 							{createMessagePair}
-							on:call={async () => {
-								await showControls.set(true);
+							on:submit={async (e) => {
+								if (e.detail) {
+									prompt = '';
+									await tick();
+									submitPrompt(e.detail);
+								}
 							}}
 							}}
 						/>
 						/>
-					</div>
+					{/if}
 				</div>
 				</div>
 			</Pane>
 			</Pane>
 
 

+ 19 - 33
src/lib/components/chat/MessageInput.svelte

@@ -12,21 +12,14 @@
 		config,
 		config,
 		showCallOverlay,
 		showCallOverlay,
 		tools,
 		tools,
-		user as _user
+		user as _user,
+		showControls
 	} from '$lib/stores';
 	} from '$lib/stores';
 	import { blobToFile, findWordIndices } from '$lib/utils';
 	import { blobToFile, findWordIndices } from '$lib/utils';
-
 	import { transcribeAudio } from '$lib/apis/audio';
 	import { transcribeAudio } from '$lib/apis/audio';
-
-	import { processFile } from '$lib/apis/retrieval';
 	import { uploadFile } from '$lib/apis/files';
 	import { uploadFile } from '$lib/apis/files';
 
 
-	import {
-		SUPPORTED_FILE_TYPE,
-		SUPPORTED_FILE_EXTENSIONS,
-		WEBUI_BASE_URL,
-		WEBUI_API_BASE_URL
-	} from '$lib/constants';
+	import { WEBUI_BASE_URL, WEBUI_API_BASE_URL } from '$lib/constants';
 
 
 	import Tooltip from '../common/Tooltip.svelte';
 	import Tooltip from '../common/Tooltip.svelte';
 	import InputMenu from './MessageInput/InputMenu.svelte';
 	import InputMenu from './MessageInput/InputMenu.svelte';
@@ -41,7 +34,6 @@
 
 
 	export let transparentBackground = false;
 	export let transparentBackground = false;
 
 
-	export let submitPrompt: Function;
 	export let createMessagePair: Function;
 	export let createMessagePair: Function;
 	export let stopResponse: Function;
 	export let stopResponse: Function;
 
 
@@ -50,6 +42,14 @@
 	export let atSelectedModel: Model | undefined;
 	export let atSelectedModel: Model | undefined;
 	export let selectedModels: [''];
 	export let selectedModels: [''];
 
 
+	export let history;
+
+	export let prompt = '';
+	export let files = [];
+	export let availableToolIds = [];
+	export let selectedToolIds = [];
+	export let webSearchEnabled = false;
+
 	let recording = false;
 	let recording = false;
 
 
 	let chatTextAreaElement: HTMLTextAreaElement;
 	let chatTextAreaElement: HTMLTextAreaElement;
@@ -61,15 +61,7 @@
 	let dragged = false;
 	let dragged = false;
 
 
 	let user = null;
 	let user = null;
-	let chatInputPlaceholder = '';
-
-	export let history;
-
-	export let prompt = '';
-	export let files = [];
-	export let availableToolIds = [];
-	export let selectedToolIds = [];
-	export let webSearchEnabled = false;
+	export let placeholder = '';
 
 
 	let visionCapableModels = [];
 	let visionCapableModels = [];
 	$: visionCapableModels = [...(atSelectedModel ? [atSelectedModel] : selectedModels)].filter(
 	$: visionCapableModels = [...(atSelectedModel ? [atSelectedModel] : selectedModels)].filter(
@@ -241,7 +233,7 @@
 
 
 <div class="w-full font-primary">
 <div class="w-full font-primary">
 	<div class=" -mb-0.5 mx-auto inset-x-0 bg-transparent flex justify-center">
 	<div class=" -mb-0.5 mx-auto inset-x-0 bg-transparent flex justify-center">
-		<div class="flex flex-col max-w-6xl px-2.5 md:px-6 w-full">
+		<div class="flex flex-col max-w-6xl w-full">
 			<div class="relative">
 			<div class="relative">
 				{#if autoScroll === false && history?.currentId}
 				{#if autoScroll === false && history?.currentId}
 					<div
 					<div
@@ -324,7 +316,7 @@
 
 
 	<div class="{transparentBackground ? 'bg-transparent' : 'bg-white dark:bg-gray-900'} ">
 	<div class="{transparentBackground ? 'bg-transparent' : 'bg-white dark:bg-gray-900'} ">
 		<div class="max-w-6xl px-2.5 md:px-6 mx-auto inset-x-0 pb-safe-bottom">
 		<div class="max-w-6xl px-2.5 md:px-6 mx-auto inset-x-0 pb-safe-bottom">
-			<div class=" pb-2">
+			<div class="">
 				<input
 				<input
 					bind:this={filesInputElement}
 					bind:this={filesInputElement}
 					bind:files={inputFiles}
 					bind:files={inputFiles}
@@ -362,7 +354,7 @@
 							document.getElementById('chat-textarea')?.focus();
 							document.getElementById('chat-textarea')?.focus();
 
 
 							if ($settings?.speechAutoSend ?? false) {
 							if ($settings?.speechAutoSend ?? false) {
-								submitPrompt(prompt);
+								dispatch('submit', prompt);
 							}
 							}
 						}}
 						}}
 					/>
 					/>
@@ -371,7 +363,7 @@
 						class="w-full flex gap-1.5"
 						class="w-full flex gap-1.5"
 						on:submit|preventDefault={() => {
 						on:submit|preventDefault={() => {
 							// check if selectedModels support image input
 							// check if selectedModels support image input
-							submitPrompt(prompt);
+							dispatch('submit', prompt);
 						}}
 						}}
 					>
 					>
 						<div
 						<div
@@ -503,9 +495,7 @@
 									id="chat-textarea"
 									id="chat-textarea"
 									bind:this={chatTextAreaElement}
 									bind:this={chatTextAreaElement}
 									class="scrollbar-hidden bg-gray-50 dark:bg-gray-850 dark:text-gray-100 outline-none w-full py-3 px-1 rounded-xl resize-none h-[48px]"
 									class="scrollbar-hidden bg-gray-50 dark:bg-gray-850 dark:text-gray-100 outline-none w-full py-3 px-1 rounded-xl resize-none h-[48px]"
-									placeholder={chatInputPlaceholder !== ''
-										? chatInputPlaceholder
-										: $i18n.t('Send a Message')}
+									placeholder={placeholder ? placeholder : $i18n.t('Send a Message')}
 									bind:value={prompt}
 									bind:value={prompt}
 									on:keypress={(e) => {
 									on:keypress={(e) => {
 										if (
 										if (
@@ -523,7 +513,7 @@
 
 
 											// Submit the prompt when Enter key is pressed
 											// Submit the prompt when Enter key is pressed
 											if (prompt !== '' && e.key === 'Enter' && !e.shiftKey) {
 											if (prompt !== '' && e.key === 'Enter' && !e.shiftKey) {
-												submitPrompt(prompt);
+												dispatch('submit', prompt);
 											}
 											}
 										}
 										}
 									}}
 									}}
@@ -760,7 +750,7 @@
 														stream = null;
 														stream = null;
 
 
 														showCallOverlay.set(true);
 														showCallOverlay.set(true);
-														dispatch('call');
+														showControls.set(true);
 													} catch (err) {
 													} catch (err) {
 														// If the user denies the permission or an error occurs, show an error message
 														// If the user denies the permission or an error occurs, show an error message
 														toast.error($i18n.t('Permission denied when accessing media devices'));
 														toast.error($i18n.t('Permission denied when accessing media devices'));
@@ -825,10 +815,6 @@
 						</div>
 						</div>
 					</form>
 					</form>
 				{/if}
 				{/if}
-
-				<div class="mt-1.5 text-xs text-gray-500 text-center line-clamp-1">
-					{$i18n.t('LLMs can make mistakes. Verify important information.')}
-				</div>
 			</div>
 			</div>
 		</div>
 		</div>
 	</div>
 	</div>

+ 27 - 93
src/lib/components/chat/MessageInput/Suggestions.svelte

@@ -1,10 +1,10 @@
 <script lang="ts">
 <script lang="ts">
 	import Bolt from '$lib/components/icons/Bolt.svelte';
 	import Bolt from '$lib/components/icons/Bolt.svelte';
-	import { onMount, getContext } from 'svelte';
+	import { onMount, getContext, createEventDispatcher } from 'svelte';
 
 
 	const i18n = getContext('i18n');
 	const i18n = getContext('i18n');
+	const dispatch = createEventDispatcher();
 
 
-	export let submitPrompt: Function;
 	export let suggestionPrompts = [];
 	export let suggestionPrompts = [];
 
 
 	let prompts = [];
 	let prompts = [];
@@ -12,24 +12,6 @@
 	$: prompts = (suggestionPrompts ?? [])
 	$: prompts = (suggestionPrompts ?? [])
 		.reduce((acc, current) => [...acc, ...[current]], [])
 		.reduce((acc, current) => [...acc, ...[current]], [])
 		.sort(() => Math.random() - 0.5);
 		.sort(() => Math.random() - 0.5);
-	// suggestionPrompts.length <= 4
-	// 	? suggestionPrompts
-	// 	: suggestionPrompts.sort(() => Math.random() - 0.5).slice(0, 4);
-
-	onMount(() => {
-		const containerElement = document.getElementById('suggestions-container');
-
-		if (containerElement) {
-			containerElement.addEventListener('wheel', function (event) {
-				if (event.deltaY !== 0) {
-					// If scrolling vertically, prevent default behavior
-					event.preventDefault();
-					// Adjust horizontal scroll position based on vertical scroll
-					containerElement.scrollLeft += event.deltaY;
-				}
-			});
-		}
-	});
 </script>
 </script>
 
 
 {#if prompts.length > 0}
 {#if prompts.length > 0}
@@ -39,80 +21,32 @@
 	</div>
 	</div>
 {/if}
 {/if}
 
 
-<div class="w-full">
-	<div
-		class="relative w-full flex gap-2 snap-x snap-mandatory md:snap-none overflow-x-auto tabs"
-		id="suggestions-container"
-	>
-		{#each prompts as prompt, promptIdx}
-			<div class="snap-center shrink-0">
-				<button
-					class="flex flex-col flex-1 shrink-0 w-64 justify-between h-36 p-5 px-6 bg-gray-50 hover:bg-gray-100 dark:bg-gray-850 dark:hover:bg-gray-800 rounded-3xl transition group"
-					on:click={() => {
-						submitPrompt(prompt.content);
-					}}
-				>
-					<div class="flex flex-col text-left">
-						{#if prompt.title && prompt.title[0] !== ''}
-							<div
-								class="  font-medium dark:text-gray-300 dark:group-hover:text-gray-200 transition"
-							>
-								{prompt.title[0]}
-							</div>
-							<div class="text-sm text-gray-600 font-normal line-clamp-2">{prompt.title[1]}</div>
-						{:else}
-							<div
-								class="  text-sm font-medium dark:text-gray-300 dark:group-hover:text-gray-100 transition line-clamp-2"
-							>
-								{prompt.content}
-							</div>
-						{/if}
+<div class=" h-40 max-h-full overflow-auto scrollbar-hidden">
+	{#each prompts as prompt, promptIdx}
+		<button
+			class="flex flex-col flex-1 shrink-0 w-full justify-between px-3 py-2 rounded-xl bg-transparent hover:bg-black/5 dark:hover:bg-white/5 transition group"
+			on:click={() => {
+				dispatch('select', prompt.content);
+			}}
+		>
+			<div class="flex flex-col text-left">
+				{#if prompt.title && prompt.title[0] !== ''}
+					<div
+						class="  font-medium dark:text-gray-300 dark:group-hover:text-gray-200 transition line-clamp-1"
+					>
+						{prompt.title[0]}
 					</div>
 					</div>
-
-					<div class="w-full flex justify-between">
-						<div
-							class="text-xs text-gray-400 group-hover:text-gray-500 dark:text-gray-600 dark:group-hover:text-gray-500 transition self-center"
-						>
-							{$i18n.t('Prompt')}
-						</div>
-
-						<div
-							class="self-end p-1 rounded-lg text-gray-300 group-hover:text-gray-800 dark:text-gray-700 dark:group-hover:text-gray-100 transition"
-						>
-							<svg
-								xmlns="http://www.w3.org/2000/svg"
-								viewBox="0 0 16 16"
-								fill="currentColor"
-								class="size-4"
-							>
-								<path
-									fill-rule="evenodd"
-									d="M8 14a.75.75 0 0 1-.75-.75V4.56L4.03 7.78a.75.75 0 0 1-1.06-1.06l4.5-4.5a.75.75 0 0 1 1.06 0l4.5 4.5a.75.75 0 0 1-1.06 1.06L8.75 4.56v8.69A.75.75 0 0 1 8 14Z"
-									clip-rule="evenodd"
-								/>
-							</svg>
-						</div>
+					<div class="text-xs text-gray-500 font-normal line-clamp-1">{prompt.title[1]}</div>
+				{:else}
+					<div
+						class="  font-medium dark:text-gray-300 dark:group-hover:text-gray-200 transition line-clamp-1"
+					>
+						{prompt.content}
 					</div>
 					</div>
-				</button>
-			</div>
-		{/each}
 
 
-		<!-- <div class="snap-center shrink-0">
-		<img
-			class="shrink-0 w-80 h-40 rounded-lg shadow-xl bg-white"
-			src="https://images.unsplash.com/photo-1604999565976-8913ad2ddb7c?ixlib=rb-1.2.1&amp;ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&amp;auto=format&amp;fit=crop&amp;w=320&amp;h=160&amp;q=80"
-		/>
-	</div> -->
-	</div>
+					<div class="text-xs text-gray-500 font-normal line-clamp-1">Prompt</div>
+				{/if}
+			</div>
+		</button>
+	{/each}
 </div>
 </div>
-
-<style>
-	.tabs::-webkit-scrollbar {
-		display: none; /* for Chrome, Safari and Opera */
-	}
-
-	.tabs {
-		-ms-overflow-style: none; /* IE and Edge */
-		scrollbar-width: none; /* Firefox */
-	}
-</style>

+ 1 - 37
src/lib/components/chat/Messages.svelte

@@ -310,43 +310,7 @@
 
 
 <div class="h-full flex">
 <div class="h-full flex">
 	{#if Object.keys(history?.messages ?? {}).length == 0}
 	{#if Object.keys(history?.messages ?? {}).length == 0}
-		<Placeholder
-			modelIds={selectedModels}
-			submitPrompt={async (p) => {
-				let text = p;
-
-				if (p.includes('{{CLIPBOARD}}')) {
-					const clipboardText = await navigator.clipboard.readText().catch((err) => {
-						toast.error($i18n.t('Failed to read clipboard contents'));
-						return '{{CLIPBOARD}}';
-					});
-
-					text = p.replaceAll('{{CLIPBOARD}}', clipboardText);
-				}
-
-				prompt = text;
-
-				await tick();
-
-				const chatInputElement = document.getElementById('chat-textarea');
-				if (chatInputElement) {
-					prompt = p;
-
-					chatInputElement.style.height = '';
-					chatInputElement.style.height = Math.min(chatInputElement.scrollHeight, 200) + 'px';
-					chatInputElement.focus();
-
-					const words = findWordIndices(prompt);
-
-					if (words.length > 0) {
-						const word = words.at(0);
-						chatInputElement.setSelectionRange(word?.startIndex, word.endIndex + 1);
-					}
-				}
-
-				await tick();
-			}}
-		/>
+		<Placeholder {selectedModels} bind:prompt />
 	{:else}
 	{:else}
 		<div class="w-full pt-2">
 		<div class="w-full pt-2">
 			{#key chatId}
 			{#key chatId}

+ 135 - 0
src/lib/components/chat/Messages/OldPlaceholder.svelte

@@ -0,0 +1,135 @@
+<script lang="ts">
+	import { WEBUI_BASE_URL } from '$lib/constants';
+	import { marked } from 'marked';
+
+	import { config, user, models as _models, temporaryChatEnabled } from '$lib/stores';
+	import { onMount, getContext } from 'svelte';
+
+	import { blur, fade } from 'svelte/transition';
+
+	import Suggestions from '../MessageInput/Suggestions.svelte';
+	import { sanitizeResponseContent } from '$lib/utils';
+	import Tooltip from '$lib/components/common/Tooltip.svelte';
+	import EyeSlash from '$lib/components/icons/EyeSlash.svelte';
+
+	const i18n = getContext('i18n');
+
+	export let modelIds = [];
+	export let models = [];
+
+	export let submitPrompt;
+
+	let mounted = false;
+	let selectedModelIdx = 0;
+
+	$: if (modelIds.length > 0) {
+		selectedModelIdx = models.length - 1;
+	}
+
+	$: models = modelIds.map((id) => $_models.find((m) => m.id === id));
+
+	onMount(() => {
+		mounted = true;
+	});
+</script>
+
+{#key mounted}
+	<div class="m-auto w-full max-w-6xl px-8 lg:px-20">
+		<div class="flex justify-start">
+			<div class="flex -space-x-4 mb-0.5" in:fade={{ duration: 200 }}>
+				{#each models as model, modelIdx}
+					<button
+						on:click={() => {
+							selectedModelIdx = modelIdx;
+						}}
+					>
+						<Tooltip
+							content={marked.parse(
+								sanitizeResponseContent(models[selectedModelIdx]?.info?.meta?.description ?? '')
+							)}
+							placement="right"
+						>
+							<img
+								crossorigin="anonymous"
+								src={model?.info?.meta?.profile_image_url ??
+									($i18n.language === 'dg-DG'
+										? `/doge.png`
+										: `${WEBUI_BASE_URL}/static/favicon.png`)}
+								class=" size-[2.7rem] rounded-full border-[1px] border-gray-200 dark:border-none"
+								alt="logo"
+								draggable="false"
+							/>
+						</Tooltip>
+					</button>
+				{/each}
+			</div>
+		</div>
+
+		{#if $temporaryChatEnabled}
+			<Tooltip
+				content="This chat won't appear in history and your messages will not be saved."
+				className="w-fit"
+				placement="top-start"
+			>
+				<div class="flex items-center gap-2 text-gray-500 font-medium text-lg my-2 w-fit">
+					<EyeSlash strokeWidth="2.5" className="size-5" /> Temporary Chat
+				</div>
+			</Tooltip>
+		{/if}
+
+		<div
+			class=" mt-2 mb-4 text-3xl text-gray-800 dark:text-gray-100 font-medium text-left flex items-center gap-4 font-primary"
+		>
+			<div>
+				<div class=" capitalize line-clamp-1" in:fade={{ duration: 200 }}>
+					{#if models[selectedModelIdx]?.info}
+						{models[selectedModelIdx]?.info?.name}
+					{:else}
+						{$i18n.t('Hello, {{name}}', { name: $user.name })}
+					{/if}
+				</div>
+
+				<div in:fade={{ duration: 200, delay: 200 }}>
+					{#if models[selectedModelIdx]?.info?.meta?.description ?? null}
+						<div
+							class="mt-0.5 text-base font-normal text-gray-500 dark:text-gray-400 line-clamp-3 markdown"
+						>
+							{@html marked.parse(
+								sanitizeResponseContent(models[selectedModelIdx]?.info?.meta?.description)
+							)}
+						</div>
+						{#if models[selectedModelIdx]?.info?.meta?.user}
+							<div class="mt-0.5 text-sm font-normal text-gray-400 dark:text-gray-500">
+								By
+								{#if models[selectedModelIdx]?.info?.meta?.user.community}
+									<a
+										href="https://openwebui.com/m/{models[selectedModelIdx]?.info?.meta?.user
+											.username}"
+										>{models[selectedModelIdx]?.info?.meta?.user.name
+											? models[selectedModelIdx]?.info?.meta?.user.name
+											: `@${models[selectedModelIdx]?.info?.meta?.user.username}`}</a
+									>
+								{:else}
+									{models[selectedModelIdx]?.info?.meta?.user.name}
+								{/if}
+							</div>
+						{/if}
+					{:else}
+						<div class=" font-medium text-gray-400 dark:text-gray-500 line-clamp-1 font-p">
+							{$i18n.t('How can I help you today?')}
+						</div>
+					{/if}
+				</div>
+			</div>
+		</div>
+
+		<div class=" w-full font-primary" in:fade={{ duration: 200, delay: 300 }}>
+			<Suggestions
+				suggestionPrompts={models[selectedModelIdx]?.info?.meta?.suggestion_prompts ??
+					$config?.default_prompt_suggestions ??
+					[]}
+				{submitPrompt}
+			/>
+		</div>
+	</div>
+{/key}

+ 165 - 87
src/lib/components/chat/Messages/Placeholder.svelte

@@ -1,32 +1,87 @@
 <script lang="ts">
 <script lang="ts">
-	import { WEBUI_BASE_URL } from '$lib/constants';
+	import { toast } from 'svelte-sonner';
 	import { marked } from 'marked';
 	import { marked } from 'marked';
 
 
-	import { config, user, models as _models, temporaryChatEnabled } from '$lib/stores';
-	import { onMount, getContext } from 'svelte';
-
+	import { onMount, getContext, tick, createEventDispatcher } from 'svelte';
 	import { blur, fade } from 'svelte/transition';
 	import { blur, fade } from 'svelte/transition';
 
 
+	const dispatch = createEventDispatcher();
+
+	import { config, user, models as _models, temporaryChatEnabled } from '$lib/stores';
+	import { sanitizeResponseContent, findWordIndices } from '$lib/utils';
+	import { WEBUI_BASE_URL } from '$lib/constants';
+
 	import Suggestions from '../MessageInput/Suggestions.svelte';
 	import Suggestions from '../MessageInput/Suggestions.svelte';
-	import { sanitizeResponseContent } from '$lib/utils';
 	import Tooltip from '$lib/components/common/Tooltip.svelte';
 	import Tooltip from '$lib/components/common/Tooltip.svelte';
 	import EyeSlash from '$lib/components/icons/EyeSlash.svelte';
 	import EyeSlash from '$lib/components/icons/EyeSlash.svelte';
+	import MessageInput from '../MessageInput.svelte';
 
 
 	const i18n = getContext('i18n');
 	const i18n = getContext('i18n');
 
 
-	export let modelIds = [];
-	export let models = [];
+	export let transparentBackground = false;
+
+	export let createMessagePair: Function;
+	export let stopResponse: Function;
+
+	export let autoScroll = false;
+
+	export let atSelectedModel: Model | undefined;
+	export let selectedModels: [''];
+
+	export let history;
+
+	export let prompt = '';
+	export let files = [];
+	export let availableToolIds = [];
+	export let selectedToolIds = [];
+	export let webSearchEnabled = false;
+
+	let models = [];
+
+	const selectSuggestionPrompt = async (p) => {
+		let text = p;
+
+		if (p.includes('{{CLIPBOARD}}')) {
+			const clipboardText = await navigator.clipboard.readText().catch((err) => {
+				toast.error($i18n.t('Failed to read clipboard contents'));
+				return '{{CLIPBOARD}}';
+			});
+
+			text = p.replaceAll('{{CLIPBOARD}}', clipboardText);
+
+			console.log('Clipboard text:', clipboardText, text);
+		}
+
+		prompt = text;
+
+		console.log(prompt);
+		await tick();
 
 
-	export let submitPrompt;
+		const chatInputElement = document.getElementById('chat-textarea');
+		if (chatInputElement) {
+			chatInputElement.style.height = '';
+			chatInputElement.style.height = Math.min(chatInputElement.scrollHeight, 200) + 'px';
+			chatInputElement.focus();
+
+			const words = findWordIndices(prompt);
+
+			if (words.length > 0) {
+				const word = words.at(0);
+				chatInputElement.setSelectionRange(word?.startIndex, word.endIndex + 1);
+			}
+		}
+
+		await tick();
+	};
 
 
 	let mounted = false;
 	let mounted = false;
 	let selectedModelIdx = 0;
 	let selectedModelIdx = 0;
 
 
-	$: if (modelIds.length > 0) {
+	$: if (selectedModels.length > 0) {
 		selectedModelIdx = models.length - 1;
 		selectedModelIdx = models.length - 1;
 	}
 	}
 
 
-	$: models = modelIds.map((id) => $_models.find((m) => m.id === id));
+	$: models = selectedModels.map((id) => $_models.find((m) => m.id === id));
 
 
 	onMount(() => {
 	onMount(() => {
 		mounted = true;
 		mounted = true;
@@ -34,41 +89,11 @@
 </script>
 </script>
 
 
 {#key mounted}
 {#key mounted}
-	<div class="m-auto w-full max-w-6xl px-8 lg:px-20">
-		<div class="flex justify-start">
-			<div class="flex -space-x-4 mb-0.5" in:fade={{ duration: 200 }}>
-				{#each models as model, modelIdx}
-					<button
-						on:click={() => {
-							selectedModelIdx = modelIdx;
-						}}
-					>
-						<Tooltip
-							content={marked.parse(
-								sanitizeResponseContent(models[selectedModelIdx]?.info?.meta?.description ?? '')
-							)}
-							placement="right"
-						>
-							<img
-								crossorigin="anonymous"
-								src={model?.info?.meta?.profile_image_url ??
-									($i18n.language === 'dg-DG'
-										? `/doge.png`
-										: `${WEBUI_BASE_URL}/static/favicon.png`)}
-								class=" size-[2.7rem] rounded-full border-[1px] border-gray-200 dark:border-none"
-								alt="logo"
-								draggable="false"
-							/>
-						</Tooltip>
-					</button>
-				{/each}
-			</div>
-		</div>
-
+	<div class="m-auto w-full max-w-6xl px-4 xl:px-20 translate-y-2 text-center">
 		{#if $temporaryChatEnabled}
 		{#if $temporaryChatEnabled}
 			<Tooltip
 			<Tooltip
 				content="This chat won't appear in history and your messages will not be saved."
 				content="This chat won't appear in history and your messages will not be saved."
-				className="w-fit"
+				className="w-full flex justify-center mb-0.5"
 				placement="top-start"
 				placement="top-start"
 			>
 			>
 				<div class="flex items-center gap-2 text-gray-500 font-medium text-lg my-2 w-fit">
 				<div class="flex items-center gap-2 text-gray-500 font-medium text-lg my-2 w-fit">
@@ -78,58 +103,111 @@
 		{/if}
 		{/if}
 
 
 		<div
 		<div
-			class=" mt-2 mb-4 text-3xl text-gray-800 dark:text-gray-100 font-medium text-left flex items-center gap-4 font-primary"
+			class="w-full text-3xl text-gray-800 dark:text-gray-100 font-medium text-center flex items-center gap-4 font-primary"
 		>
 		>
-			<div>
-				<div class=" capitalize line-clamp-1" in:fade={{ duration: 200 }}>
-					{#if models[selectedModelIdx]?.info}
-						{models[selectedModelIdx]?.info?.name}
-					{:else}
-						{$i18n.t('Hello, {{name}}', { name: $user.name })}
-					{/if}
-				</div>
-
-				<div in:fade={{ duration: 200, delay: 200 }}>
-					{#if models[selectedModelIdx]?.info?.meta?.description ?? null}
-						<div
-							class="mt-0.5 text-base font-normal text-gray-500 dark:text-gray-400 line-clamp-3 markdown"
-						>
-							{@html marked.parse(
-								sanitizeResponseContent(models[selectedModelIdx]?.info?.meta?.description)
-							)}
+			<div class="w-full flex flex-col justify-center items-center">
+				<Tooltip
+					className="flex justify-center gap-3.5 w-fit"
+					content={marked.parse(
+						sanitizeResponseContent(models[selectedModelIdx]?.info?.meta?.description ?? '')
+					)}
+					placement="top"
+				>
+					<div class="flex justify-center">
+						<div class="flex -space-x-4 mb-0.5" in:fade={{ duration: 200 }}>
+							{#each models as model, modelIdx}
+								<button
+									on:click={() => {
+										selectedModelIdx = modelIdx;
+									}}
+								>
+									<img
+										crossorigin="anonymous"
+										src={model?.info?.meta?.profile_image_url ??
+											($i18n.language === 'dg-DG'
+												? `/doge.png`
+												: `${WEBUI_BASE_URL}/static/favicon.png`)}
+										class=" size-[2.5rem] rounded-full border-[1px] border-gray-200 dark:border-none"
+										alt="logo"
+										draggable="false"
+									/>
+								</button>
+							{/each}
 						</div>
 						</div>
-						{#if models[selectedModelIdx]?.info?.meta?.user}
-							<div class="mt-0.5 text-sm font-normal text-gray-400 dark:text-gray-500">
-								By
-								{#if models[selectedModelIdx]?.info?.meta?.user.community}
-									<a
-										href="https://openwebui.com/m/{models[selectedModelIdx]?.info?.meta?.user
-											.username}"
-										>{models[selectedModelIdx]?.info?.meta?.user.name
-											? models[selectedModelIdx]?.info?.meta?.user.name
-											: `@${models[selectedModelIdx]?.info?.meta?.user.username}`}</a
-									>
-								{:else}
-									{models[selectedModelIdx]?.info?.meta?.user.name}
-								{/if}
+					</div>
+
+					<div class=" capitalize line-clamp-1 text-4xl" in:fade={{ duration: 200 }}>
+						{#if models[selectedModelIdx]?.info}
+							{models[selectedModelIdx]?.info?.name}
+						{:else}
+							{$i18n.t('Hello, {{name}}', { name: $user.name })}
+						{/if}
+					</div>
+				</Tooltip>
+
+				<div class="flex mt-0.5 mb-2">
+					<div in:fade={{ duration: 200, delay: 200 }}>
+						{#if models[selectedModelIdx]?.info?.meta?.description ?? null}
+							<div
+								class="mt-0.5 text-sm font-normal text-gray-500 dark:text-gray-400 line-clamp-3 markdown"
+							>
+								{@html marked.parse(
+									sanitizeResponseContent(models[selectedModelIdx]?.info?.meta?.description)
+								)}
 							</div>
 							</div>
+							{#if models[selectedModelIdx]?.info?.meta?.user}
+								<div class="mt-0.5 text-sm font-normal text-gray-400 dark:text-gray-500">
+									By
+									{#if models[selectedModelIdx]?.info?.meta?.user.community}
+										<a
+											href="https://openwebui.com/m/{models[selectedModelIdx]?.info?.meta?.user
+												.username}"
+											>{models[selectedModelIdx]?.info?.meta?.user.name
+												? models[selectedModelIdx]?.info?.meta?.user.name
+												: `@${models[selectedModelIdx]?.info?.meta?.user.username}`}</a
+										>
+									{:else}
+										{models[selectedModelIdx]?.info?.meta?.user.name}
+									{/if}
+								</div>
+							{/if}
 						{/if}
 						{/if}
-					{:else}
-						<div class=" font-medium text-gray-400 dark:text-gray-500 line-clamp-1 font-p">
-							{$i18n.t('How can I help you today?')}
-						</div>
-					{/if}
+					</div>
+				</div>
+
+				<div class="text-base font-normal lg:translate-x-6 lg:max-w-3xl w-full py-3">
+					<MessageInput
+						{history}
+						{selectedModels}
+						bind:files
+						bind:prompt
+						bind:autoScroll
+						bind:selectedToolIds
+						bind:webSearchEnabled
+						bind:atSelectedModel
+						{availableToolIds}
+						{transparentBackground}
+						{stopResponse}
+						{createMessagePair}
+						placeholder={$i18n.t('How can I help you today?')}
+						on:submit={(e) => {
+							dispatch('submit', e.detail);
+						}}
+					/>
 				</div>
 				</div>
 			</div>
 			</div>
 		</div>
 		</div>
-
-		<div class=" w-full font-primary" in:fade={{ duration: 200, delay: 300 }}>
-			<Suggestions
-				suggestionPrompts={models[selectedModelIdx]?.info?.meta?.suggestion_prompts ??
-					$config?.default_prompt_suggestions ??
-					[]}
-				{submitPrompt}
-			/>
+		<div class="mx-auto max-w-2xl font-primary" in:fade={{ duration: 200, delay: 300 }}>
+			<div class="mx-4">
+				<Suggestions
+					suggestionPrompts={models[selectedModelIdx]?.info?.meta?.suggestion_prompts ??
+						$config?.default_prompt_suggestions ??
+						[]}
+					on:select={(e) => {
+						selectSuggestionPrompt(e.detail);
+					}}
+				/>
+			</div>
 		</div>
 		</div>
 	</div>
 	</div>
 {/key}
 {/key}