From 37c7477068a472329db492422ac9a09e6a19df48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Sat, 19 Sep 2026 23:05:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E8=8D=89=E7=A8=BF=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E6=8A=8A=E9=99=84=E4=BB=B6=E5=BC=95=E7=94=A8=E8=AF=AF?= =?UTF-8?q?=E5=9B=9E=E8=AF=BB=E6=88=90=20$=E5=90=8D=E7=A7=B0=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - apps/ai-game-creator-shell/src/features/project-workspace/ResourceReferenceInput.tsx 的 readDraftFromNodes 改为按 part.type 显式分支:附件引用回读为 @名称,技能引用回读为 $名称,未知类型返回空串 - 该 text 会被受控同步比较(对照 directCodexContentToPromptText 展开的 value),附件口径不一致会让受控输入区每次都判定草稿变化而重建编辑器 - 顺带去掉该处嵌套三元,与 resourceReferences.ts 的渲染口径对齐 --- .../ResourceReferenceInput.tsx | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/apps/ai-game-creator-shell/src/features/project-workspace/ResourceReferenceInput.tsx b/apps/ai-game-creator-shell/src/features/project-workspace/ResourceReferenceInput.tsx index 155e0ac41..c7f03be38 100644 --- a/apps/ai-game-creator-shell/src/features/project-workspace/ResourceReferenceInput.tsx +++ b/apps/ai-game-creator-shell/src/features/project-workspace/ResourceReferenceInput.tsx @@ -275,15 +275,17 @@ function readDraftFromNodes(): ChatComposerDraft { ]), ); const text = projection.content - .map((part) => - part.type === 'input_text' - ? part.text - : part.type === 'agc_resource_reference' - ? (labels.get(part.resourceId) ?? `@${part.resourceId}`) - : part.type === 'agc_runtime_region_reference' - ? `@${part.label}` - : `$${part.name}`, - ) + // 与 directCodexContentToPromptText 保持同一口径:附件引用是 `@名称`,不是 `$名称`。 + .map((part) => { + if (part.type === 'input_text') return part.text; + if (part.type === 'agc_resource_reference') { + return labels.get(part.resourceId) ?? `@${part.resourceId}`; + } + if (part.type === 'agc_runtime_region_reference') return `@${part.label}`; + if (part.type === 'agc_attachment_reference') return `@${part.name}`; + if (part.type === 'agc_skill_reference') return `$${part.name}`; + return ''; + }) .join('') .trim(); return {