复用资源引用的统一内容映射

让 Lexical 草稿读取复用 chatReferenceToContentPart,避免引用字段映射分叉。
This commit is contained in:
2026-09-15 17:22:55 +08:00
parent 2c623bb577
commit f213987f9a
@@ -80,6 +80,7 @@ import {
type ChatComposerDraft,
type ChatReference,
chatReferenceListKey,
chatReferenceToContentPart,
currentIterationVersionAssets,
dedupeChatReferences,
refreshResourceReference,
@@ -202,25 +203,7 @@ function collectDraftParts(
if ($isResourceReferenceNode(node)) {
textParts.push(`@${node.__reference.label}`);
references.push(node.__reference);
content.push(
node.__reference.type === 'resource'
? {
type: 'agc_resource_reference',
resourceId: node.__reference.resourceId,
}
: {
type: 'agc_runtime_region_reference',
label: node.__reference.label,
runId: node.__reference.runId,
versionId: node.__reference.versionId,
elementTag: node.__reference.elementTag,
elementRole: node.__reference.elementRole,
text: node.__reference.text,
width: node.__reference.width,
height: node.__reference.height,
resourceIds: node.__reference.resourceIds,
},
);
content.push(chatReferenceToContentPart(node.__reference));
return;
}
if ($isElementNode(node)) {