mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 15:02:32 +00:00
Fix read/write tool output formatting
- Remove code fences (```) from read output - show raw content - Show first 10 lines instead of 5 for read - Only show line count for write if > 10 lines - Remove indentation from read output - Cleaner, more minimal tool output display
This commit is contained in:
parent
4fa09814bd
commit
10520a8c41
3 changed files with 57 additions and 8 deletions
|
|
@ -1,4 +1,30 @@
|
|||
Hello, World!
|
||||
This line has been edited!
|
||||
This is line three.
|
||||
Goodbye, World!
|
||||
The Quick Brown Fox and the Lazy Dog
|
||||
=====================================
|
||||
|
||||
Once upon a time, in a forest clearing, there lived a remarkably quick brown fox.
|
||||
This fox was known throughout the woodland for its incredible speed and agility.
|
||||
|
||||
Every morning, the fox would race through the trees, leaping over logs and streams.
|
||||
The other animals watched in awe as it darted past them in a blur of russet fur.
|
||||
|
||||
Near the edge of the clearing, there also lived a very lazy dog.
|
||||
This dog preferred napping in the warm sunshine to any sort of adventure.
|
||||
|
||||
One day, the fox challenged the dog to a race across the meadow.
|
||||
The dog yawned and declined, saying "Why rush when you can rest?"
|
||||
|
||||
The fox laughed and zipped away, exploring distant hills and valleys.
|
||||
The dog simply rolled over and continued its peaceful slumber.
|
||||
|
||||
As the sun set, the fox returned, exhausted from its day of running.
|
||||
The dog opened one eye and wagged its tail contentedly.
|
||||
|
||||
"I've seen the whole world today!" exclaimed the tired fox proudly.
|
||||
"And I've enjoyed every moment right here," replied the lazy dog.
|
||||
|
||||
Sometimes speed and adventure bring joy to life's journey.
|
||||
Other times, stillness and contentment are the greatest treasures.
|
||||
|
||||
Both the quick fox and the lazy dog lived happily in their own ways.
|
||||
|
||||
The End.
|
||||
|
|
|
|||
|
|
@ -64,15 +64,14 @@ export class ToolExecutionComponent extends Container {
|
|||
text = `**read** \`${path}\``;
|
||||
if (this.result) {
|
||||
const lines = this.result.output.split("\n");
|
||||
const maxLines = 5;
|
||||
const maxLines = 10;
|
||||
const displayLines = lines.slice(0, maxLines);
|
||||
const remaining = lines.length - maxLines;
|
||||
|
||||
text += "\n```\n" + displayLines.join("\n");
|
||||
text += "\n" + displayLines.join("\n");
|
||||
if (remaining > 0) {
|
||||
text += `\n... (${remaining} more lines)`;
|
||||
}
|
||||
text += "\n```";
|
||||
|
||||
if (this.result.isError) {
|
||||
text += " ❌";
|
||||
|
|
@ -82,8 +81,12 @@ export class ToolExecutionComponent extends Container {
|
|||
const path = this.args.path || "";
|
||||
const content = this.args.content || "";
|
||||
const lines = content.split("\n");
|
||||
text = `**write** \`${path}\` (${lines.length} lines)`;
|
||||
text = `**write** \`${path}\``;
|
||||
if (this.result) {
|
||||
const totalLines = lines.length;
|
||||
if (totalLines > 10) {
|
||||
text += ` (${totalLines} lines)`;
|
||||
}
|
||||
text += this.result.isError ? " ❌" : " ✓";
|
||||
}
|
||||
} else if (this.toolName === "edit") {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue