This commit is contained in:
Timothy Jaeryang Baek 2025-05-07 02:00:10 +04:00
parent 19bf7289c1
commit 96618967bd

View File

@ -91,7 +91,7 @@
export let chatIdProp = ''; export let chatIdProp = '';
let loading = false; let loading = true;
const eventTarget = new EventTarget(); const eventTarget = new EventTarget();
let controlPane; let controlPane;
@ -160,8 +160,7 @@
selectedToolIds = input.selectedToolIds; selectedToolIds = input.selectedToolIds;
webSearchEnabled = input.webSearchEnabled; webSearchEnabled = input.webSearchEnabled;
imageGenerationEnabled = input.imageGenerationEnabled; imageGenerationEnabled = input.imageGenerationEnabled;
codeInterpreterEnabled = input.codeInterpreterEnabled;
console.log('chat-input', input);
} catch (e) {} } catch (e) {}
} }
@ -401,6 +400,7 @@
}; };
onMount(async () => { onMount(async () => {
loading = true;
console.log('mounted'); console.log('mounted');
window.addEventListener('message', onMessageHandler); window.addEventListener('message', onMessageHandler);
$socket?.on('chat-events', chatEventHandler); $socket?.on('chat-events', chatEventHandler);
@ -429,15 +429,20 @@
selectedToolIds = input.selectedToolIds; selectedToolIds = input.selectedToolIds;
webSearchEnabled = input.webSearchEnabled; webSearchEnabled = input.webSearchEnabled;
imageGenerationEnabled = input.imageGenerationEnabled; imageGenerationEnabled = input.imageGenerationEnabled;
codeInterpreterEnabled = input.codeInterpreterEnabled;
} catch (e) { } catch (e) {
prompt = ''; prompt = '';
files = []; files = [];
selectedToolIds = []; selectedToolIds = [];
webSearchEnabled = false; webSearchEnabled = false;
imageGenerationEnabled = false; imageGenerationEnabled = false;
codeInterpreterEnabled = false;
} }
} }
loading = false;
await tick();
showControls.subscribe(async (value) => { showControls.subscribe(async (value) => {
if (controlPane && !$mobile) { if (controlPane && !$mobile) {
try { try {
@ -2045,11 +2050,13 @@
{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 ? `-${$chatId}` : ''}`,
JSON.stringify(input)
);
} else { } else {
localStorage.removeItem(`chat-input-${$chatId}`); localStorage.removeItem(`chat-input${$chatId ? `-${$chatId}` : ''}`);
} }
}} }}
on:upload={async (e) => { on:upload={async (e) => {