diff --git a/gui/src/pages/gui/Chat.tsx b/gui/src/pages/gui/Chat.tsx index 75fb48c4b..c3e8ac512 100644 --- a/gui/src/pages/gui/Chat.tsx +++ b/gui/src/pages/gui/Chat.tsx @@ -333,17 +333,16 @@ export function Chat() { "assistant" && item.message.toolCalls && item.toolCallState ? ( -
+
{item.message.toolCalls?.map((toolCall, i) => { return ( -
- -
+ ); })}
diff --git a/gui/src/pages/gui/ToolCallDiv/SimpleToolCallUI.tsx b/gui/src/pages/gui/ToolCallDiv/SimpleToolCallUI.tsx index 3342eabda..07b7838a7 100644 --- a/gui/src/pages/gui/ToolCallDiv/SimpleToolCallUI.tsx +++ b/gui/src/pages/gui/ToolCallDiv/SimpleToolCallUI.tsx @@ -1,8 +1,8 @@ -import { ChevronDownIcon, ChevronRightIcon } from "@heroicons/react/24/outline"; +import { ChevronRightIcon } from "@heroicons/react/24/outline"; import { ContextItemWithId, Tool, ToolCallState } from "core"; import { ComponentType, useMemo, useState } from "react"; import { ContextItemsPeekItem } from "../../../components/mainInput/belowMainInput/ContextItemsPeek"; -import { ArgsItems } from "./ToolCallArgs"; +import { ArgsItems, ArgsToggleIcon } from "./ToolCallArgs"; import { ToolCallStatusMessage } from "./ToolCallStatusMessage"; interface SimpleToolCallUIProps { @@ -32,49 +32,35 @@ export function SimpleToolCallUI({ }, [toolCallState.parsedArgs]); return ( -
-
+
+
setOpen((prev) => !prev)} onMouseEnter={() => setIsHovered(true)} onMouseLeave={() => setIsHovered(false)} data-testid="context-items-peek" > -
+
{Icon && !isHovered && !open ? ( - + ) : ( - <> - - - + )}
- - - +
- {/*
- {args.length > 0 ? ( - - ) : null} -
*/} + {args.length > 0 ? ( + + ) : null}
)) ) : ( -
+
No tool call output
)} diff --git a/gui/src/pages/gui/ToolCallDiv/ToolCall.tsx b/gui/src/pages/gui/ToolCallDiv/ToolCall.tsx index 6f313236d..dcfd186c7 100644 --- a/gui/src/pages/gui/ToolCallDiv/ToolCall.tsx +++ b/gui/src/pages/gui/ToolCallDiv/ToolCall.tsx @@ -24,22 +24,20 @@ export function ToolCallDisplay({ return ( <> -
+
-
-
+
+
{icon}
{tool?.faviconUrl && ( )} -
- -
+
{!!args.length ? ( - - {/* {`{}`} */} +
{isShowing ? "Hide args" : "Show args"} @@ -52,11 +51,13 @@ export const ArgsItems = ({ args, isShowing }: ArgsItemsProps) => { } return ( -
+
{args.map(([key, value]) => (
{key}: - {value.toString()} + + {JSON.stringify(value)} +
))}
diff --git a/gui/src/pages/gui/ToolCallDiv/ToolCallStatusMessage.tsx b/gui/src/pages/gui/ToolCallDiv/ToolCallStatusMessage.tsx index 7a25a7605..40a5f06ef 100644 --- a/gui/src/pages/gui/ToolCallDiv/ToolCallStatusMessage.tsx +++ b/gui/src/pages/gui/ToolCallDiv/ToolCallStatusMessage.tsx @@ -1,7 +1,5 @@ import { Tool, ToolCallState } from "core"; import Mustache from "mustache"; -import { ReactNode } from "react"; -import { getFontSize } from "../../../util"; import { useFontSize } from "../../../components/ui/font"; interface ToolCallStatusMessageProps { @@ -16,35 +14,26 @@ export function ToolCallStatusMessage({ const fontSize = useFontSize(); if (!tool) return "Agent tool use"; - const defaultToolDescription = ( - <> - {tool.displayTitle ?? tool.function.name} tool - - ); + const toolName = tool.displayTitle ?? tool.function.name; + const defaultToolDescription = `${toolName} tool`; - const futureMessage = tool.wouldLikeTo ? ( - Mustache.render(tool.wouldLikeTo, toolCallState.parsedArgs) - ) : ( - <> - use the {defaultToolDescription} - - ); + const futureMessage: string = tool.wouldLikeTo + ? Mustache.render(tool.wouldLikeTo, toolCallState.parsedArgs) + : `use the ${defaultToolDescription}`; + // TODO go back and replace arg string values and tool names with tags + // to make them more readable let intro = ""; - let message: ReactNode = ""; + let message = ""; if ( toolCallState.status === "done" || (tool.isInstant && toolCallState.status === "calling") ) { intro = ""; - message = tool.hasAlready ? ( - Mustache.render(tool.hasAlready, toolCallState.parsedArgs) - ) : ( - <> - used the {defaultToolDescription} - - ); + message = tool.hasAlready + ? Mustache.render(tool.hasAlready, toolCallState.parsedArgs) + : `used the ${defaultToolDescription}`; } else if (toolCallState.status === "generating") { intro = "is generating output to"; message = futureMessage; @@ -53,13 +42,9 @@ export function ToolCallStatusMessage({ message = futureMessage; } else if (toolCallState.status === "calling") { intro = "is"; - message = tool.isCurrently ? ( - Mustache.render(tool.isCurrently, toolCallState.parsedArgs) - ) : ( - <> - calling the {defaultToolDescription} - - ); + message = tool.isCurrently + ? Mustache.render(tool.isCurrently, toolCallState.parsedArgs) + : `calling the ${defaultToolDescription}`; } else if ( toolCallState.status === "canceled" || toolCallState.status === "errored" @@ -68,8 +53,12 @@ export function ToolCallStatusMessage({ message = futureMessage; } return ( -
- Continue {intro} {message} +
+ {`Continue ${intro} ${message}`}
); } diff --git a/gui/src/pages/gui/ToolCallDiv/index.tsx b/gui/src/pages/gui/ToolCallDiv/index.tsx index 39d14cd0a..c919c0ca1 100644 --- a/gui/src/pages/gui/ToolCallDiv/index.tsx +++ b/gui/src/pages/gui/ToolCallDiv/index.tsx @@ -80,16 +80,14 @@ export function ToolCallDiv(props: ToolCallDivProps) { if (icon) { return ( -
- -
+ ); }