Skip to content

Commit 7a97095

Browse files
committed
fixes padding
1 parent 3499181 commit 7a97095

3 files changed

Lines changed: 13 additions & 8 deletions

File tree

clients/tui/components/chat.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,18 +141,18 @@ export const chat = (
141141
const renderMessage = (message: ChatMessage): string[] => {
142142
const renderedContent = markdown({
143143
content: message.content,
144-
paddingX: 1,
144+
paddingX: 0,
145145
paddingY: 0,
146146
});
147147

148148
if (message.role === 'You') {
149-
const box = new Box(1, 1, (text) => pc.bgBlack(text));
149+
const box = new Box(2, 1, (text) => pc.bgBlack(text));
150150
box.addChild(renderedContent);
151151
return box.render(width);
152152
}
153153

154154
if (message.role === 'Greg') {
155-
const box = new Box(1, 1, (text) => text);
155+
const box = new Box(2, 1, (text) => text);
156156
box.addChild(renderedContent);
157157
return box.render(width);
158158
}
@@ -161,12 +161,12 @@ export const chat = (
161161
if (!showToolMessages) {
162162
return [];
163163
}
164-
const box = new Box(1, 0, (text) => pc.dim(text));
164+
const box = new Box(2, 1, (text) => pc.dim(text));
165165
box.addChild(renderedContent);
166166
return box.render(width);
167167
}
168168

169-
const box = new Box(1, 0, (text) => text);
169+
const box = new Box(2, 1, (text) => text);
170170
box.addChild(new Text(pc.dim(`System: ${message.content}`)));
171171
return box.render(width);
172172
};
@@ -177,7 +177,12 @@ export const chat = (
177177
renderedLines.push(...renderMessage(message));
178178
}
179179

180-
if (showSpinner) renderedLines.push(...loader.render(width));
180+
const lastIsYou = messages[messages.length - 1]?.role === 'You';
181+
182+
if (showSpinner) {
183+
if (lastIsYou) renderedLines.push('');
184+
renderedLines.push(` ${loader.render(width - 1)[1]}`);
185+
}
181186
return [...renderedLines, ...editor.render(width)];
182187
},
183188
handleInput: (input) => {

clients/tui/components/tui.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export function tui(): TUI {
2323
// };
2424

2525
const stopTui = (reason?: unknown): void => {
26-
console.error(reason);
26+
if (reason) console.error(reason);
2727
if (hasStoppedTui) {
2828
return;
2929
}

clients/tui/tui.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ export async function start({
323323
function helpMessage(): string {
324324
const memoryInfo = getMemoryInfo(config);
325325
return ` Controls:
326-
Ctrl+O - Toggle tool messages
326+
Ctrl+O - Toggle tool results
327327
328328
Usage Legend:
329329
↑ fresh input tokens

0 commit comments

Comments
 (0)