mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix(site): add padding below thinking-only assistant messages (#24140)
closes CODAGT-122
Add a spacer div that renders only when an assistant message lacks the
action bar, matching the height the action bar would provide.
> 🤖 Generated by Coder Agents
This commit is contained in:
+43
@@ -896,3 +896,46 @@ export const MultiAssistantTurnCopyButton: Story = {
|
||||
expect(actions).toHaveLength(2);
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Regression: thinking-only assistant messages must have consistent
|
||||
* bottom spacing before the next user bubble. A spacer div fills the
|
||||
* gap that would normally come from the invisible action bar.
|
||||
*/
|
||||
export const ThinkingOnlyAssistantSpacing: Story = {
|
||||
args: {
|
||||
...defaultArgs,
|
||||
parsedMessages: buildMessages([
|
||||
{
|
||||
...baseMessage,
|
||||
id: 1,
|
||||
role: "user",
|
||||
content: [{ type: "text", text: "Explain this code" }],
|
||||
},
|
||||
{
|
||||
...baseMessage,
|
||||
id: 2,
|
||||
role: "assistant",
|
||||
content: [
|
||||
{
|
||||
type: "reasoning",
|
||||
text: "Let me think about this step by step. The user wants me to explain the code they shared.",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
...baseMessage,
|
||||
id: 3,
|
||||
role: "user",
|
||||
content: [{ type: "text", text: "Any progress?" }],
|
||||
},
|
||||
]),
|
||||
},
|
||||
play: async ({ canvasElement }) => {
|
||||
const canvas = within(canvasElement);
|
||||
// The thinking-only assistant message has no action bar, but
|
||||
// it should still have visible text and a spacer element.
|
||||
expect(canvas.getByText("Explain this code")).toBeInTheDocument();
|
||||
expect(canvas.getByText("Any progress?")).toBeInTheDocument();
|
||||
},
|
||||
};
|
||||
|
||||
@@ -669,6 +669,13 @@ const ChatMessageItem = memo<{
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
{/* Spacer for assistant messages without an action bar
|
||||
(e.g. thinking-only) so they have consistent bottom
|
||||
padding before the next user bubble. */}
|
||||
{!hideActions &&
|
||||
!isUser &&
|
||||
!hasCopyableContent &&
|
||||
Boolean(parsed.reasoning) && <div className="min-h-6" />}
|
||||
{previewImage && (
|
||||
<ImageLightbox
|
||||
src={previewImage}
|
||||
|
||||
Reference in New Issue
Block a user