@@ -331,7 +331,10 @@ import {
331331import { ComposerPromptLengthValidation } from "./ComposerPromptLengthValidation" ;
332332import { PierreEntryIcon } from "./PierreEntryIcon" ;
333333import { pendingDraftWork } from "./pendingDraftWork" ;
334- import { importComposerThreadAttachment } from "./composerThreadImport" ;
334+ import {
335+ importComposerThreadAttachment ,
336+ remainingComposerAttachmentSlots ,
337+ } from "./composerThreadImport" ;
335338import { isTimelineScrollTarget } from "./timelineScrollTarget" ;
336339import {
337340 createComposerScrollGestureState ,
@@ -4746,11 +4749,9 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
47464749 }
47474750 appendedFiles . push ( restored ) ;
47484751 }
4749- const capacity = Math . max (
4750- 0 ,
4751- PROVIDER_SEND_TURN_MAX_ATTACHMENTS -
4752- composerImagesRef . current . length -
4753- composerFilesNow . length ,
4752+ const capacity = remainingComposerAttachmentSlots (
4753+ composerImagesRef . current . length + composerFilesNow . length ,
4754+ pendingThreadImportsRef . current . get ( composerTargetKey ( composerDraftTarget ) ) ?? 0 ,
47544755 ) ;
47554756 // Marker replacements reuse their marker's slot; only appended files
47564757 // consume capacity.
@@ -4805,12 +4806,9 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
48054806 ( image ) => `${ image . mimeType } \0${ image . sizeBytes } \0${ image . name } ` ,
48064807 ) ,
48074808 ) ;
4808- const capacity = Math . max (
4809- 0 ,
4810- PROVIDER_SEND_TURN_MAX_ATTACHMENTS -
4811- composerImagesRef . current . length -
4812- composerFilesRef . current . length -
4813- restoredFileCount ,
4809+ const capacity = remainingComposerAttachmentSlots (
4810+ composerImagesRef . current . length + composerFilesRef . current . length + restoredFileCount ,
4811+ pendingThreadImportsRef . current . get ( composerTargetKey ( composerDraftTarget ) ) ?? 0 ,
48144812 ) ;
48154813 const pending = entry . attachments . filter (
48164814 ( attachment ) =>
0 commit comments