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',