Skip to content

Commit 6d84f9d

Browse files
committed
chore: update
1 parent 5b5dea1 commit 6d84f9d

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

app/components/chat.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,9 @@ export function ShortcutKeyModal(props: { onClose: () => void }) {
876876
},
877877
{
878878
title: Locale.Chat.ShortcutKey.clearContext,
879-
keys: isMac ? ["⌘", "Shift", "k"] : ["Ctrl", "Shift", "k"],
879+
keys: isMac
880+
? ["⌘", "Shift", "Backspace"]
881+
: ["Ctrl", "Shift", "Backspace"],
880882
},
881883
];
882884
return (
@@ -1513,7 +1515,7 @@ function _Chat() {
15131515
const [showShortcutKeyModal, setShowShortcutKeyModal] = useState(false);
15141516

15151517
useEffect(() => {
1516-
const handleKeyDown = (event: any) => {
1518+
const handleKeyDown = (event: KeyboardEvent) => {
15171519
// 打开新聊天 command + shift + o
15181520
if (
15191521
(event.metaKey || event.ctrlKey) &&
@@ -1564,11 +1566,11 @@ function _Chat() {
15641566
event.preventDefault();
15651567
setShowShortcutKeyModal(true);
15661568
}
1567-
// 清除上下文 command + shift + delete
1569+
// 清除上下文 command + shift + Backspace
15681570
else if (
15691571
(event.metaKey || event.ctrlKey) &&
15701572
event.shiftKey &&
1571-
event.key.toLowerCase() === "k"
1573+
event.key.toLowerCase() === "backspace"
15721574
) {
15731575
event.preventDefault();
15741576
chatStore.updateCurrentSession((session) => {
@@ -1582,10 +1584,10 @@ function _Chat() {
15821584
}
15831585
};
15841586

1585-
window.addEventListener("keydown", handleKeyDown);
1587+
document.addEventListener("keydown", handleKeyDown);
15861588

15871589
return () => {
1588-
window.removeEventListener("keydown", handleKeyDown);
1590+
document.removeEventListener("keydown", handleKeyDown);
15891591
};
15901592
}, [messages, chatStore, navigate]);
15911593

0 commit comments

Comments
 (0)