From f4f84d279332a0fee539b722dcce54c05028cdcc Mon Sep 17 00:00:00 2001 From: regischen Date: Fri, 28 Jun 2024 14:43:45 +0800 Subject: [PATCH] fix: click continue with ai not work (#7374) --- .../presets/ai/chat-panel/chat-cards.ts | 5 +++ .../ai/chat-panel/chat-panel-messages.ts | 33 ++++++++++--------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/packages/frontend/core/src/blocksuite/presets/ai/chat-panel/chat-cards.ts b/packages/frontend/core/src/blocksuite/presets/ai/chat-panel/chat-cards.ts index bb260ff1ab..2326d5914f 100644 --- a/packages/frontend/core/src/blocksuite/presets/ai/chat-panel/chat-cards.ts +++ b/packages/frontend/core/src/blocksuite/presets/ai/chat-panel/chat-cards.ts @@ -119,6 +119,9 @@ export class ChatCards extends WithDisposable(LitElement) { @property({ attribute: false }) accessor temporaryParams: AIChatParams | null = null; + @property({ attribute: false }) + accessor isEmpty!: boolean; + @state() accessor cards: Card[] = []; @@ -508,6 +511,8 @@ export class ChatCards extends WithDisposable(LitElement) { } protected override render() { + if (!this.isEmpty) return nothing; + return repeat( this.cards, card => card.id, diff --git a/packages/frontend/core/src/blocksuite/presets/ai/chat-panel/chat-panel-messages.ts b/packages/frontend/core/src/blocksuite/presets/ai/chat-panel/chat-panel-messages.ts index 063e93b163..5af2592f15 100644 --- a/packages/frontend/core/src/blocksuite/presets/ai/chat-panel/chat-panel-messages.ts +++ b/packages/frontend/core/src/blocksuite/presets/ai/chat-panel/chat-panel-messages.ts @@ -265,23 +265,18 @@ export class ChatPanelMessages extends WithDisposable(ShadowlessElement) { > ${items.length === 0 ? html`
- ${AffineIcon( - isLoading - ? 'var(--affine-icon-secondary)' - : 'var(--affine-primary-color)' - )} -
- ${this.isLoading - ? 'AFFiNE AI is loading history...' - : 'What can I help you with?'} -
- ${this._renderAIOnboarding()} + ${AffineIcon( + isLoading + ? 'var(--affine-icon-secondary)' + : 'var(--affine-primary-color)' + )} +
+ ${this.isLoading + ? 'AFFiNE AI is loading history...' + : 'What can I help you with?'}
- ` + ${this._renderAIOnboarding()} +
` : repeat(filteredItems, (item, index) => { const isLast = index === filteredItems.length - 1; return html`
@@ -289,6 +284,12 @@ export class ChatPanelMessages extends WithDisposable(ShadowlessElement) {
${this.renderItem(item, isLast)}
`; })} + ${this.showDownIndicator ? html`
this.scrollToDown()}>