Skip to content

Commit 027614f

Browse files
Vikhyath MondretiVikhyath Mondreti
authored andcommitted
improvement(trace-span): make tool calls separately display in trace span"
1 parent b4b6895 commit 027614f

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

apps/sim/app/workspace/[workspaceId]/logs/components/trace-spans/trace-spans-display.tsx

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,22 @@ function transformBlockData(data: any, blockType: string, isInput: boolean) {
2727
if (isInput) {
2828
const cleanInput = { ...data }
2929

30-
// Remove sensitive fields
30+
// Remove sensitive fields (common API keys and tokens)
3131
if (cleanInput.apiKey) {
3232
cleanInput.apiKey = '***'
3333
}
3434
if (cleanInput.azureApiKey) {
3535
cleanInput.azureApiKey = '***'
3636
}
37+
if (cleanInput.token) {
38+
cleanInput.token = '***'
39+
}
40+
if (cleanInput.accessToken) {
41+
cleanInput.accessToken = '***'
42+
}
43+
if (cleanInput.authorization) {
44+
cleanInput.authorization = '***'
45+
}
3746

3847
// Remove null/undefined values for cleaner display
3948
Object.keys(cleanInput).forEach((key) => {
@@ -73,6 +82,10 @@ function transformBlockData(data: any, blockType: string, isInput: boolean) {
7382
headers: response.headers,
7483
}
7584

85+
case 'tool':
86+
// For tool calls, show the result data directly
87+
return response
88+
7689
default:
7790
// For other block types, show the response content
7891
return response
@@ -613,9 +626,16 @@ function TraceSpanItem({
613626
startTime: new Date(toolStartTime).toISOString(),
614627
endTime: new Date(toolEndTime).toISOString(),
615628
status: toolCall.error ? 'error' : 'success',
629+
// Include tool call arguments as input and result as output
630+
input: toolCall.input,
631+
output: toolCall.error
632+
? { error: toolCall.error, ...(toolCall.output || {}) }
633+
: toolCall.output,
616634
}
617635

618-
// Tool calls typically don't have sub-items
636+
// Tool calls now have input/output data to display
637+
const hasToolCallData = Boolean(toolCall.input || toolCall.output || toolCall.error)
638+
619639
return (
620640
<TraceSpanItem
621641
key={`tool-${index}`}
@@ -627,7 +647,7 @@ function TraceSpanItem({
627647
workflowStartTime={workflowStartTime}
628648
onToggle={onToggle}
629649
expandedSpans={expandedSpans}
630-
hasSubItems={false}
650+
hasSubItems={hasToolCallData}
631651
/>
632652
)
633653
})}

0 commit comments

Comments
 (0)