88import {
99 type ComposerContextReference ,
1010 collectInlineContextIds ,
11- stripInlineContextReferences ,
1211} from "~/lib/composerContextReferences" ;
1312import {
1413 type ComposerFileAttachment ,
@@ -53,8 +52,8 @@ import {
5352} from "./preparingComposerImages" ;
5453
5554/**
56- * Takes files into the draft: validates and reserves slots, compresses images, inserts
57- * their inline chips, folds large pastes into text attachments , and confirms removing a referenced image.
55+ * Takes files into the draft: validates and reserves slots, compresses images, folds large
56+ * pastes into inline references , and confirms removing a referenced image.
5857 */
5958export function useComposerAttachmentIntake ( input : {
6059 readonly activeThreadId : ChatComposerProps [ "activeThreadId" ] ;
@@ -63,7 +62,6 @@ export function useComposerAttachmentIntake(input: {
6362 readonly pendingUserInputs : ReadonlyArray < PendingUserInput > ;
6463 readonly supportsQuestionAttachments : boolean ;
6564 readonly isLiteralPendingAnswer : boolean ;
66- readonly projectSelectionRequired : boolean ;
6765 readonly questionAttachmentTarget : DraftId | null ;
6866 readonly attachmentTargetKey : string ;
6967 readonly fileStagingLimit : number | null ;
@@ -90,7 +88,6 @@ export function useComposerAttachmentIntake(input: {
9088 pendingUserInputs,
9189 supportsQuestionAttachments,
9290 isLiteralPendingAnswer,
93- projectSelectionRequired,
9491 questionAttachmentTarget,
9592 attachmentTargetKey,
9693 fileStagingLimit,
@@ -138,11 +135,7 @@ export function useComposerAttachmentIntake(input: {
138135 // to the thread the paste happened in.
139136 const threadId = activeThreadId ;
140137 const imageAttachmentsGetChips =
141- ! options ?. skipImageInlineChip &&
142- ( options ?. selection !== undefined ||
143- pendingUserInputs . length > 0 ||
144- projectSelectionRequired ||
145- stripInlineContextReferences ( promptRef . current ) . trim ( ) . length > 0 ) ;
138+ ! options ?. skipImageInlineChip && options ?. selection !== undefined ;
146139
147140 // Validation happens synchronously so concurrent pastes see each other:
148141 // accepted files reserve their attachment slots (as preparing images)
@@ -221,7 +214,9 @@ export function useComposerAttachmentIntake(input: {
221214 if ( acceptedFiles . length > 0 ) {
222215 const storedIds = new Set ( addComposerFilesToDraft ( acceptedFiles ) ) ;
223216 const storedFiles = acceptedFiles . filter ( ( file ) => storedIds . has ( file . id ) ) ;
224- if ( storedFiles . length > 0 ) {
217+ // Explicit text replacements keep their inline reference. Picked and dropped files
218+ // live in the attachment rows above the prompt without inserting extra prompt text.
219+ if ( storedFiles . length > 0 && options ?. selection !== undefined ) {
225220 insertedAny = insertAttachmentReferences (
226221 storedFiles . map ( fileContextReference ) ,
227222 options ?. selection ,
0 commit comments