diff --git a/packages/ui/src/components/basic-tool.tsx b/packages/ui/src/components/basic-tool.tsx index 15b5d48671d..0548db2bc14 100644 --- a/packages/ui/src/components/basic-tool.tsx +++ b/packages/ui/src/components/basic-tool.tsx @@ -107,6 +107,40 @@ export function BasicTool(props: BasicToolProps) { ) } -export function GenericTool(props: { tool: string; hideDetails?: boolean }) { - return +export function GenericTool(props: { + tool: string + input?: Record + output?: string + hideDetails?: boolean + defaultOpen?: boolean + forceOpen?: boolean +}) { + const hasContent = () => (props.input && Object.keys(props.input).length > 0) || props.output + + return ( + + + + 0}> + + Input + {JSON.stringify(props.input, null, 2)} + + + + + Output + {props.output} + + + + + + ) } diff --git a/packages/ui/src/components/message-part.css b/packages/ui/src/components/message-part.css index b087b59e17d..443b021fa88 100644 --- a/packages/ui/src/components/message-part.css +++ b/packages/ui/src/components/message-part.css @@ -200,6 +200,38 @@ } } +[data-slot="generic-tool-section"] { + display: flex; + flex-direction: column; + gap: 4px; + width: 100%; + + &:not(:last-child) { + margin-bottom: 12px; + } + + [data-slot="generic-tool-label"] { + font-family: var(--font-family-sans); + font-size: var(--font-size-xs); + font-weight: var(--font-weight-medium); + color: var(--text-weak); + text-transform: uppercase; + letter-spacing: 0.05em; + } + + [data-slot="generic-tool-content"] { + font-family: var(--font-family-mono); + font-size: var(--font-size-xs); + line-height: var(--line-height-large); + color: var(--text-base); + white-space: pre-wrap; + word-break: break-word; + margin: 0; + padding: 0; + background: none; + } +} + [data-component="edit-trigger"], [data-component="write-trigger"] { display: flex;
{JSON.stringify(props.input, null, 2)}
{props.output}