feat: group digits in the token usage tooltip (#33896)

The token usage shown when hovering the info icon under a reply listed large counts as one long run of digits, so a value like 26678623 was hard to read at a glance. Whole numbers in that tooltip are now grouped for the language set in Open WebUI, for example 26,678,623 in English or 26.678.623 in German. Decimal values such as costs are not grouped and look as before.
This commit is contained in:
Classic298 authored and GitHub committed 2026-11-08 10:41:35 +09:00
1 parent e9a9e16baa
commit e84dba2d3e
1 file changed
+6
@@ -1231,6 +1231,12 @@
.split('\n')
.map((line) => line.slice(2))
.map((line) => (line.endsWith(',') ? line.slice(0, -1) : line))
.map((line) =>
line.replace(
/: (\d+)$/,
(_, count) => `: ${Number(count).toLocaleString($i18n.language)}`
)
)
.join('\n')}
<span id="usage-{message.id}" hidden>{usage}</span>
<Tooltip