@@ -7,6 +7,7 @@ import { theme } from "../theme/theme.js";
|
||||
|
||||
export interface ToolExecutionOptions {
|
||||
showImages?: boolean;
|
||||
imageWidthCells?: number;
|
||||
}
|
||||
|
||||
export class ToolExecutionComponent extends Container {
|
||||
@@ -23,6 +24,7 @@ export class ToolExecutionComponent extends Container {
|
||||
private args: any;
|
||||
private expanded = false;
|
||||
private showImages: boolean;
|
||||
private imageWidthCells: number;
|
||||
private isPartial = true;
|
||||
private toolDefinition?: ToolDefinition<any, any>;
|
||||
private builtInToolDefinition?: ToolDefinition<any, any>;
|
||||
@@ -54,6 +56,7 @@ export class ToolExecutionComponent extends Container {
|
||||
this.toolDefinition = toolDefinition;
|
||||
this.builtInToolDefinition = createAllToolDefinitions(cwd)[toolName as ToolName];
|
||||
this.showImages = options.showImages ?? true;
|
||||
this.imageWidthCells = options.imageWidthCells ?? 60;
|
||||
this.ui = ui;
|
||||
this.cwd = cwd;
|
||||
|
||||
@@ -205,6 +208,11 @@ export class ToolExecutionComponent extends Container {
|
||||
this.updateDisplay();
|
||||
}
|
||||
|
||||
setImageWidthCells(width: number): void {
|
||||
this.imageWidthCells = Math.max(1, Math.floor(width));
|
||||
this.updateDisplay();
|
||||
}
|
||||
|
||||
override invalidate(): void {
|
||||
super.invalidate();
|
||||
this.updateDisplay();
|
||||
@@ -312,7 +320,7 @@ export class ToolExecutionComponent extends Container {
|
||||
imageData,
|
||||
imageMimeType,
|
||||
{ fallbackColor: (s: string) => theme.fg("toolOutput", s) },
|
||||
{ maxWidthCells: 60 },
|
||||
{ maxWidthCells: this.imageWidthCells },
|
||||
);
|
||||
this.imageComponents.push(imageComponent);
|
||||
this.addChild(imageComponent);
|
||||
|
||||
Reference in New Issue
Block a user