diff --git a/torchci/components/TorchAgentPage/ToolUse.tsx b/torchci/components/TorchAgentPage/ToolUse.tsx index cb880f795d..8fb2301bcc 100644 --- a/torchci/components/TorchAgentPage/ToolUse.tsx +++ b/torchci/components/TorchAgentPage/ToolUse.tsx @@ -62,7 +62,27 @@ export const ToolUse: React.FC = ({ > Input: - {JSON.stringify(toolInput, null, 2)} + {(() => { + const hasQuery = + toolInput && + typeof toolInput === "object" && + typeof toolInput.query === "string"; + if (!hasQuery) { + return {JSON.stringify(toolInput, null, 2)}; + } + const { query, ...rest } = toolInput; + const restKeys = Object.keys(rest); + return ( + <> + {query.trim()} + {restKeys.length > 0 && ( + + {JSON.stringify(rest, null, 2)} + + )} + + ); + })()} {toolResult && ( <>