diff --git a/.changeset/nasty-drinks-smell.md b/.changeset/nasty-drinks-smell.md new file mode 100644 index 000000000..740414ed9 --- /dev/null +++ b/.changeset/nasty-drinks-smell.md @@ -0,0 +1,5 @@ +--- +"gitbook": patch +--- + +Fix custom assistant keyboard shortcut diff --git a/packages/gitbook/src/components/AIChat/AIChat.tsx b/packages/gitbook/src/components/AIChat/AIChat.tsx index 3192636f6..325c19416 100644 --- a/packages/gitbook/src/components/AIChat/AIChat.tsx +++ b/packages/gitbook/src/components/AIChat/AIChat.tsx @@ -46,17 +46,6 @@ export function AIChat(props: { trademark: boolean }) { } }, [chat.opened]); - useHotkeys( - 'mod+i', - (e) => { - e.preventDefault(); - chatController.open(); - }, - { - enableOnFormTags: true, - } - ); - useHotkeys( 'esc', () => { diff --git a/packages/gitbook/src/components/AIChat/AIChatButton.tsx b/packages/gitbook/src/components/AIChat/AIChatButton.tsx index e7d7ba4c7..733a3d23e 100644 --- a/packages/gitbook/src/components/AIChat/AIChatButton.tsx +++ b/packages/gitbook/src/components/AIChat/AIChatButton.tsx @@ -12,8 +12,9 @@ import { KeyboardShortcut } from '../primitives/KeyboardShortcut'; export function AIChatButton(props: { assistant: Assistant; showLabel?: boolean; + withShortcut?: boolean; }) { - const { assistant, showLabel = true } = props; + const { assistant, showLabel = true, withShortcut = true } = props; const language = useLanguage(); return ( @@ -27,7 +28,12 @@ export function AIChatButton(props: { label={