diff --git a/site/src/pages/AgentsPage/components/AgentDetail/ConversationTimeline.stories.tsx b/site/src/pages/AgentsPage/components/AgentDetail/ConversationTimeline.stories.tsx index e6354e3493..9986a63714 100644 --- a/site/src/pages/AgentsPage/components/AgentDetail/ConversationTimeline.stories.tsx +++ b/site/src/pages/AgentsPage/components/AgentDetail/ConversationTimeline.stories.tsx @@ -299,6 +299,42 @@ export const UserMessageWithTextAttachmentOnly: Story = { }, }; +/** Visual regression: text and image attachments render at the same height. */ +export const UserMessageWithMixedAttachments: Story = { + args: { + ...defaultArgs, + parsedMessages: parseMessagesWithMergedTools([ + { + ...baseMessage, + id: 1, + role: "user", + content: [ + { type: "text", text: "Here is a screenshot and some context" }, + { + type: "file", + media_type: "image/png", + data: TEST_PNG_B64, + }, + { + type: "file", + file_id: "storybook-test-text", + media_type: "text/plain", + }, + ], + }, + ]), + }, + play: async ({ canvasElement }) => { + const canvas = within(canvasElement); + const images = canvas.getAllByRole("img", { name: "Attached image" }); + expect(images).toHaveLength(1); + const textButtons = await canvas.findAllByRole("button", { + name: "View text attachment", + }); + expect(textButtons).toHaveLength(1); + }, +}; + /** Text-only messages must not produce spurious image thumbnails. */ export const UserMessageTextOnly: Story = { args: { diff --git a/site/src/pages/AgentsPage/components/AgentDetail/ConversationTimeline.tsx b/site/src/pages/AgentsPage/components/AgentDetail/ConversationTimeline.tsx index 55432f1916..3d470ff083 100644 --- a/site/src/pages/AgentsPage/components/AgentDetail/ConversationTimeline.tsx +++ b/site/src/pages/AgentsPage/components/AgentDetail/ConversationTimeline.tsx @@ -123,20 +123,26 @@ const SmoothedResponse: FC<{ const InlineTextAttachmentButton: FC<{ content: string; onPreview?: (content: string) => void; -}> = ({ content, onPreview }) => { + isPlaceholder?: boolean; +}> = ({ content, onPreview, isPlaceholder }) => { return ( ); @@ -156,6 +162,7 @@ const TextAttachmentButton: FC<{ return ( { if (content !== null) { onPreview?.(content);