Changesets · Branches · Tags · Compare
| Changeset | 920ebdc17685396deefebe6e073daefedbc6968e046515c0f63e01bf6fa6e3f2 |
|---|---|
| Author | Patrick Erichsen <patrick.a.erichsen@gmail.com> · 2025-07-15 22:16 -07:00 |
| Committer | Patrick Erichsen <patrick.a.erichsen@gmail.com> · 2025-07-15 22:16 -07:00 |
| Parents | 1540e1a97ce6 |
6 files changed
modified gui/src/pages/gui/ToolCallDiv/SimpleToolCallUI.tsx +0 −1
| @@ -89,7 +89,6 @@ | ||
| 89 | 89 | <ArgsToggleIcon |
| 90 | 90 | isShowing={showingArgs} |
| 91 | 91 | setIsShowing={setShowingArgs} |
| 92 | - toolCallId={toolCallState.toolCallId} | |
| 93 | 92 | /> |
| 94 | 93 | ) : null} |
| 95 | 94 | </div> |
deleted gui/src/pages/gui/ToolCallDiv/ToolCall.tsx +0 −66
| @@ -1,66 +0,0 @@ | ||
| 1 | -import { Tool, ToolCallState } from "core"; | |
| 2 | -import { useMemo, useState } from "react"; | |
| 3 | -import { ArgsItems, ArgsToggleIcon } from "./ToolCallArgs"; | |
| 4 | -import { ToolCallStatusMessage } from "./ToolCallStatusMessage"; | |
| 5 | -import { ToolTruncateHistoryIcon } from "./ToolTruncateHistoryIcon"; | |
| 6 | - | |
| 7 | -interface ToolCallDisplayProps { | |
| 8 | - children: React.ReactNode; | |
| 9 | - icon: React.ReactNode; | |
| 10 | - tool: Tool | undefined; | |
| 11 | - toolCallState: ToolCallState; | |
| 12 | - historyIndex: number; | |
| 13 | -} | |
| 14 | - | |
| 15 | -export function ToolCallDisplay({ | |
| 16 | - tool, | |
| 17 | - toolCallState, | |
| 18 | - children, | |
| 19 | - icon, | |
| 20 | - historyIndex, | |
| 21 | -}: ToolCallDisplayProps) { | |
| 22 | - const [argsExpanded, setArgsExpanded] = useState(false); | |
| 23 | - | |
| 24 | - const args: [string, any][] = useMemo(() => { | |
| 25 | - return Object.entries(toolCallState.parsedArgs); | |
| 26 | - }, [toolCallState.parsedArgs]); | |
| 27 | - | |
| 28 | - return ( | |
| 29 | - <> | |
| 30 | - <div className="flex flex-col justify-center p-4 pb-1"> | |
| 31 | - <div className="mb-2 flex flex-col"> | |
| 32 | - <div className="flex flex-row items-center justify-between gap-1.5"> | |
| 33 | - <div className="flex min-w-0 flex-row items-center gap-2"> | |
| 34 | - <div className="mt-[1px] h-4 w-4 flex-shrink-0 font-semibold"> | |
| 35 | - {icon} | |
| 36 | - </div> | |
| 37 | - {tool?.faviconUrl && ( | |
| 38 | - <img src={tool.faviconUrl} className="h-4 w-4 rounded-sm" /> | |
| 39 | - )} | |
| 40 | - <ToolCallStatusMessage | |
| 41 | - tool={tool} | |
| 42 | - toolCallState={toolCallState} | |
| 43 | - /> | |
| 44 | - </div> | |
| 45 | - <div className="flex flex-row items-center gap-1.5"> | |
| 46 | - {!!toolCallState.output && ( | |
| 47 | - <ToolTruncateHistoryIcon historyIndex={historyIndex} /> | |
| 48 | - )} | |
| 49 | - {!!args.length ? ( | |
| 50 | - <ArgsToggleIcon | |
| 51 | - isShowing={argsExpanded} | |
| 52 | - setIsShowing={setArgsExpanded} | |
| 53 | - toolCallId={toolCallState.toolCallId} | |
| 54 | - /> | |
| 55 | - ) : null} | |
| 56 | - </div> | |
| 57 | - </div> | |
| 58 | - {argsExpanded && !!args.length && ( | |
| 59 | - <ArgsItems args={args} isShowing={argsExpanded} /> | |
| 60 | - )} | |
| 61 | - </div> | |
| 62 | - <div>{children}</div> | |
| 63 | - </div> | |
| 64 | - </> | |
| 65 | - ); | |
| 66 | -} |
modified gui/src/pages/gui/ToolCallDiv/ToolCallArgs.tsx +0 −2
| @@ -4,13 +4,11 @@ | ||
| 4 | 4 | interface ArgsToggleIconProps { |
| 5 | 5 | isShowing: boolean; |
| 6 | 6 | setIsShowing: (val: boolean) => void; |
| 7 | - toolCallId: string; | |
| 8 | 7 | } |
| 9 | 8 | |
| 10 | 9 | export const ArgsToggleIcon = ({ |
| 11 | 10 | isShowing, |
| 12 | 11 | setIsShowing, |
| 13 | - toolCallId, | |
| 14 | 12 | }: ArgsToggleIconProps) => { |
| 15 | 13 | return ( |
| 16 | 14 | <ToolbarButtonWithTooltip |
added gui/src/pages/gui/ToolCallDiv/ToolCallDisplay.tsx +65 −0
| @@ -0,0 +1,65 @@ | ||
| 1 | +import { Tool, ToolCallState } from "core"; | |
| 2 | +import { useMemo, useState } from "react"; | |
| 3 | +import { ArgsItems, ArgsToggleIcon } from "./ToolCallArgs"; | |
| 4 | +import { ToolCallStatusMessage } from "./ToolCallStatusMessage"; | |
| 5 | +import { ToolTruncateHistoryIcon } from "./ToolTruncateHistoryIcon"; | |
| 6 | + | |
| 7 | +interface ToolCallDisplayProps { | |
| 8 | + children: React.ReactNode; | |
| 9 | + icon: React.ReactNode; | |
| 10 | + tool: Tool | undefined; | |
| 11 | + toolCallState: ToolCallState; | |
| 12 | + historyIndex: number; | |
| 13 | +} | |
| 14 | + | |
| 15 | +export function ToolCallDisplay({ | |
| 16 | + tool, | |
| 17 | + toolCallState, | |
| 18 | + children, | |
| 19 | + icon, | |
| 20 | + historyIndex, | |
| 21 | +}: ToolCallDisplayProps) { | |
| 22 | + const [argsExpanded, setArgsExpanded] = useState(false); | |
| 23 | + | |
| 24 | + const args: [string, any][] = useMemo(() => { | |
| 25 | + return Object.entries(toolCallState.parsedArgs); | |
| 26 | + }, [toolCallState.parsedArgs]); | |
| 27 | + | |
| 28 | + return ( | |
| 29 | + <> | |
| 30 | + <div className="flex flex-col justify-center"> | |
| 31 | + <div className="mb-2 flex flex-col"> | |
| 32 | + <div className="flex flex-row items-center justify-between gap-1.5"> | |
| 33 | + <div className="flex min-w-0 flex-row items-center gap-2"> | |
| 34 | + <div className="mt-[1px] h-4 w-4 flex-shrink-0 font-semibold"> | |
| 35 | + {icon} | |
| 36 | + </div> | |
| 37 | + {tool?.faviconUrl && ( | |
| 38 | + <img src={tool.faviconUrl} className="h-4 w-4 rounded-sm" /> | |
| 39 | + )} | |
| 40 | + <ToolCallStatusMessage | |
| 41 | + tool={tool} | |
| 42 | + toolCallState={toolCallState} | |
| 43 | + /> | |
| 44 | + </div> | |
| 45 | + <div className="flex flex-row items-center gap-1.5"> | |
| 46 | + {!!toolCallState.output && ( | |
| 47 | + <ToolTruncateHistoryIcon historyIndex={historyIndex} /> | |
| 48 | + )} | |
| 49 | + {!!args.length ? ( | |
| 50 | + <ArgsToggleIcon | |
| 51 | + isShowing={argsExpanded} | |
| 52 | + setIsShowing={setArgsExpanded} | |
| 53 | + /> | |
| 54 | + ) : null} | |
| 55 | + </div> | |
| 56 | + </div> | |
| 57 | + {argsExpanded && !!args.length && ( | |
| 58 | + <ArgsItems args={args} isShowing={argsExpanded} /> | |
| 59 | + )} | |
| 60 | + </div> | |
| 61 | + <div>{children}</div> | |
| 62 | + </div> | |
| 63 | + </> | |
| 64 | + ); | |
| 65 | +} |
modified gui/src/pages/gui/ToolCallDiv/ToolCallStatusMessage.tsx +1 −1
| @@ -53,7 +53,7 @@ | ||
| 53 | 53 | |
| 54 | 54 | return ( |
| 55 | 55 | <div |
| 56 | - className="text-description line-clamp-4 min-w-0 break-words" | |
| 56 | + className="text-description line-clamp-4 min-w-0 break-all" | |
| 57 | 57 | data-testid="tool-call-title" |
| 58 | 58 | > |
| 59 | 59 | {`Continue ${intro} ${message}`} |
modified gui/src/pages/gui/ToolCallDiv/index.tsx +2 −5
| @@ -6,7 +6,7 @@ | ||
| 6 | 6 | import FunctionSpecificToolCallDiv from "./FunctionSpecificToolCallDiv"; |
| 7 | 7 | import { GroupedToolCallHeader } from "./GroupedToolCallHeader"; |
| 8 | 8 | import { SimpleToolCallUI } from "./SimpleToolCallUI"; |
| 9 | -import { ToolCallDisplay } from "./ToolCall"; | |
| 9 | +import { ToolCallDisplay } from "./ToolCallDisplay"; | |
| 10 | 10 | import { getStatusIcon, toolCallIcons } from "./utils"; |
| 11 | 11 | |
| 12 | 12 | interface ToolCallDivProps { |
| @@ -103,10 +103,7 @@ | ||
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | return toolCallStates.map((toolCallState) => ( |
| 106 | - <div | |
| 107 | - className="border-border rounded-lg border p-3" | |
| 108 | - key={toolCallState.toolCallId} | |
| 109 | - > | |
| 106 | + <div className="p-4 pb-1" key={toolCallState.toolCallId}> | |
| 110 | 107 | {renderToolCall(toolCallState)} |
| 111 | 108 | </div> |
| 112 | 109 | )); |