From c2d8c23f13c9b91b8e8cd855f5506a5fc9b95cb6 Mon Sep 17 00:00:00 2001 From: akumatus Date: Thu, 9 Jan 2025 10:56:24 +0000 Subject: [PATCH] fix(core): update chat session after session created or reused (#9613) For an existing AI chat session, the prompt will not be updated when the front-end calls the `createChatSession` gql interface. Thus update it manually here. In the future, the architecture needs to be adjusted to support multiple LLM model calls in one chat session. --- .../blocksuite/block-suite-editor/ai/setup-provider.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/frontend/core/src/components/blocksuite/block-suite-editor/ai/setup-provider.tsx b/packages/frontend/core/src/components/blocksuite/block-suite-editor/ai/setup-provider.tsx index ed56943ed0..123c82553d 100644 --- a/packages/frontend/core/src/components/blocksuite/block-suite-editor/ai/setup-provider.tsx +++ b/packages/frontend/core/src/components/blocksuite/block-suite-editor/ai/setup-provider.tsx @@ -80,6 +80,12 @@ export function setupAIProvider( workspaceId, docId, promptName, + }).then(sessionId => { + return updateChatSession({ + sessionId, + client, + promptName, + }); }), promptName, });