diff --git a/src/lib/components/admin/Analytics/Dashboard.svelte b/src/lib/components/admin/Analytics/Dashboard.svelte index 423269a985..22fea3afc7 100644 --- a/src/lib/components/admin/Analytics/Dashboard.svelte +++ b/src/lib/components/admin/Analytics/Dashboard.svelte @@ -18,6 +18,7 @@ import { WEBUI_API_BASE_URL } from '$lib/constants'; import { formatNumber } from '$lib/utils'; import { goto } from '$app/navigation'; + import type { Instance } from 'tippy.js'; const i18n = getContext('i18n'); @@ -83,6 +84,7 @@ { input_tokens: number; output_tokens: number; total_tokens: number } > = {}; let totalTokens = { input: 0, output: 0, total: 0 }; + let tokenTooltip: Instance | null = null; let loading = true; @@ -232,6 +234,12 @@ } + { + if (event.key === 'Escape') tokenTooltip?.hide(); + }} +/> +

{$i18n.t('Analytics')} @@ -291,8 +299,25 @@ > {$i18n.t('messages')} - - document.body, + aria: { content: 'describedby', expanded: true }, + onCreate: (instance) => (tokenTooltip = instance), + onDestroy: () => (tokenTooltip = null) + }} + content={`
+
${$i18n.t('Input')}${totalTokens.input.toLocaleString()}
+
${$i18n.t('Output')}${totalTokens.output.toLocaleString()}
+
${$i18n.t('Token counts are estimates and may not reflect actual API usage')}
+
`} + > + {formatNumber(totalTokens.total)}