File tree Expand file tree Collapse file tree
apps/sim/app/workspace/[workspaceId]/logs/components/log-details Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,14 +19,15 @@ import {
1919 Search as SearchIcon ,
2020 Tooltip ,
2121} from '@/components/emcn'
22- import { dollarsToCredits } from '@/lib/billing/credits/conversion'
2322import { cn } from '@/lib/core/utils/cn'
2423import type { TraceSpan } from '@/lib/logs/types'
2524import {
25+ formatCostAmount ,
2626 formatTokensSummary ,
2727 formatTps ,
2828 formatTtft ,
2929 getBlockIconAndColor ,
30+ getDisplayName ,
3031 hasErrorInTree ,
3132 hasUnhandledErrorInTree ,
3233 isIterationType ,
@@ -58,13 +59,6 @@ function useSetToggle() {
5859 )
5960}
6061
61- function formatCostAmount ( value : number | undefined ) : string | undefined {
62- if ( typeof value !== 'number' || ! Number . isFinite ( value ) || value <= 0 ) return undefined
63- const credits = dollarsToCredits ( value )
64- if ( credits <= 0 ) return '<1 credit'
65- return `${ credits . toLocaleString ( 'en-US' ) } ${ credits === 1 ? 'credit' : 'credits' } `
66- }
67-
6862function formatCostSummary ( cost : TraceSpan [ 'cost' ] ) : string | undefined {
6963 if ( ! cost ) return undefined
7064 const parts : string [ ] = [ ]
@@ -535,7 +529,7 @@ const TraceSpanNode = memo(function TraceSpanNode({
535529 className = 'min-w-0 max-w-[180px] truncate font-medium text-caption'
536530 style = { { color : showErrorStyle ? 'var(--text-error)' : 'var(--text-secondary)' } }
537531 >
538- { span . name }
532+ { getDisplayName ( span ) }
539533 </ span >
540534 { isToggleable && (
541535 < ChevronDown
Original file line number Diff line number Diff line change @@ -29,21 +29,21 @@ import {
2929 Search as SearchIcon ,
3030 Tooltip ,
3131} from '@/components/emcn'
32- import { dollarsToCredits } from '@/lib/billing/credits/conversion'
3332import { cn } from '@/lib/core/utils/cn'
3433import type { TraceSpan } from '@/lib/logs/types'
3534import {
35+ formatCostAmount ,
3636 formatTokenCount ,
3737 formatTps ,
3838 formatTtft ,
3939 getBlockIconAndColor ,
40+ getDisplayName ,
4041 hasErrorInTree ,
4142 hasUnhandledErrorInTree ,
4243 isIterationType ,
4344 parseTime ,
4445} from '@/app/workspace/[workspaceId]/logs/components/log-details/utils'
4546import { useCodeViewerFeatures } from '@/hooks/use-code-viewer'
46- import { normalizeToolId } from '@/tools/normalize'
4747
4848const DEFAULT_TREE_PANE_WIDTH = 360
4949const MIN_TREE_PANE_WIDTH = 200
@@ -120,18 +120,6 @@ function iconColorClass(bgColor: string): string {
120120 return r * 299 + g * 587 + b * 114 > 160_000 ? 'text-[#111111]' : 'text-white'
121121}
122122
123- function formatCostAmount ( value : number | undefined ) : string | undefined {
124- if ( typeof value !== 'number' || ! Number . isFinite ( value ) || value <= 0 ) return undefined
125- const credits = dollarsToCredits ( value )
126- if ( credits <= 0 ) return '<1 credit'
127- return `${ credits . toLocaleString ( 'en-US' ) } ${ credits === 1 ? 'credit' : 'credits' } `
128- }
129-
130- function getDisplayName ( span : TraceSpan ) : string {
131- if ( span . type ?. toLowerCase ( ) === 'tool' ) return normalizeToolId ( span . name )
132- return span . name
133- }
134-
135123/**
136124 * Flattens the visible (expanded) span tree into a linear list for keyboard
137125 * navigation, carrying depth, the chain of parent ids for indent drawing, and
Original file line number Diff line number Diff line change 11import type React from 'react'
22import { AgentSkillsIcon , WorkflowIcon } from '@/components/icons'
3+ import { dollarsToCredits } from '@/lib/billing/credits/conversion'
34import type { TraceSpan } from '@/lib/logs/types'
45import { LoopTool } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/subflows/loop/loop-config'
56import { ParallelTool } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/subflows/parallel/parallel-config'
@@ -88,6 +89,18 @@ export function formatTps(
8889 return tps > 0 ? `${ tps . toLocaleString ( 'en-US' ) } tok/s` : undefined
8990}
9091
92+ export function getDisplayName ( span : TraceSpan ) : string {
93+ if ( span . type ?. toLowerCase ( ) === 'tool' ) return normalizeToolId ( span . name )
94+ return span . name
95+ }
96+
97+ export function formatCostAmount ( value : number | undefined ) : string | undefined {
98+ if ( typeof value !== 'number' || ! Number . isFinite ( value ) || value <= 0 ) return undefined
99+ const credits = dollarsToCredits ( value )
100+ if ( credits <= 0 ) return '<1 credit'
101+ return `${ credits . toLocaleString ( 'en-US' ) } ${ credits === 1 ? 'credit' : 'credits' } `
102+ }
103+
91104export function formatTokensSummary ( tokens : TraceSpan [ 'tokens' ] ) : string | undefined {
92105 if ( ! tokens ) return undefined
93106 const parts : string [ ] = [ ]
You can’t perform that action at this time.
0 commit comments