From 77ea063d078e0d04d564dd9fe79946d289c7b5be Mon Sep 17 00:00:00 2001 From: bracesproul Date: Wed, 5 Mar 2025 14:25:36 -0800 Subject: [PATCH] fix: Render tool calls with no args --- src/components/thread/messages/tool-calls.tsx | 47 ++++++++++--------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/src/components/thread/messages/tool-calls.tsx b/src/components/thread/messages/tool-calls.tsx index bd768c3..b94f885 100644 --- a/src/components/thread/messages/tool-calls.tsx +++ b/src/components/thread/messages/tool-calls.tsx @@ -18,8 +18,7 @@ export function ToolCalls({
{toolCalls.map((tc, idx) => { const args = tc.args as Record; - if (!tc.args || Object.keys(args).length === 0) return null; - + const hasArgs = Object.keys(args).length > 0; return (
- - - {Object.entries(args).map(([key, value], argIdx) => ( - - - - - ))} - -
- {key} - - {isComplexValue(value) ? ( - - {JSON.stringify(value, null, 2)} - - ) : ( - String(value) - )} -
+ {hasArgs ? ( + + + {Object.entries(args).map(([key, value], argIdx) => ( + + + + + ))} + +
+ {key} + + {isComplexValue(value) ? ( + + {JSON.stringify(value, null, 2)} + + ) : ( + String(value) + )} +
+ ) : ( + {"{}"} + )}
); })}