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.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
fix: cannot clean chat panel histories (#7673)
donteatfriedricee1e1b29afbb3
diff --git a/packages/frontend/core/src/blocksuite/presets/ai/chat-panel/index.ts b/packages/frontend/core/src/blocksuite/presets/ai/chat-panel/index.tsindex 8f92e279b6..b18bf39325 100644--- a/packages/frontend/core/src/blocksuite/presets/ai/chat-panel/index.ts+++ b/packages/frontend/core/src/blocksuite/presets/ai/chat-panel/index.ts@@ -97,8 +97,6 @@ export class ChatPanel extends WithDisposable(ShadowlessElement) {private readonly _chatMessages: Ref<ChatPanelMessages> =createRef<ChatPanelMessages>();- private _chatSessionId = '';-private _resettingCounter = 0;private readonly _resetItems = debounce(() => {@@ -119,7 +117,6 @@ export class ChatPanel extends WithDisposable(ShadowlessElement) {if (histories?.at(-1)) {const history = histories.at(-1);if (!history) return;- this._chatSessionId = history.sessionId;this.chatContextValue.chatSessionId = history.sessionId;items.push(...history.messages);AIProvider.LAST_ROOT_SESSION_ID = history.sessionId;@@ -175,13 +172,14 @@ export class ChatPanel extends WithDisposable(ShadowlessElement) {})) {await AIProvider.histories?.cleanup(this.doc.collection.id, this.doc.id, [- this._chatSessionId,+ this.chatContextValue.chatSessionId ?? '',...(this.chatContextValue.items.filter(item => 'sessionId' in item) as ChatAction[]).map(item => item.sessionId),]);+ this.chatContextValue.chatSessionId = null;notification.toast('History cleared');this._resetItems();}