mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-20 15:01:24 +00:00
fix(coding-agent): remove extra spacer before tool executions
This commit is contained in:
parent
c213cb5873
commit
4c91c803ff
2 changed files with 13 additions and 4 deletions
|
|
@ -2,6 +2,10 @@
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed extra spacing between thinking-only assistant content and subsequent tool execution blocks when assistant messages contain no text
|
||||||
|
|
||||||
## [0.52.6] - 2026-02-05
|
## [0.52.6] - 2026-02-05
|
||||||
|
|
||||||
### Breaking Changes
|
### Breaking Changes
|
||||||
|
|
|
||||||
|
|
@ -63,13 +63,16 @@ export class AssistantMessageComponent extends Container {
|
||||||
// Set paddingY=0 to avoid extra spacing before tool executions
|
// Set paddingY=0 to avoid extra spacing before tool executions
|
||||||
this.contentContainer.addChild(new Markdown(content.text.trim(), 1, 0, this.markdownTheme));
|
this.contentContainer.addChild(new Markdown(content.text.trim(), 1, 0, this.markdownTheme));
|
||||||
} else if (content.type === "thinking" && content.thinking.trim()) {
|
} else if (content.type === "thinking" && content.thinking.trim()) {
|
||||||
// Check if there's text content after this thinking block
|
// Add spacing only when another visible assistant content block follows.
|
||||||
const hasTextAfter = message.content.slice(i + 1).some((c) => c.type === "text" && c.text.trim());
|
// This avoids a superfluous blank line before separately-rendered tool execution blocks.
|
||||||
|
const hasVisibleContentAfter = message.content
|
||||||
|
.slice(i + 1)
|
||||||
|
.some((c) => (c.type === "text" && c.text.trim()) || (c.type === "thinking" && c.thinking.trim()));
|
||||||
|
|
||||||
if (this.hideThinkingBlock) {
|
if (this.hideThinkingBlock) {
|
||||||
// Show static "Thinking..." label when hidden
|
// Show static "Thinking..." label when hidden
|
||||||
this.contentContainer.addChild(new Text(theme.italic(theme.fg("thinkingText", "Thinking...")), 1, 0));
|
this.contentContainer.addChild(new Text(theme.italic(theme.fg("thinkingText", "Thinking...")), 1, 0));
|
||||||
if (hasTextAfter) {
|
if (hasVisibleContentAfter) {
|
||||||
this.contentContainer.addChild(new Spacer(1));
|
this.contentContainer.addChild(new Spacer(1));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -80,7 +83,9 @@ export class AssistantMessageComponent extends Container {
|
||||||
italic: true,
|
italic: true,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
this.contentContainer.addChild(new Spacer(1));
|
if (hasVisibleContentAfter) {
|
||||||
|
this.contentContainer.addChild(new Spacer(1));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue