fix: revert showing error UI
This commit is contained in:
parent
20dcc41de0
commit
40cb8025a2
2 changed files with 2 additions and 49 deletions
|
|
@ -1,12 +1,5 @@
|
|||
import { Tool, ToolCallState } from "core";
|
||||
import {
|
||||
ComponentType,
|
||||
useContext,
|
||||
useEffect,
|
||||
useMemo,
|
||||
useRef,
|
||||
useState,
|
||||
} from "react";
|
||||
import { ComponentType, useContext, useMemo, useState } from "react";
|
||||
import {
|
||||
ContextItemsPeekItem,
|
||||
openContextItem,
|
||||
|
|
@ -39,26 +32,6 @@ export function SimpleToolCallUI({
|
|||
|
||||
const [open, setOpen] = useState(false);
|
||||
const [showingArgs, setShowingArgs] = useState(false);
|
||||
const hasAutoOpenedError = useRef(false);
|
||||
|
||||
// Auto-open error details when tool call fails
|
||||
useEffect(() => {
|
||||
if (
|
||||
toolCallState.status === "errored" &&
|
||||
shownContextItems.length > 0 &&
|
||||
!hasAutoOpenedError.current
|
||||
) {
|
||||
hasAutoOpenedError.current = true;
|
||||
|
||||
// For single error items, open directly
|
||||
if (shownContextItems.length === 1) {
|
||||
openContextItem(shownContextItems[0], ideMessenger);
|
||||
} else {
|
||||
// For multiple items, expand the view
|
||||
setOpen(true);
|
||||
}
|
||||
}
|
||||
}, [toolCallState.status, shownContextItems, ideMessenger]);
|
||||
|
||||
const args: [string, any][] = useMemo(() => {
|
||||
return Object.entries(toolCallState.parsedArgs);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
import { Tool, ToolCallState } from "core";
|
||||
import { useContext, useEffect, useMemo, useRef, useState } from "react";
|
||||
import { renderContextItems } from "core/util/messageContent";
|
||||
import { IdeMessengerContext } from "../../../context/IdeMessenger";
|
||||
import { useMemo, useState } from "react";
|
||||
import { ArgsItems, ArgsToggleIcon } from "./ToolCallArgs";
|
||||
import { ToolCallStatusMessage } from "./ToolCallStatusMessage";
|
||||
import { ToolTruncateHistoryIcon } from "./ToolTruncateHistoryIcon";
|
||||
|
|
@ -21,30 +19,12 @@ export function ToolCallDisplay({
|
|||
icon,
|
||||
historyIndex,
|
||||
}: ToolCallDisplayProps) {
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
const [argsExpanded, setArgsExpanded] = useState(false);
|
||||
const hasAutoOpenedError = useRef(false);
|
||||
|
||||
const args: [string, any][] = useMemo(() => {
|
||||
return Object.entries(toolCallState.parsedArgs);
|
||||
}, [toolCallState.parsedArgs]);
|
||||
|
||||
// Auto-open error details when tool call fails
|
||||
useEffect(() => {
|
||||
if (
|
||||
toolCallState.status === "errored" &&
|
||||
toolCallState.output &&
|
||||
toolCallState.output.length > 0 &&
|
||||
!hasAutoOpenedError.current
|
||||
) {
|
||||
hasAutoOpenedError.current = true;
|
||||
ideMessenger.post("showVirtualFile", {
|
||||
name: "Tool Call Error",
|
||||
content: renderContextItems(toolCallState.output),
|
||||
});
|
||||
}
|
||||
}, [toolCallState.status, toolCallState.output, ideMessenger]);
|
||||
|
||||
return (
|
||||
<div className="flex flex-col justify-center px-4">
|
||||
<div className="mb-2 flex flex-col">
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue