mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
refac
This commit is contained in:
parent
ace3303ff5
commit
369f461691
@ -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 {
|
||||
|
@ -89,7 +89,8 @@
|
||||
files,
|
||||
selectedToolIds,
|
||||
imageGenerationEnabled,
|
||||
webSearchEnabled
|
||||
webSearchEnabled,
|
||||
codeInterpreterEnabled
|
||||
});
|
||||
|
||||
let showTools = false;
|
||||
|
@ -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);
|
||||
}}
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user