mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-20 02:03:16 +00:00
Improve edit tool diff display with context-aware rendering
- Add generateDiffString() function in edit tool to create unified diffs with line numbers and 4 lines of context - Store only the formatted diff string in tool result details instead of full file contents - Update tool-execution renderer to parse and colorize the diff string - Filter out message_update events from session saving to prevent verbose session files - Add markdown nested list and table rendering tests
This commit is contained in:
parent
2f0f0a913e
commit
c75f53f6f2
7 changed files with 584 additions and 64 deletions
|
|
@ -288,15 +288,7 @@ export class TuiRenderer {
|
|||
// Update the existing tool component with the result
|
||||
const component = this.pendingTools.get(event.toolCallId);
|
||||
if (component) {
|
||||
// Update the component with the result
|
||||
const content =
|
||||
typeof event.result === "string"
|
||||
? [{ type: "text" as const, text: event.result }]
|
||||
: event.result.content;
|
||||
component.updateResult({
|
||||
content,
|
||||
isError: event.isError,
|
||||
});
|
||||
component.updateResult(event.result);
|
||||
this.pendingTools.delete(event.toolCallId);
|
||||
this.ui.requestRender();
|
||||
}
|
||||
|
|
@ -388,16 +380,16 @@ export class TuiRenderer {
|
|||
}
|
||||
}
|
||||
} else if (message.role === "toolResult") {
|
||||
// Update existing tool execution component with results
|
||||
const toolResultMsg = message as any;
|
||||
const component = this.pendingTools.get(toolResultMsg.toolCallId);
|
||||
// Update existing tool execution component with results ;
|
||||
const component = this.pendingTools.get(message.toolCallId);
|
||||
if (component) {
|
||||
component.updateResult({
|
||||
content: toolResultMsg.content,
|
||||
isError: toolResultMsg.isError,
|
||||
content: message.content,
|
||||
details: message.details,
|
||||
isError: message.isError,
|
||||
});
|
||||
// Remove from pending map since it's complete
|
||||
this.pendingTools.delete(toolResultMsg.toolCallId);
|
||||
this.pendingTools.delete(message.toolCallId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue