From b3978c7a5ecbd3596f210cd26da9acbe4ba39b84 Mon Sep 17 00:00:00 2001 From: Nahiyan Khan Date: Thu, 6 Feb 2025 14:42:34 -0500 Subject: [PATCH] styles: tweaks to tool call UI (#812) --- ui/desktop/src/components/MarkdownContent.tsx | 7 ++- .../src/components/ToolCallArguments.tsx | 46 +++++++++++-------- ui/desktop/src/components/ToolInvocations.tsx | 14 +++--- 3 files changed, 41 insertions(+), 26 deletions(-) diff --git a/ui/desktop/src/components/MarkdownContent.tsx b/ui/desktop/src/components/MarkdownContent.tsx index a490587f..ca3995f1 100644 --- a/ui/desktop/src/components/MarkdownContent.tsx +++ b/ui/desktop/src/components/MarkdownContent.tsx @@ -84,7 +84,7 @@ export default function MarkdownContent({ content, className = '' }: MarkdownCon ); }, + // h3: 'div', + h3(props) { + const { node, ...rest } = props; + return
; + }, }} > {content} diff --git a/ui/desktop/src/components/ToolCallArguments.tsx b/ui/desktop/src/components/ToolCallArguments.tsx index f0d5b5b8..308fffe5 100644 --- a/ui/desktop/src/components/ToolCallArguments.tsx +++ b/ui/desktop/src/components/ToolCallArguments.tsx @@ -1,3 +1,4 @@ +import { ChevronUp } from 'lucide-react'; import React, { useState } from 'react'; import MarkdownContent from './MarkdownContent'; @@ -19,34 +20,43 @@ export function ToolCallArguments({ args }: ToolCallArgumentsProps) { if (!needsExpansion) { return ( -
-
- {key}: - {value} +
+
+ {key} + {value}
); } return ( -
-
- {key}: -
+
+
+ {key} +
+ {isExpanded ? ( +
+ +
+ ) : ( + {value.slice(0, 60)}... + )} - {!isExpanded && {value.slice(0, 60)}...}
- {isExpanded && ( -
+ {/* {isExpanded && ( +
- )} + )} */}
); } @@ -59,9 +69,9 @@ export function ToolCallArguments({ args }: ToolCallArgumentsProps) { : String(value); return ( -
-
- {key}: +
+
+ {key}:
{content}
@@ -69,7 +79,7 @@ export function ToolCallArguments({ args }: ToolCallArgumentsProps) { }; return ( -
+
{Object.entries(args).map(([key, value]) => (
{renderValue(key, value)}
))} diff --git a/ui/desktop/src/components/ToolInvocations.tsx b/ui/desktop/src/components/ToolInvocations.tsx index a0221baf..7de42dd4 100644 --- a/ui/desktop/src/components/ToolInvocations.tsx +++ b/ui/desktop/src/components/ToolInvocations.tsx @@ -44,10 +44,10 @@ interface ToolCallProps { function ToolCall({ call }: ToolCallProps) { return (
-
- - - {call.toolName.substring(call.toolName.lastIndexOf('__') + 2).toUpperCase()} +
+ + + {snakeToTitleCase(call.toolName.substring(call.toolName.lastIndexOf('__') + 2))}
@@ -116,7 +116,7 @@ function ToolResult({ result }: ToolResultProps) { }; return ( -
+
{filteredResults.map((item: ResultItem, index: number) => { const isExpanded = shouldShowExpanded(item, index); // minimize if priority is not set or < 0.5 @@ -127,9 +127,9 @@ function ToolResult({ result }: ToolResultProps) { {shouldMinimize && (