Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix(core): ai chat panel content will be inconsistent when switching to journals (#9288)

akumatus6c0544b239b0
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 0510671eb0..cdea1d802c 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
@@ -255,13 +255,19 @@ export class ChatPanelMessages extends WithDisposable(ShadowlessElement) {
</div>
${this._renderAIOnboarding()}
</div> `
- : repeat(filteredItems, (item, index) => {
- const isLast = index === filteredItems.length - 1;
- return html`<div class="message">
- ${this.renderAvatar(item)}
- <div class="item-wrapper">${this.renderItem(item, isLast)}</div>
- </div>`;
- })}
+ : repeat(
+ filteredItems,
+ item => ('role' in item ? item.id : item.sessionId),
+ (item, index) => {
+ const isLast = index === filteredItems.length - 1;
+ return html`<div class="message">
+ ${this.renderAvatar(item)}
+ <div class="item-wrapper">
+ ${this.renderItem(item, isLast)}
+ </div>
+ </div>`;
+ }
+ )}
<chat-cards
.updateContext=${this.updateContext}
.host=${this.host}