mirror of
https://github.com/open-webui/open-webui
synced 2025-06-15 10:51:13 +00:00
refac: temporary chat behaviour
This commit is contained in:
parent
be85f7cc35
commit
ba69c751ca
@ -155,12 +155,14 @@
|
|||||||
localStorage.getItem(`chat-input${chatIdProp ? `-${chatIdProp}` : ''}`)
|
localStorage.getItem(`chat-input${chatIdProp ? `-${chatIdProp}` : ''}`)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (!$temporaryChatEnabled) {
|
||||||
prompt = input.prompt;
|
prompt = input.prompt;
|
||||||
files = input.files;
|
files = input.files;
|
||||||
selectedToolIds = input.selectedToolIds;
|
selectedToolIds = input.selectedToolIds;
|
||||||
webSearchEnabled = input.webSearchEnabled;
|
webSearchEnabled = input.webSearchEnabled;
|
||||||
imageGenerationEnabled = input.imageGenerationEnabled;
|
imageGenerationEnabled = input.imageGenerationEnabled;
|
||||||
codeInterpreterEnabled = input.codeInterpreterEnabled;
|
codeInterpreterEnabled = input.codeInterpreterEnabled;
|
||||||
|
}
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -419,25 +421,27 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (localStorage.getItem(`chat-input${chatIdProp ? `-${chatIdProp}` : ''}`)) {
|
if (localStorage.getItem(`chat-input${chatIdProp ? `-${chatIdProp}` : ''}`)) {
|
||||||
try {
|
|
||||||
const input = JSON.parse(
|
|
||||||
localStorage.getItem(`chat-input${chatIdProp ? `-${chatIdProp}` : ''}`)
|
|
||||||
);
|
|
||||||
console.log('chat-input', input);
|
|
||||||
prompt = input.prompt;
|
|
||||||
files = input.files;
|
|
||||||
selectedToolIds = input.selectedToolIds;
|
|
||||||
webSearchEnabled = input.webSearchEnabled;
|
|
||||||
imageGenerationEnabled = input.imageGenerationEnabled;
|
|
||||||
codeInterpreterEnabled = input.codeInterpreterEnabled;
|
|
||||||
} catch (e) {
|
|
||||||
prompt = '';
|
prompt = '';
|
||||||
files = [];
|
files = [];
|
||||||
selectedToolIds = [];
|
selectedToolIds = [];
|
||||||
webSearchEnabled = false;
|
webSearchEnabled = false;
|
||||||
imageGenerationEnabled = false;
|
imageGenerationEnabled = false;
|
||||||
codeInterpreterEnabled = false;
|
codeInterpreterEnabled = false;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const input = JSON.parse(
|
||||||
|
localStorage.getItem(`chat-input${chatIdProp ? `-${chatIdProp}` : ''}`)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!$temporaryChatEnabled) {
|
||||||
|
prompt = input.prompt;
|
||||||
|
files = input.files;
|
||||||
|
selectedToolIds = input.selectedToolIds;
|
||||||
|
webSearchEnabled = input.webSearchEnabled;
|
||||||
|
imageGenerationEnabled = input.imageGenerationEnabled;
|
||||||
|
codeInterpreterEnabled = input.codeInterpreterEnabled;
|
||||||
}
|
}
|
||||||
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!chatIdProp) {
|
if (!chatIdProp) {
|
||||||
|
@ -196,7 +196,7 @@
|
|||||||
showChangelog.set($settings?.version !== $config.version);
|
showChangelog.set($settings?.version !== $config.version);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user?.permissions?.chat?.temporary ?? true) {
|
if ($user?.role === 'admin' || ($user?.permissions?.chat?.temporary ?? true)) {
|
||||||
if ($page.url.searchParams.get('temporary-chat') === 'true') {
|
if ($page.url.searchParams.get('temporary-chat') === 'true') {
|
||||||
temporaryChatEnabled.set(true);
|
temporaryChatEnabled.set(true);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user