@@ -121,21 +121,30 @@ export class AssistantMessageComponent extends Container {
|
||||
}
|
||||
}
|
||||
|
||||
// Check if aborted - show after partial content
|
||||
// But only if there are no tool calls (tool execution components will show the error)
|
||||
// Check if incomplete/failed - show after partial content.
|
||||
// For aborted/error tool calls, tool execution components show the error.
|
||||
// Length stops can happen before a tool call is complete, so surface them here too.
|
||||
const hasToolCalls = message.content.some((c) => c.type === "toolCall");
|
||||
this.hasToolCalls = hasToolCalls;
|
||||
if (!hasToolCalls) {
|
||||
if (message.stopReason === "length") {
|
||||
this.contentContainer.addChild(new Spacer(1));
|
||||
this.contentContainer.addChild(
|
||||
new Text(
|
||||
theme.fg(
|
||||
"error",
|
||||
"Error: Model stopped because it reached the maximum output token limit. The response may be incomplete.",
|
||||
),
|
||||
1,
|
||||
0,
|
||||
),
|
||||
);
|
||||
} else if (!hasToolCalls) {
|
||||
if (message.stopReason === "aborted") {
|
||||
const abortMessage =
|
||||
message.errorMessage && message.errorMessage !== "Request was aborted"
|
||||
? message.errorMessage
|
||||
: "Operation aborted";
|
||||
if (hasVisibleContent) {
|
||||
this.contentContainer.addChild(new Spacer(1));
|
||||
} else {
|
||||
this.contentContainer.addChild(new Spacer(1));
|
||||
}
|
||||
this.contentContainer.addChild(new Spacer(1));
|
||||
this.contentContainer.addChild(new Text(theme.fg("error", abortMessage), 1, 0));
|
||||
} else if (message.stopReason === "error") {
|
||||
const errorMsg = message.errorMessage || "Unknown error";
|
||||
|
||||
Reference in New Issue
Block a user