This commit is contained in:
Timothy Jaeryang Baek 2025-05-07 01:48:54 +04:00
parent ace3303ff5
commit 369f461691
4 changed files with 36 additions and 19 deletions

View File

@ -142,7 +142,6 @@
$: if (chatIdProp) {
(async () => {
loading = true;
console.log(chatIdProp);
prompt = '';
files = [];
@ -150,22 +149,25 @@
webSearchEnabled = false;
imageGenerationEnabled = false;
if (localStorage.getItem(`chat-input${chatIdProp ? `-${chatIdProp}` : ''}`)) {
try {
const input = JSON.parse(
localStorage.getItem(`chat-input${chatIdProp ? `-${chatIdProp}` : ''}`)
);
prompt = input.prompt;
files = input.files;
selectedToolIds = input.selectedToolIds;
webSearchEnabled = input.webSearchEnabled;
imageGenerationEnabled = input.imageGenerationEnabled;
console.log('chat-input', input);
} catch (e) {}
}
if (chatIdProp && (await loadChat())) {
await tick();
loading = false;
if (localStorage.getItem(`chat-input-${chatIdProp}`)) {
try {
const input = JSON.parse(localStorage.getItem(`chat-input-${chatIdProp}`));
prompt = input.prompt;
files = input.files;
selectedToolIds = input.selectedToolIds;
webSearchEnabled = input.webSearchEnabled;
imageGenerationEnabled = input.imageGenerationEnabled;
} catch (e) {}
}
window.setTimeout(() => scrollToBottom(), 0);
const chatInput = document.getElementById('chat-input');
chatInput?.focus();
@ -416,9 +418,12 @@
}
}
if (localStorage.getItem(`chat-input-${chatIdProp}`)) {
if (localStorage.getItem(`chat-input${chatIdProp ? `-${chatIdProp}` : ''}`)) {
try {
const input = JSON.parse(localStorage.getItem(`chat-input-${chatIdProp}`));
const input = JSON.parse(
localStorage.getItem(`chat-input${chatIdProp ? `-${chatIdProp}` : ''}`)
);
console.log('chat-input', input);
prompt = input.prompt;
files = input.files;
selectedToolIds = input.selectedToolIds;
@ -2040,6 +2045,7 @@
{stopResponse}
{createMessagePair}
onChange={(input) => {
console.log(input);
if (input.prompt !== null) {
localStorage.setItem(`chat-input-${$chatId}`, JSON.stringify(input));
} else {

View File

@ -89,7 +89,8 @@
files,
selectedToolIds,
imageGenerationEnabled,
webSearchEnabled
webSearchEnabled,
codeInterpreterEnabled
});
let showTools = false;

View File

@ -201,6 +201,14 @@
{stopResponse}
{createMessagePair}
placeholder={$i18n.t('How can I help you today?')}
onChange={(input) => {
console.log('input', input);
if (input.prompt !== null) {
localStorage.setItem(`chat-input`, JSON.stringify(input));
} else {
localStorage.removeItem(`chat-input`);
}
}}
on:upload={(e) => {
dispatch('upload', e.detail);
}}

View File

@ -2,7 +2,7 @@
import Fuse from 'fuse.js';
import Bolt from '$lib/components/icons/Bolt.svelte';
import { onMount, getContext, createEventDispatcher } from 'svelte';
import { WEBUI_NAME } from '$lib/stores';
import { settings, WEBUI_NAME } from '$lib/stores';
import { WEBUI_VERSION } from '$lib/constants';
const i18n = getContext('i18n');
@ -72,7 +72,9 @@
<!-- Keine Vorschläge -->
<div
class="flex w-full text-center items-center justify-center self-start text-gray-400 dark:text-gray-600"
class="flex w-full {$settings?.landingPageMode === 'chat'
? ' -mt-1'
: 'text-center items-center justify-center'} self-start text-gray-400 dark:text-gray-600"
>
{$WEBUI_NAME} ‧ v{WEBUI_VERSION}
</div>