mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-20 18:02:11 +00:00
Add spacer above user messages (except first one)
This commit is contained in:
parent
0cceb346be
commit
f63ec78524
1 changed files with 13 additions and 0 deletions
|
|
@ -9,6 +9,7 @@ import {
|
||||||
ProcessTerminal,
|
ProcessTerminal,
|
||||||
type SelectItem,
|
type SelectItem,
|
||||||
SelectList,
|
SelectList,
|
||||||
|
Spacer,
|
||||||
Text,
|
Text,
|
||||||
TUI,
|
TUI,
|
||||||
} from "@mariozechner/pi-tui";
|
} from "@mariozechner/pi-tui";
|
||||||
|
|
@ -48,6 +49,9 @@ export class TuiRenderer {
|
||||||
// Thinking level selector
|
// Thinking level selector
|
||||||
private thinkingSelector: SelectList | null = null;
|
private thinkingSelector: SelectList | null = null;
|
||||||
|
|
||||||
|
// Track if this is the first user message (to skip spacer)
|
||||||
|
private isFirstUserMessage = true;
|
||||||
|
|
||||||
constructor(agent: Agent, version: string) {
|
constructor(agent: Agent, version: string) {
|
||||||
this.agent = agent;
|
this.agent = agent;
|
||||||
this.version = version;
|
this.version = version;
|
||||||
|
|
@ -288,6 +292,12 @@ export class TuiRenderer {
|
||||||
const textBlocks = userMsg.content.filter((c: any) => c.type === "text");
|
const textBlocks = userMsg.content.filter((c: any) => c.type === "text");
|
||||||
const textContent = textBlocks.map((c: any) => c.text).join("");
|
const textContent = textBlocks.map((c: any) => c.text).join("");
|
||||||
if (textContent) {
|
if (textContent) {
|
||||||
|
// Add spacer before user message (except first one)
|
||||||
|
if (!this.isFirstUserMessage) {
|
||||||
|
this.chatContainer.addChild(new Spacer(1));
|
||||||
|
}
|
||||||
|
this.isFirstUserMessage = false;
|
||||||
|
|
||||||
// User messages with dark gray background
|
// User messages with dark gray background
|
||||||
this.chatContainer.addChild(new Markdown(textContent, undefined, undefined, { r: 52, g: 53, b: 65 }));
|
this.chatContainer.addChild(new Markdown(textContent, undefined, undefined, { r: 52, g: 53, b: 65 }));
|
||||||
}
|
}
|
||||||
|
|
@ -378,6 +388,9 @@ export class TuiRenderer {
|
||||||
{ usage: any; toolCallIds: Set<string>; remainingToolCallIds: Set<string> }
|
{ usage: any; toolCallIds: Set<string>; remainingToolCallIds: Set<string> }
|
||||||
>();
|
>();
|
||||||
|
|
||||||
|
// Reset first user message flag for initial render
|
||||||
|
this.isFirstUserMessage = true;
|
||||||
|
|
||||||
// First pass: identify assistant messages with tool calls
|
// First pass: identify assistant messages with tool calls
|
||||||
for (let i = 0; i < state.messages.length; i++) {
|
for (let i = 0; i < state.messages.length; i++) {
|
||||||
const message = state.messages[i];
|
const message = state.messages[i];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue