{$i18n.t('Analytics')}
{#if groups.length > 0}
{$i18n.t('All Users')}
{#each groups as group}
{group.name}
{/each}
{/if}
{#each periods as period}
{$i18n.t(period.label)}
{/each}
{#if !loading}
{summary.total_messages.toLocaleString()}
{$i18n.t('messages')}
{formatNumber(totalTokens.total)}
{$i18n.t('tokens')}
{summary.total_chats.toLocaleString()}
{$i18n.t('chats')}
{summary.total_users}
{$i18n.t('users')}
{#if dailyStats.length > 1} {@const allModels = [...new Set(dailyStats.flatMap((d) => Object.keys(d.models || {})))]} {@const topModels = allModels.slice(0, 8)} {@const chartColors = [ '#3b82f6', '#10b981', '#f59e0b', '#ef4444', '#8b5cf6', '#ec4899', '#06b6d4', '#84cc16' ]} {@const periodMap = { '24h': 'hour', '7d': 'week', '30d': 'month', '90d': 'year', all: 'all' }}
{$i18n.t(selectedPeriod === '24h' ? 'Hourly Messages' : 'Daily Messages')}
{/if} {/if} {#if loading}
{:else}
{$i18n.t('Model Usage')}
#
toggleModelSort('name')} >
{$i18n.t('Model')} {#if modelOrderBy === 'name'}
{#if modelDirection === 'asc'}
{:else}
{/if}
{:else}
{/if}
toggleModelSort('count')} >
{$i18n.t('Messages')} {#if modelOrderBy === 'count'}
{#if modelDirection === 'asc'}
{:else}
{/if}
{:else}
{/if}
{$i18n.t('Tokens')}
%
{#each sortedModels as model, idx (model.model_id)}
{ selectedModel = { id: model.model_id, name: model.name }; showModelModal = true; }} >
{idx + 1}
{model.name}
{model.count.toLocaleString()}
{formatNumber(tokenStats[model.model_id]?.total_tokens ?? 0)}
{totalModelMessages > 0 ? ((model.count / totalModelMessages) * 100).toFixed(1) : 0}%
{/each} {#if sortedModels.length === 0}
{$i18n.t('No data')}
{/if}
{$i18n.t('User Activity')}
#
toggleUserSort('name')} >
{$i18n.t('User')} {#if userOrderBy === 'name'}
{#if userDirection === 'asc'}
{:else}
{/if}
{:else}
{/if}
toggleUserSort('count')} >
{$i18n.t('Messages')} {#if userOrderBy === 'count'}
{#if userDirection === 'asc'}
{:else}
{/if}
{:else}
{/if}
{$i18n.t('Tokens')}
{#each sortedUsers as user, idx (user.user_id)}
{idx + 1}
{user.name || user.email || user.user_id.substring(0, 8)}
{user.count.toLocaleString()}
{formatNumber(user.total_tokens ?? 0)}
{/each} {#if sortedUsers.length === 0}
{$i18n.t('No data')}
{/if}
ⓘ {$i18n.t('Message counts are based on assistant responses.')}
{/if}