fix(editor): add title to edgeless page block ai context (#12763)

Close [BS-3590](https://linear.app/affine-design/issue/BS-3590/page-block-的标题没有被作为上下文输入)
This commit is contained in:
L-Sun
2025-06-10 02:14:01 +00:00
parent 3c29f62224
commit e82c9d2ddc

View File

@@ -130,6 +130,12 @@ export async function getContentFromSelected(
}
);
const hasPageBlock = notes.find(note => note.isPageBlock());
const title =
hasPageBlock && host.std.store.meta?.title
? `# ${host.std.store.meta?.title}\n`
: '';
const noteContent = await getContentFromHubBlockModel(host, notes);
const edgelessTextContent = await getContentFromHubBlockModel(
host,
@@ -140,7 +146,7 @@ export async function getContentFromSelected(
embedSyncedDocs
);
return `${noteContent.join('\n')}
return `${title}${noteContent.join('\n')}
${edgelessTextContent.join('\n')}
${syncedDocsContent}
${texts.map(text => text.text.toString()).join('\n')}