import React, { useState } from "react"; import { LLMContent } from "../types"; interface BrowserConsoleLogsToolProps { toolName: string; // to distinguish between recent and clear toolInput?: unknown; isRunning?: boolean; toolResult?: LLMContent[]; hasError?: boolean; executionTime?: string; } function BrowserConsoleLogsTool({ toolName, isRunning, toolResult, hasError, executionTime, }: BrowserConsoleLogsToolProps) { const [isExpanded, setIsExpanded] = useState(false); // Extract output from toolResult const output = toolResult && toolResult.length > 0 && toolResult[0].Text ? toolResult[0].Text : ""; // Determine display text based on tool name and state const getDisplayText = () => { if (isRunning) { return toolName === "browser_console_clear_logs" ? "clearing console..." : "fetching console logs..."; } return toolName === "browser_console_clear_logs" ? "clear console" : "console logs"; }; const displayText = getDisplayText(); const isComplete = !isRunning && toolResult !== undefined; return (
{output || "(no output)"}