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): add synced doc block content to ai context (#7312)

L-Sun532a62898925
diff --git a/packages/frontend/core/src/blocksuite/presets/ai/utils/markdown-utils.ts b/packages/frontend/core/src/blocksuite/presets/ai/utils/markdown-utils.ts
index 7bfc3951ad..844041bef7 100644
--- a/packages/frontend/core/src/blocksuite/presets/ai/utils/markdown-utils.ts
+++ b/packages/frontend/core/src/blocksuite/presets/ai/utils/markdown-utils.ts
@@ -5,6 +5,7 @@ import type {
} from '@blocksuite/block-std';
import {
defaultImageProxyMiddleware,
+ embedSyncedDocMiddleware,
MarkdownAdapter,
MixTextAdapter,
pasteMiddleware,
@@ -76,7 +77,7 @@ export async function getContentFromSlice(
) {
const job = new Job({
collection: host.std.doc.collection,
- middlewares: [titleMiddleware],
+ middlewares: [titleMiddleware, embedSyncedDocMiddleware('content')],
});
const snapshot = await job.sliceToSnapshot(slice);
processTextInSnapshot(snapshot, host);