diff --git a/src/components/thread/messages/tool-calls.tsx b/src/components/thread/messages/tool-calls.tsx index 5eb78d36..b9bd2d97 100644 --- a/src/components/thread/messages/tool-calls.tsx +++ b/src/components/thread/messages/tool-calls.tsx @@ -15,7 +15,7 @@ export function ToolCalls({ if (!toolCalls || toolCalls.length === 0) return null; return ( -
+
{toolCalls.map((tc, idx) => { const args = tc.args as Record; const hasArgs = Object.keys(args).length > 0; @@ -94,96 +94,98 @@ export function ToolResult({ message }: { message: ToolMessage }) { : contentStr; return ( -
-
-
- {message.name ? ( -

- Tool Result:{" "} - - {message.name} +
+
+
+
+ {message.name ? ( +

+ Tool Result:{" "} + + {message.name} + +

+ ) : ( +

Tool Result

+ )} + {message.tool_call_id && ( + + {message.tool_call_id} -

- ) : ( -

Tool Result

- )} - {message.tool_call_id && ( - - {message.tool_call_id} - - )} + )} +
-
- -
- - +
+ - {isJsonContent ? ( - - - {(Array.isArray(parsedContent) - ? isExpanded - ? parsedContent - : parsedContent.slice(0, 5) - : Object.entries(parsedContent) - ).map((item, argIdx) => { - const [key, value] = Array.isArray(parsedContent) - ? [argIdx, item] - : [item[0], item[1]]; - return ( - - - - - ); - })} - -
- {key} - - {isComplexValue(value) ? ( - - {JSON.stringify(value, null, 2)} - - ) : ( - String(value) - )} -
- ) : ( - {displayedContent} - )} - -
-
- {((shouldTruncate && !isJsonContent) || - (isJsonContent && - Array.isArray(parsedContent) && - parsedContent.length > 5)) && ( - setIsExpanded(!isExpanded)} - className="flex w-full cursor-pointer items-center justify-center border-t-[1px] border-gray-200 py-2 text-gray-500 transition-all duration-200 ease-in-out hover:bg-gray-50 hover:text-gray-600" - initial={{ scale: 1 }} - whileHover={{ scale: 1.02 }} - whileTap={{ scale: 0.98 }} - > - {isExpanded ? : } - - )} -
+ + {isJsonContent ? ( + + + {(Array.isArray(parsedContent) + ? isExpanded + ? parsedContent + : parsedContent.slice(0, 5) + : Object.entries(parsedContent) + ).map((item, argIdx) => { + const [key, value] = Array.isArray(parsedContent) + ? [argIdx, item] + : [item[0], item[1]]; + return ( + + + + + ); + })} + +
+ {key} + + {isComplexValue(value) ? ( + + {JSON.stringify(value, null, 2)} + + ) : ( + String(value) + )} +
+ ) : ( + {displayedContent} + )} +
+
+
+ {((shouldTruncate && !isJsonContent) || + (isJsonContent && + Array.isArray(parsedContent) && + parsedContent.length > 5)) && ( + setIsExpanded(!isExpanded)} + className="flex w-full cursor-pointer items-center justify-center border-t-[1px] border-gray-200 py-2 text-gray-500 transition-all duration-200 ease-in-out hover:bg-gray-50 hover:text-gray-600" + initial={{ scale: 1 }} + whileHover={{ scale: 1.02 }} + whileTap={{ scale: 0.98 }} + > + {isExpanded ? : } + + )} +
+
); }