diff --git a/packages/frontend/core/src/blocksuite/presets/ai/_common/components/chat-action-list.ts b/packages/frontend/core/src/blocksuite/presets/ai/_common/components/chat-action-list.ts index 70bde3011..fe713c8d6 100644 --- a/packages/frontend/core/src/blocksuite/presets/ai/_common/components/chat-action-list.ts +++ b/packages/frontend/core/src/blocksuite/presets/ai/_common/components/chat-action-list.ts @@ -83,7 +83,7 @@ export class ChatActionList extends LitElement { accessor content: string = ''; @property({ attribute: false }) - accessor chatSessionId: string | undefined = undefined; + accessor getSessionId!: () => Promise; @property({ attribute: false }) accessor messageId: string | undefined = undefined; @@ -100,7 +100,7 @@ export class ChatActionList extends LitElement { return nothing; } - const { host, content, chatSessionId, messageId, layoutDirection } = this; + const { host, content, messageId, layoutDirection } = this; const classes = classMap({ 'actions-container': true, horizontal: layoutDirection === 'horizontal', @@ -138,11 +138,12 @@ export class ChatActionList extends LitElement { blocks: this._currentBlockSelections, images: this._currentImageSelections, }; + const sessionId = await this.getSessionId(); const success = await action.handler( host, content, currentSelections, - chatSessionId, + sessionId, messageId ); if (success) { diff --git a/packages/frontend/core/src/blocksuite/presets/ai/_common/components/copy-more.ts b/packages/frontend/core/src/blocksuite/presets/ai/_common/components/copy-more.ts index 82fea7067..851054289 100644 --- a/packages/frontend/core/src/blocksuite/presets/ai/_common/components/copy-more.ts +++ b/packages/frontend/core/src/blocksuite/presets/ai/_common/components/copy-more.ts @@ -115,7 +115,7 @@ export class ChatCopyMore extends WithDisposable(LitElement) { accessor content!: string; @property({ attribute: false }) - accessor chatSessionId: string | undefined = undefined; + accessor getSessionId!: () => Promise; @property({ attribute: false }) accessor messageId: string | undefined = undefined; @@ -162,7 +162,7 @@ export class ChatCopyMore extends WithDisposable(LitElement) { } override render() { - const { host, content, isLast, messageId, chatSessionId, actions } = this; + const { host, content, isLast, messageId, actions } = this; return html`