mirror of
https://github.com/open-webui/open-webui
synced 2024-12-29 07:12:07 +00:00
enh: temporary chat shortcut
This commit is contained in:
parent
c192475528
commit
19663e539a
@ -97,7 +97,7 @@
|
|||||||
banners.set(await getBanners(localStorage.token));
|
banners.set(await getBanners(localStorage.token));
|
||||||
tools.set(await getTools(localStorage.token));
|
tools.set(await getTools(localStorage.token));
|
||||||
|
|
||||||
document.addEventListener('keydown', function (event) {
|
document.addEventListener('keydown', async function (event) {
|
||||||
const isCtrlPressed = event.ctrlKey || event.metaKey; // metaKey is for Cmd key on Mac
|
const isCtrlPressed = event.ctrlKey || event.metaKey; // metaKey is for Cmd key on Mac
|
||||||
// Check if the Shift key is pressed
|
// Check if the Shift key is pressed
|
||||||
const isShiftPressed = event.shiftKey;
|
const isShiftPressed = event.shiftKey;
|
||||||
@ -164,6 +164,18 @@
|
|||||||
console.log('showShortcuts');
|
console.log('showShortcuts');
|
||||||
document.getElementById('show-shortcuts-button')?.click();
|
document.getElementById('show-shortcuts-button')?.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if Ctrl + Shift + ' is pressed
|
||||||
|
if (isCtrlPressed && isShiftPressed && event.key.toLowerCase() === `'`) {
|
||||||
|
event.preventDefault();
|
||||||
|
console.log('temporaryChat');
|
||||||
|
temporaryChatEnabled.set(!$temporaryChatEnabled);
|
||||||
|
await goto('/');
|
||||||
|
const newChatButton = document.getElementById('new-chat-button');
|
||||||
|
setTimeout(() => {
|
||||||
|
newChatButton?.click();
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if ($user.role === 'admin' && ($settings?.showChangelog ?? true)) {
|
if ($user.role === 'admin' && ($settings?.showChangelog ?? true)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user