feat(webui): add new chat keyboard shortcut
Add Cmd/Ctrl+Shift+O shortcut to start a new chat, matching the convention used by ChatGPT, Claude.ai, and Gemini. Addresses #4178 Signed-off-by: axelray-dev <110029405+axelray-dev@users.noreply.github.com>
This commit is contained in:
+8
-1
@@ -1007,6 +1007,13 @@ function Shell({
|
||||
useEffect(() => {
|
||||
const handleKeyDown = (event: globalThis.KeyboardEvent) => {
|
||||
if (event.defaultPrevented) return;
|
||||
const commandShiftO =
|
||||
(event.metaKey || event.ctrlKey) && event.shiftKey && !event.altKey;
|
||||
if (commandShiftO && event.key.toLowerCase() === "o") {
|
||||
event.preventDefault();
|
||||
onNewChat();
|
||||
return;
|
||||
}
|
||||
const plainCommandK =
|
||||
(event.metaKey || event.ctrlKey) && !event.altKey && !event.shiftKey;
|
||||
if (!plainCommandK) return;
|
||||
@@ -1017,7 +1024,7 @@ function Shell({
|
||||
|
||||
window.addEventListener("keydown", handleKeyDown);
|
||||
return () => window.removeEventListener("keydown", handleKeyDown);
|
||||
}, [onOpenSessionSearch]);
|
||||
}, [onNewChat, onOpenSessionSearch]);
|
||||
|
||||
const onSelectSearchResult = useCallback(
|
||||
(key: string) => {
|
||||
|
||||
Reference in New Issue
Block a user