mirror of
https://github.com/open-webui/open-webui
synced 2024-11-16 05:24:02 +00:00
Merge pull request #431 from ollama-webui/regenerate-shortcut
feat: regenerate keyboard shortcut
This commit is contained in:
commit
d71e3c9d82
@ -442,6 +442,20 @@
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
on:keydown={async (e) => {
|
on:keydown={async (e) => {
|
||||||
|
const isCtrlPressed = e.ctrlKey || e.metaKey; // metaKey is for Cmd key on Mac
|
||||||
|
|
||||||
|
// Check if Ctrl + R is pressed
|
||||||
|
if (prompt === '' && isCtrlPressed && e.key.toLowerCase() === 'r') {
|
||||||
|
e.preventDefault();
|
||||||
|
console.log('regenerate');
|
||||||
|
|
||||||
|
const regenerateButton = [
|
||||||
|
...document.getElementsByClassName('regenerate-response-button')
|
||||||
|
]?.at(-1);
|
||||||
|
|
||||||
|
regenerateButton?.click();
|
||||||
|
}
|
||||||
|
|
||||||
if (prompt === '' && e.key == 'ArrowUp') {
|
if (prompt === '' && e.key == 'ArrowUp') {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
|
@ -508,7 +508,7 @@
|
|||||||
type="button"
|
type="button"
|
||||||
class="{isLastMessage
|
class="{isLastMessage
|
||||||
? 'visible'
|
? 'visible'
|
||||||
: 'invisible group-hover:visible'} p-1 rounded dark:hover:bg-gray-800 transition"
|
: 'invisible group-hover:visible'} p-1 rounded dark:hover:bg-gray-800 transition regenerate-response-button"
|
||||||
on:click={regenerateResponse}
|
on:click={regenerateResponse}
|
||||||
>
|
>
|
||||||
<svg
|
<svg
|
||||||
|
Loading…
Reference in New Issue
Block a user