diff --git a/packages/pi-coding-agent/src/modes/interactive/components/assistant-message.ts b/packages/pi-coding-agent/src/modes/interactive/components/assistant-message.ts index c558b7cfc..3d5177492 100644 --- a/packages/pi-coding-agent/src/modes/interactive/components/assistant-message.ts +++ b/packages/pi-coding-agent/src/modes/interactive/components/assistant-message.ts @@ -54,6 +54,7 @@ export class AssistantMessageComponent extends Container { const hasVisibleContent = message.content.some( (c) => (c.type === "text" && c.text.trim()) || (c.type === "thinking" && c.thinking.trim()), ); + const hasTextContent = message.content.some((c) => c.type === "text" && c.text.trim().length > 0); if (hasVisibleContent) { this.contentContainer.addChild(new Spacer(1)); @@ -81,12 +82,15 @@ export class AssistantMessageComponent extends Container { } } else { // Thinking traces in thinkingText color, italic - this.contentContainer.addChild( - new Markdown(content.thinking.trim(), 1, 0, this.markdownTheme, { - color: (text: string) => theme.fg("thinkingText", text), - italic: true, - }), - ); + const thinkingMarkdown = new Markdown(content.thinking.trim(), 1, 0, this.markdownTheme, { + color: (text: string) => theme.fg("thinkingText", text), + italic: true, + }); + // Keep assistant text/questions visible even when thinking traces are long. + if (hasTextContent) { + thinkingMarkdown.maxLines = 8; + } + this.contentContainer.addChild(thinkingMarkdown); if (hasVisibleContentAfter) { this.contentContainer.addChild(new Spacer(1)); }