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) {
|
$: if (chatIdProp) {
|
||||||
(async () => {
|
(async () => {
|
||||||
loading = true;
|
loading = true;
|
||||||
console.log(chatIdProp);
|
|
||||||
|
|
||||||
prompt = '';
|
prompt = '';
|
||||||
files = [];
|
files = [];
|
||||||
@ -150,22 +149,25 @@
|
|||||||
webSearchEnabled = false;
|
webSearchEnabled = false;
|
||||||
imageGenerationEnabled = 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())) {
|
if (chatIdProp && (await loadChat())) {
|
||||||
await tick();
|
await tick();
|
||||||
loading = false;
|
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);
|
window.setTimeout(() => scrollToBottom(), 0);
|
||||||
const chatInput = document.getElementById('chat-input');
|
const chatInput = document.getElementById('chat-input');
|
||||||
chatInput?.focus();
|
chatInput?.focus();
|
||||||
@ -416,9 +418,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (localStorage.getItem(`chat-input-${chatIdProp}`)) {
|
if (localStorage.getItem(`chat-input${chatIdProp ? `-${chatIdProp}` : ''}`)) {
|
||||||
try {
|
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;
|
prompt = input.prompt;
|
||||||
files = input.files;
|
files = input.files;
|
||||||
selectedToolIds = input.selectedToolIds;
|
selectedToolIds = input.selectedToolIds;
|
||||||
@ -2040,6 +2045,7 @@
|
|||||||
{stopResponse}
|
{stopResponse}
|
||||||
{createMessagePair}
|
{createMessagePair}
|
||||||
onChange={(input) => {
|
onChange={(input) => {
|
||||||
|
console.log(input);
|
||||||
if (input.prompt !== null) {
|
if (input.prompt !== null) {
|
||||||
localStorage.setItem(`chat-input-${$chatId}`, JSON.stringify(input));
|
localStorage.setItem(`chat-input-${$chatId}`, JSON.stringify(input));
|
||||||
} else {
|
} else {
|
||||||
|
@ -89,7 +89,8 @@
|
|||||||
files,
|
files,
|
||||||
selectedToolIds,
|
selectedToolIds,
|
||||||
imageGenerationEnabled,
|
imageGenerationEnabled,
|
||||||
webSearchEnabled
|
webSearchEnabled,
|
||||||
|
codeInterpreterEnabled
|
||||||
});
|
});
|
||||||
|
|
||||||
let showTools = false;
|
let showTools = false;
|
||||||
|
@ -201,6 +201,14 @@
|
|||||||
{stopResponse}
|
{stopResponse}
|
||||||
{createMessagePair}
|
{createMessagePair}
|
||||||
placeholder={$i18n.t('How can I help you today?')}
|
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) => {
|
on:upload={(e) => {
|
||||||
dispatch('upload', e.detail);
|
dispatch('upload', e.detail);
|
||||||
}}
|
}}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
import Fuse from 'fuse.js';
|
import Fuse from 'fuse.js';
|
||||||
import Bolt from '$lib/components/icons/Bolt.svelte';
|
import Bolt from '$lib/components/icons/Bolt.svelte';
|
||||||
import { onMount, getContext, createEventDispatcher } from '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';
|
import { WEBUI_VERSION } from '$lib/constants';
|
||||||
|
|
||||||
const i18n = getContext('i18n');
|
const i18n = getContext('i18n');
|
||||||
@ -72,7 +72,9 @@
|
|||||||
<!-- Keine Vorschläge -->
|
<!-- Keine Vorschläge -->
|
||||||
|
|
||||||
<div
|
<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}
|
{$WEBUI_NAME} ‧ v{WEBUI_VERSION}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user