diff --git a/app/components/chat.tsx b/app/components/chat.tsx index 8bba19588..345b22360 100644 --- a/app/components/chat.tsx +++ b/app/components/chat.tsx @@ -1563,7 +1563,7 @@ function _Chat() { // 展示快捷键 command + / else if ((event.metaKey || event.ctrlKey) && event.key === "/") { event.preventDefault(); - setShowShortcutKeyModal(true); + setShowShortcutKeyModal(!showShortcutKeyModal); } }; @@ -1572,7 +1572,7 @@ function _Chat() { return () => { window.removeEventListener("keydown", handleKeyDown); }; - }, [messages, chatStore, navigate]); + }, [messages, chatStore, navigate, showShortcutKeyModal]); return (
diff --git a/app/locales/index.ts b/app/locales/index.ts index 6bf4e41d2..4ca16b332 100644 --- a/app/locales/index.ts +++ b/app/locales/index.ts @@ -85,7 +85,9 @@ merge(fallbackLang, targetLang); export default fallbackLang as LocaleType; function getItem(key: string) { - return localStorage.getItem(key); + if (typeof window !== "undefined") { + return localStorage.getItem(key); + } } function setItem(key: string, value: string) {