From a543b75cf7ecc09f526d9d882d894c21e09ae1d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Tue, 15 Sep 2026 17:24:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8B=86=E5=BC=80=E8=81=8A=E5=A4=A9=E8=8D=89?= =?UTF-8?q?=E7=A8=BF=E5=86=85=E5=AE=B9=E5=88=86=E6=94=AF=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将资源草稿转换的三种回退路径改为显式分支,保持现有优先级并提升可读性。 --- .../project-workspace/resourceReferences.ts | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/apps/ai-game-creator-shell/src/features/project-workspace/resourceReferences.ts b/apps/ai-game-creator-shell/src/features/project-workspace/resourceReferences.ts index c08fba49a..2b6ac4d06 100644 --- a/apps/ai-game-creator-shell/src/features/project-workspace/resourceReferences.ts +++ b/apps/ai-game-creator-shell/src/features/project-workspace/resourceReferences.ts @@ -118,18 +118,21 @@ export function chatComposerDraftToDirectCodexUserItem( draft: ChatComposerDraft, id: string, ): DirectCodexUserItem { - const content = draft.content?.length - ? draft.content - : draft.references.length > 0 - ? [ - ...(draft.text - ? [{ type: 'input_text' as const, text: draft.text }] - : []), - ...draft.references.map(chatReferenceToContentPart), - ] - : draft.text + let content: DirectCodexUserContentPart[]; + if (draft.content?.length) { + content = draft.content; + } else if (draft.references.length > 0) { + content = [ + ...(draft.text ? [{ type: 'input_text' as const, text: draft.text }] - : []; + : []), + ...draft.references.map(chatReferenceToContentPart), + ]; + } else { + content = draft.text + ? [{ type: 'input_text' as const, text: draft.text }] + : []; + } return { type: 'message', role: 'user',