{$i18n.t("Analytics")}
{#if groups.length > 0} {/if}
{#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", }}
{selectedPeriod === "24h" ? $i18n.t("Hourly Messages") : $i18n.t("Daily Messages")}
{/if} {/if} {#if loading}
{:else}
{$i18n.t("Model Usage")}
{#each sortedModels as model, idx (model.model_id)} { selectedModel = { id: model.model_id, name: model.name, }; showModelModal = true; }} > {/each} {#if sortedModels.length === 0} {/if}
# 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}
toggleModelSort("tokens")} >
{$i18n.t("Tokens")} {#if modelOrderBy === "tokens"} {#if modelDirection === "asc"}{:else}{/if} {:else} {/if}
toggleModelSort("percentage")} >
% {#if modelOrderBy === "percentage"} {#if modelDirection === "asc"}{:else}{/if} {:else} {/if}
{idx + 1}
{model.name} { e.target.src = "/favicon.png"; }} /> {model.name}
{model.count.toLocaleString()} {formatNumber( tokenStats[model.model_id] ?.total_tokens ?? 0, )} {totalModelMessages > 0 ? ( (model.count / totalModelMessages) * 100 ).toFixed(1) : 0}%
{$i18n.t("No data")}
{$i18n.t("User Activity")}
{#each sortedUsers as user, idx (user.user_id)} {/each} {#if sortedUsers.length === 0} {/if}
# 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}
toggleUserSort("tokens")} >
{$i18n.t("Tokens")} {#if userOrderBy === "tokens"} {#if userDirection === "asc"}{:else}{/if} {:else} {/if}
{idx + 1}
{user.name { e.target.src = "/user.png"; }} /> {user.name || user.email || user.user_id.substring( 0, 8, )}
{user.count.toLocaleString()} {formatNumber(user.total_tokens ?? 0)}
{$i18n.t("No data")}
ⓘ {$i18n.t("Message counts are based on assistant responses.")}
{/if}