From 029a98c4350e2e6a3c5e919de664a5bbbbd8d8ba Mon Sep 17 00:00:00 2001 From: akumatus Date: Wed, 21 May 2025 07:05:07 +0000 Subject: [PATCH] fix(core): chat block opens and throws an error (#12407) ## Summary by CodeRabbit - **Bug Fixes** - Improved stability of the AI chat input to prevent errors when certain configuration options are missing. --- .../blocksuite/ai/components/ai-chat-input/ai-chat-input.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/frontend/core/src/blocksuite/ai/components/ai-chat-input/ai-chat-input.ts b/packages/frontend/core/src/blocksuite/ai/components/ai-chat-input/ai-chat-input.ts index 01dc8dfddc..f09b4a75f4 100644 --- a/packages/frontend/core/src/blocksuite/ai/components/ai-chat-input/ai-chat-input.ts +++ b/packages/frontend/core/src/blocksuite/ai/components/ai-chat-input/ai-chat-input.ts @@ -274,7 +274,7 @@ export class AIChatInput extends SignalWatcher(WithDisposable(LitElement)) { accessor reasoningConfig!: AIReasoningConfig; @property({ attribute: false }) - accessor modelSwitchConfig!: AIModelSwitchConfig; + accessor modelSwitchConfig: AIModelSwitchConfig | undefined = undefined; @property({ attribute: false }) accessor docDisplayConfig!: DocDisplayConfig; @@ -394,7 +394,7 @@ export class AIChatInput extends SignalWatcher(WithDisposable(LitElement)) { ${ImageIcon()} Upload - ${this.modelSwitchConfig.visible.value + ${this.modelSwitchConfig?.visible.value ? html`