mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-20 18:02:11 +00:00
Refactor TUI into proper components
- Create UserMessageComponent - handles user messages with spacing - Create AssistantMessageComponent - handles complete assistant messages - Create ThinkingSelectorComponent - wraps selector with borders - Add setSelectedIndex to SelectList for preselecting current level - Simplify tui-renderer by using dedicated components - Much cleaner architecture - each message type is now a component
This commit is contained in:
parent
e2649341f0
commit
741add4411
5 changed files with 158 additions and 99 deletions
23
packages/coding-agent/src/tui/user-message.ts
Normal file
23
packages/coding-agent/src/tui/user-message.ts
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import { Container, Markdown, Spacer } from "@mariozechner/pi-tui";
|
||||
|
||||
/**
|
||||
* Component that renders a user message
|
||||
*/
|
||||
export class UserMessageComponent extends Container {
|
||||
private spacer: Spacer | null = null;
|
||||
private markdown: Markdown;
|
||||
|
||||
constructor(text: string, isFirst: boolean) {
|
||||
super();
|
||||
|
||||
// Add spacer before user message (except first one)
|
||||
if (!isFirst) {
|
||||
this.spacer = new Spacer(1);
|
||||
this.addChild(this.spacer);
|
||||
}
|
||||
|
||||
// User messages with dark gray background
|
||||
this.markdown = new Markdown(text, undefined, undefined, { r: 52, g: 53, b: 65 });
|
||||
this.addChild(this.markdown);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue