mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-18 04:43:55 +00:00
refac
This commit is contained in:
parent
a8dd8dbf98
commit
9cf48f4fb0
4 changed files with 18 additions and 2 deletions
|
|
@ -2278,7 +2278,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
if (e.key === 'Escape') {
|
||||
if (
|
||||
$settings?.keyboardShortcuts !== false &&
|
||||
matchKeybinding(e) === Shortcut.CLEAR_INPUT_SELECTIONS
|
||||
) {
|
||||
console.log('Escape');
|
||||
atSelectedModel = undefined;
|
||||
selectedToolIds = [];
|
||||
|
|
|
|||
|
|
@ -76,7 +76,8 @@
|
|||
};
|
||||
|
||||
const getConflict = (id: Shortcut, chord: string): Shortcut | null => {
|
||||
if (!isConfigurableShortcut(id) || !chord) return null;
|
||||
// Modals always close on Esc on their own, so sharing it is not a conflict
|
||||
if (!isConfigurableShortcut(id) || !chord || chord === 'Escape') return null;
|
||||
for (const [otherId, otherChord] of Object.entries($keybindings)) {
|
||||
if (otherId !== id && otherChord === chord) return otherId as Shortcut;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3391,6 +3391,8 @@
|
|||
"settings.personal.shortcuts.addPrompt.label": "Add Custom Prompt",
|
||||
"settings.personal.shortcuts.allowToolCall.label": "Allow Tool Call",
|
||||
"settings.personal.shortcuts.attachFile.label": "Attach File From Knowledge",
|
||||
"settings.personal.shortcuts.clearInputSelections.description": "Remove the model override, deselect tools and filters, and turn off web search, image generation, and code interpreter. Only active when the chat input is in focus.",
|
||||
"settings.personal.shortcuts.clearInputSelections.label": "Clear Input Selections",
|
||||
"settings.personal.shortcuts.closeModal.label": "Close Modal",
|
||||
"settings.personal.shortcuts.command.label": "Command",
|
||||
"settings.personal.shortcuts.copyLastCodeBlock.label": "Copy Last Code Block",
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ export enum Shortcut {
|
|||
|
||||
//Input
|
||||
FOCUS_INPUT = 'focusInput',
|
||||
CLEAR_INPUT_SELECTIONS = 'clearInputSelections',
|
||||
ACCEPT_AUTOCOMPLETE = 'acceptAutocomplete',
|
||||
PREVENT_FILE_CREATION = 'preventFileCreation',
|
||||
NAVIGATE_PROMPT_HISTORY_UP = 'navigatePromptHistoryUp',
|
||||
|
|
@ -71,6 +72,7 @@ export const CONFIGURABLE_SHORTCUTS = [
|
|||
Shortcut.TOGGLE_CONTROLS,
|
||||
Shortcut.CLOSE_MODAL,
|
||||
Shortcut.FOCUS_INPUT,
|
||||
Shortcut.CLEAR_INPUT_SELECTIONS,
|
||||
Shortcut.GENERATE_MESSAGE_PAIR,
|
||||
Shortcut.REGENERATE_RESPONSE,
|
||||
Shortcut.ALLOW_TOOL_CALL,
|
||||
|
|
@ -97,6 +99,7 @@ export const DEFAULT_KEYBINDINGS: KeybindingsMap = {
|
|||
[Shortcut.TOGGLE_CONTROLS]: '',
|
||||
[Shortcut.CLOSE_MODAL]: 'Escape',
|
||||
[Shortcut.FOCUS_INPUT]: 'Shift+Escape',
|
||||
[Shortcut.CLEAR_INPUT_SELECTIONS]: 'Escape',
|
||||
[Shortcut.GENERATE_MESSAGE_PAIR]: 'Cmd+Shift+Enter',
|
||||
[Shortcut.REGENERATE_RESPONSE]: 'Cmd+R',
|
||||
[Shortcut.ALLOW_TOOL_CALL]: 'Cmd+Alt+Enter',
|
||||
|
|
@ -300,6 +303,13 @@ export const shortcuts: ShortcutRegistry = {
|
|||
category: 'Input',
|
||||
configurable: true
|
||||
},
|
||||
[Shortcut.CLEAR_INPUT_SELECTIONS]: {
|
||||
name: (t) => t('settings.personal.shortcuts.clearInputSelections.label'),
|
||||
keys: ['Escape'],
|
||||
category: 'Input',
|
||||
configurable: true,
|
||||
tooltip: 'settings.personal.shortcuts.clearInputSelections.description'
|
||||
},
|
||||
[Shortcut.ACCEPT_AUTOCOMPLETE]: {
|
||||
name: (t) => t('settings.personal.shortcuts.acceptAutocomplete.label'),
|
||||
keys: ['Tab'],
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue