File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
apps/desktop/src/components/codegen Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 36
36
}: Props = $props ();
37
37
38
38
let isOpen = $state (false );
39
+
40
+ function formatNumber(n : number , fractionDigits = 0 ) {
41
+ const options: Intl .NumberFormatOptions = {
42
+ maximumFractionDigits: fractionDigits ,
43
+ minimumFractionDigits: fractionDigits
44
+ };
45
+
46
+ // Use the user's locale (undefined) so thousands separator will match their locale.
47
+ return new Intl .NumberFormat (undefined , options ).format (n );
48
+ }
39
49
</script >
40
50
41
51
<div class ="codegen-entry-wrapper" use:focusable ={{ focusable : true , onAction : () => onclick ?.() }}>
104
114
<div class ="entry-metadata text-12" in:fade ={{ duration : 150 }}>
105
115
<Tooltip text =" Total tokens used and cost" >
106
116
<div class =" flex gap-4 items-center" >
107
- <p >{tokensUsed }</p >
117
+ <p >{formatNumber ( tokensUsed ) }</p >
108
118
<svg
109
119
width =" 0.938rem"
110
120
height =" 0.938rem"
125
135
/>
126
136
</svg >
127
137
<div class =" metadata-divider" ></div >
128
- <p >${cost . toFixed ( 2 )}</p >
138
+ <p >${formatNumber ( cost , 2 )}</p >
129
139
</div >
130
140
</Tooltip >
131
141
You can’t perform that action at this time.
0 commit comments