): string {
if (!cost?.total) return 'N/A'
const total = cost.total as number
diff --git a/apps/sim/components/ui/tool-call.tsx b/apps/sim/components/ui/tool-call.tsx
index b6d76ca7e..ade15ebe9 100644
--- a/apps/sim/components/ui/tool-call.tsx
+++ b/apps/sim/components/ui/tool-call.tsx
@@ -7,6 +7,7 @@ import { Button } from '@/components/ui/button'
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/components/ui/collapsible'
import type { ToolCallGroup, ToolCallState } from '@/lib/copilot/types'
import { cn } from '@/lib/core/utils/cn'
+import { formatDuration } from '@/lib/core/utils/formatting'
interface ToolCallProps {
toolCall: ToolCallState
@@ -225,11 +226,6 @@ export function ToolCallCompletion({ toolCall, isCompact = false }: ToolCallProp
const isError = toolCall.state === 'error'
const isAborted = toolCall.state === 'aborted'
- const formatDuration = (duration?: number) => {
- if (!duration) return ''
- return duration < 1000 ? `${duration}ms` : `${(duration / 1000).toFixed(1)}s`
- }
-
return (
0 ? `${seconds.toFixed(precision)}s` : `${Math.floor(seconds)}s`
}