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): after clearing the history, new chat will report an error (#11549)

akumatus3bf3068650a9
diff --git a/packages/frontend/core/src/blocksuite/ai/chat-panel/index.ts b/packages/frontend/core/src/blocksuite/ai/chat-panel/index.ts
index 146331259f..132807866d 100644
--- a/packages/frontend/core/src/blocksuite/ai/chat-panel/index.ts
+++ b/packages/frontend/core/src/blocksuite/ai/chat-panel/index.ts
@@ -408,7 +408,6 @@ export class ChatPanel extends SignalWatcher(
.doc=${this.doc}
.getSessionId=${this._getSessionId}
.createSessionId=${this._createSessionId}
- .createChatSessionId=${this._createSessionId}
.chatContextValue=${this.chatContextValue}
.updateContext=${this.updateContext}
.updateEmbeddingProgress=${this._updateEmbeddingProgress}
diff --git a/packages/frontend/core/src/blocksuite/ai/components/ai-chat-composer/ai-chat-composer.ts b/packages/frontend/core/src/blocksuite/ai/components/ai-chat-composer/ai-chat-composer.ts
index ff8c2cd62d..43f18be5f0 100644
--- a/packages/frontend/core/src/blocksuite/ai/components/ai-chat-composer/ai-chat-composer.ts
+++ b/packages/frontend/core/src/blocksuite/ai/components/ai-chat-composer/ai-chat-composer.ts
@@ -58,9 +58,6 @@ export class AIChatComposer extends SignalWatcher(
@property({ attribute: false })
accessor createSessionId!: () => Promise<string | undefined>;
- @property({ attribute: false })
- accessor createChatSessionId!: () => Promise<string | undefined>;
-
@property({ attribute: false })
accessor chatContextValue!: AIChatInputContext;
@@ -123,7 +120,7 @@ export class AIChatComposer extends SignalWatcher(
.host=${this.host}
.chips=${this.chips}
.getSessionId=${this.getSessionId}
- .createSessionId=${this.createChatSessionId}
+ .createSessionId=${this.createSessionId}
.getContextId=${this._getContextId}
.chatContextValue=${this.chatContextValue}
.updateContext=${this.updateContext}
diff --git a/packages/frontend/core/src/blocksuite/ai/peek-view/chat-block-peek-view.ts b/packages/frontend/core/src/blocksuite/ai/peek-view/chat-block-peek-view.ts
index fcfde665bc..14a4552f6a 100644
--- a/packages/frontend/core/src/blocksuite/ai/peek-view/chat-block-peek-view.ts
+++ b/packages/frontend/core/src/blocksuite/ai/peek-view/chat-block-peek-view.ts
@@ -141,14 +141,10 @@ export class AIChatBlockPeekView extends LitElement {
};
private readonly _getSessionId = async () => {
- return this._sessionId;
+ return this._forkSessionId ?? this._sessionId;
};
private readonly _createSessionId = async () => {
- return this._sessionId;
- };
-
- private readonly _createForkSessionId = async () => {
if (this._forkSessionId) {
return this._forkSessionId;
}
@@ -506,7 +502,6 @@ export class AIChatBlockPeekView extends LitElement {
.doc=${this.host.doc}
.getSessionId=${this._getSessionId}
.createSessionId=${this._createSessionId}
- .createChatSessionId=${this._createForkSessionId}
.chatContextValue=${chatContext}
.updateContext=${updateContext}
.onHistoryCleared=${this._onHistoryCleared}