Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions apps/web/src/components/chat/ChatComposer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ import {
import { useOpenPrLink } from "~/lib/openPullRequestLink";
import {
collectInlineContextIds,
stripInlineContextReferences,
type ComposerContextReference,
ensureInlineContextReferences,
formatInlineContextReference,
Expand Down Expand Up @@ -5410,8 +5411,13 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
);
const storedImages = nextImages.filter((image) => storedImageIds.has(image.id));
if (storedImages.length > 0) {
insertedAny =
insertAttachmentReferences(storedImages.map(imageContextReference)) || insertedAny;
// An image landing in an empty composer lives on the shelf (thumbnail)
// with no inline chip; once the composer holds prose, pasted images get
// chips like every other attachment.
if (stripInlineContextReferences(promptRef.current).trim().length > 0) {
insertedAny =
insertAttachmentReferences(storedImages.map(imageContextReference)) || insertedAny;
}
}
// Only failures are reported here. Success must not pass `null`: by
// now other work (a failed send, an overlapping paste) may have set a
Expand All @@ -5437,6 +5443,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
/**
* Chips for freshly attached files land at the caret; when the editor cannot take
* input (approval, pending questions) they are appended so the file is never invisible.
* Images skip this when the composer holds no prose: the shelf thumbnail is enough.
*/
const insertAttachmentReferences = (
references: ReadonlyArray<ComposerContextReference>,
Expand Down
Loading