7.4 billion tokens per month. 34 free LLM providers. 635 free model endpoints. All behind one /v1 endpoint, plus any custom OpenAI-compatible endpoint. Smart routing, automatic failover, encrypted keys. Personal experimentation only.
TypeScript
dashboard: skeletons, shared empty states, first-run setup checklist
Tashfeen38ca711e8a9c
diff --git a/client/src/components/empty-state.tsx b/client/src/components/empty-state.tsxnew file mode 100644index 00000000..55e62a67--- /dev/null+++ b/client/src/components/empty-state.tsx@@ -0,0 +1,28 @@+import type { ComponentType, ReactNode } from 'react'+import { cn } from '@/lib/utils'++// The dashboard's one empty-state idiom: dashed card, optional icon, a title,+// and ideally an action that tells the user what to do next (an empty state+// without a next step is a dead end).+export function EmptyState({+ icon: Icon,+ title,+ description,+ action,+ className,+}: {+ icon?: ComponentType<{ className?: string }>+ title: string+ description?: ReactNode+ action?: ReactNode+ className?: string+}) {+ return (+ <div className={cn('rounded-3xl border border-dashed p-8 text-center', className)}>+ {Icon && <Icon className="mx-auto mb-3 size-6 text-muted-foreground/60" />}+ <p className="text-sm font-medium">{title}</p>+ {description && <div className="mx-auto mt-1 max-w-md text-sm text-muted-foreground">{description}</div>}+ {action && <div className="mt-4 flex flex-wrap items-center justify-center gap-2">{action}</div>}+ </div>+ )+}diff --git a/client/src/components/getting-started.tsx b/client/src/components/getting-started.tsxnew file mode 100644index 00000000..3ed85284--- /dev/null+++ b/client/src/components/getting-started.tsx@@ -0,0 +1,172 @@+import { useState, type ReactNode } from 'react'+import { Link } from 'react-router-dom'+import { useQuery } from '@tanstack/react-query'+import { ArrowRight, Check, Copy, X } from 'lucide-react'+import { apiFetch } from '@/lib/api'+import { toast } from '@/lib/toast'+import { apiBaseUrl } from '@/components/api-usage'+import { Button } from '@/components/ui/button'+import { useI18n } from '@/i18n'++const DISMISS_KEY = 'freellmapi.setup.dismissed'+const CONNECT_KEY = 'freellmapi.setup.connected'++function readFlag(key: string): boolean {+ try { return localStorage.getItem(key) === '1' } catch { return false }+}+function writeFlag(key: string) {+ try { localStorage.setItem(key, '1') } catch { /* ignore */ }+}++// First-run checklist on the Models landing page. A fresh install lands on an+// empty routing table with no hint of what to do; this walks the three steps+// that make the router actually useful (key -> test -> connect) and disappears+// once the install is clearly set up (has keys and has served a request), or+// when dismissed.+export function GettingStarted() {+ const { t } = useI18n()+ const [dismissed, setDismissed] = useState(() => readFlag(DISMISS_KEY))+ const [connected, setConnected] = useState(() => readFlag(CONNECT_KEY))++ const { data: keys } = useQuery<unknown[]>({+ queryKey: ['keys'],+ queryFn: () => apiFetch('/api/keys'),+ })+ const { data: summary } = useQuery<{ totalRequests?: number }>({+ queryKey: ['setup-summary'],+ queryFn: () => apiFetch('/api/analytics/summary?range=30d'),+ staleTime: 30_000,+ })+ const { data: keyData } = useQuery<{ apiKey: string }>({+ queryKey: ['unified-key'],+ queryFn: () => apiFetch('/api/settings/api-key'),+ })++ // Wait for real data before deciding: rendering on undefined would flash the+ // checklist at every established install for a moment on each visit.+ if (dismissed || !keys || !summary) return null++ const hasKeys = keys.length > 0+ const hasRequest = (summary.totalRequests ?? 0) > 0+ if (hasKeys && hasRequest) return null++ const doneCount = [hasKeys, hasRequest, connected].filter(Boolean).length++ function copyValue(value: string, message: string) {+ void navigator.clipboard?.writeText(value)+ toast.success(message)+ setConnected(true)+ writeFlag(CONNECT_KEY)+ }++ return (+ <section className="rounded-3xl border bg-card p-5">+ <div className="flex items-start justify-between gap-4">+ <div>+ <h2 className="text-sm font-semibold">{t('setup.title')}</h2>+ <p className="mt-0.5 text-xs text-muted-foreground">{t('setup.subtitle')}</p>+ </div>+ <div className="flex items-center gap-2">+ <span className="text-xs tabular-nums text-muted-foreground">{t('setup.progress', { done: doneCount, total: 3 })}</span>+ <button+ type="button"+ aria-label={t('common.dismiss')}+ onClick={() => { setDismissed(true); writeFlag(DISMISS_KEY) }}+ className="rounded-md p-1 text-muted-foreground/60 transition-colors hover:text-foreground"+ >+ <X className="size-3.5" />+ </button>+ </div>+ </div>++ <ol className="mt-4 space-y-1">+ <Step+ index={1}+ done={hasKeys}+ title={t('setup.step1Title')}+ description={t('setup.step1Desc')}+ action={+ <Link to="/keys">+ <Button variant="outline" size="sm">+ {t('setup.step1Cta')}+ <ArrowRight data-icon="inline-end" className="size-3.5" />+ </Button>+ </Link>+ }+ />+ <Step+ index={2}+ done={hasRequest}+ title={t('setup.step2Title')}+ description={t('setup.step2Desc')}+ action={+ <Link to="/playground">+ <Button variant="outline" size="sm">+ {t('setup.step2Cta')}+ <ArrowRight data-icon="inline-end" className="size-3.5" />+ </Button>+ </Link>+ }+ />+ <Step+ index={3}+ done={connected}+ title={t('setup.step3Title')}+ description={t('setup.step3Desc')}+ action={+ <div className="flex flex-wrap justify-end gap-2">+ <Button+ variant="outline"+ size="sm"+ disabled={!keyData?.apiKey}+ onClick={() => keyData?.apiKey && copyValue(keyData.apiKey, t('setup.copiedKey'))}+ >+ <Copy data-icon="inline-start" className="size-3.5" />+ {t('setup.copyKey')}+ </Button>+ <Button+ variant="outline"+ size="sm"+ onClick={() => copyValue(apiBaseUrl(), t('setup.copiedUrl'))}+ >+ <Copy data-icon="inline-start" className="size-3.5" />+ {t('setup.copyUrl')}+ </Button>+ </div>+ }+ />+ </ol>+ </section>+ )+}++function Step({+ index,+ done,+ title,+ description,+ action,+}: {+ index: number+ done: boolean+ title: string+ description: string+ action: ReactNode+}) {+ return (+ <li className="flex flex-wrap items-center gap-x-3 gap-y-2 rounded-xl px-2 py-2.5 sm:flex-nowrap">+ <span+ className={`flex size-5 shrink-0 items-center justify-center rounded-full text-[10px] font-medium tabular-nums ${+ done ? 'bg-emerald-600 text-white dark:bg-emerald-500' : 'border text-muted-foreground'+ }`}+ >+ {done ? <Check className="size-3" /> : index}+ </span>+ <div className="min-w-0 flex-1">+ <p className={`text-sm ${done ? 'text-muted-foreground line-through decoration-muted-foreground/40' : 'font-medium'}`}>{title}</p>+ {!done && <p className="text-xs text-muted-foreground">{description}</p>}+ </div>+ {!done && <div className="ml-8 shrink-0 sm:ml-0">{action}</div>}+ </li>+ )+}diff --git a/client/src/components/media-models.tsx b/client/src/components/media-models.tsxindex 547409b7..32952355 100644--- a/client/src/components/media-models.tsx+++ b/client/src/components/media-models.tsx@@ -1,8 +1,11 @@import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'import { Link } from 'react-router-dom'+import { AudioLines, Image as ImageIcon } from 'lucide-react'import { apiFetch } from '@/lib/api'import { Switch } from '@/components/ui/switch'import { ConfirmButton } from '@/components/confirm-button'+import { EmptyState } from '@/components/empty-state'+import { CardSkeleton } from '@/components/ui/skeleton'import { PageHeader } from '@/components/page-header'import { ModelsTabs } from '@/components/models-tabs'import { useI18n } from '@/i18n'@@ -82,9 +85,15 @@ export function MediaModelsView({ modality }: { modality: 'image' | 'audio' }) {</p>{isLoading ? (- <p className="text-sm text-muted-foreground">{t('common.loading')}</p>+ <>+ <CardSkeleton />+ <CardSkeleton />+ </>) : groups.length === 0 ? (- <p className="text-sm text-muted-foreground">{t('models.mediaEmpty')}</p>+ <EmptyState+ icon={modality === 'image' ? ImageIcon : AudioLines}+ title={t('models.mediaEmpty')}+ />) : (groups.map(g => {const anyEnabled = g.members.some(m => m.enabled)diff --git a/client/src/components/ui/skeleton.tsx b/client/src/components/ui/skeleton.tsxnew file mode 100644index 00000000..a2769eec--- /dev/null+++ b/client/src/components/ui/skeleton.tsx@@ -0,0 +1,47 @@+import type { ComponentProps } from 'react'+import { cn } from '@/lib/utils'++// Loading placeholder. Pages compose these instead of a bare "Loading…" line so+// the layout keeps its shape while data arrives.+function Skeleton({ className, ...props }: ComponentProps<'div'>) {+ return (+ <div+ data-slot="skeleton"+ aria-hidden="true"+ className={cn('animate-pulse rounded-lg bg-muted', className)}+ {...props}+ />+ )+}++// Table-shaped placeholder (header bar + rows), used by the model/key lists.+function TableSkeleton({ rows = 6 }: { rows?: number }) {+ return (+ <div className="overflow-hidden rounded-2xl border">+ <div className="border-b bg-muted/30 px-4 py-3">+ <Skeleton className="h-3 w-40" />+ </div>+ {Array.from({ length: rows }).map((_, i) => (+ <div key={i} className="flex items-center gap-3 border-b px-4 py-3.5 last:border-0">+ <Skeleton className="size-4 rounded-full" />+ <Skeleton className="h-3 w-full max-w-56" />+ <Skeleton className="hidden h-3 w-16 sm:block" />+ <Skeleton className="ml-auto h-4 w-8 rounded-full" />+ </div>+ ))}+ </div>+ )+}++// Card-shaped placeholder for the section/card lists (Embeddings, Media, Premium).+function CardSkeleton({ className }: { className?: string }) {+ return (+ <div className={cn('rounded-3xl border bg-card p-5', className)}>+ <Skeleton className="h-4 w-48" />+ <Skeleton className="mt-3 h-3 w-full max-w-sm" />+ <Skeleton className="mt-2 h-3 w-full max-w-xs" />+ </div>+ )+}++export { Skeleton, TableSkeleton, CardSkeleton }diff --git a/client/src/i18n/locales/en.json b/client/src/i18n/locales/en.jsonindex 0dbe5a9b..5ca15ac1 100644--- a/client/src/i18n/locales/en.json+++ b/client/src/i18n/locales/en.json@@ -76,7 +76,7 @@"imageDesc": "Text-to-image generation models.","audioDesc": "Text-to-speech generation models.","mediaHint": "Generate via",- "mediaEmpty": "No models yet — they sync from the catalog.",+ "mediaEmpty": "No models yet. They sync from the catalog.","newBadge": "New","monthlyTokenBudget": "Monthly token budget","remaining": "remaining",@@ -136,7 +136,8 @@"copyModelId": "Copy model id","showingCount": "{shown} of {total} models","clearFilters": "Clear filters",- "noMatches": "No models match your filters."+ "noMatches": "No models match your filters.",+ "noModelsTitle": "No models configured"},"strategies": {"title": "Routing strategy",@@ -389,7 +390,9 @@"unsavedChanges": "Unsaved changes","saveChanges": "Save changes","savingChanges": "Saving…",- "tokMax": "{tokens} tok max"+ "tokMax": "{tokens} tok max",+ "emptyTitle": "No embedding models yet",+ "emptyDesc": "Embedding families appear here once you add a provider key that supports embeddings."},"fusion": {"title": "Fusion",@@ -477,5 +480,22 @@"notFound": {"title": "Page not found","description": "This page does not exist or may have moved."+ },+ "setup": {+ "title": "Getting started",+ "subtitle": "Three steps to route your first request.",+ "progress": "{done} of {total}",+ "step1Title": "Add a provider key",+ "step1Desc": "Connect at least one provider account. Free keys work.",+ "step1Cta": "Add keys",+ "step2Title": "Send a test request",+ "step2Desc": "Pick any model in the Playground and say hello.",+ "step2Cta": "Open Playground",+ "step3Title": "Connect your app",+ "step3Desc": "Use your unified API key with any OpenAI-compatible client.",+ "copyKey": "Copy API key",+ "copyUrl": "Copy base URL",+ "copiedKey": "API key copied to clipboard",+ "copiedUrl": "Base URL copied to clipboard"}}diff --git a/client/src/i18n/locales/es.json b/client/src/i18n/locales/es.jsonindex f4bf57f9..9cfeea60 100644--- a/client/src/i18n/locales/es.json+++ b/client/src/i18n/locales/es.json@@ -76,7 +76,7 @@"imageDesc": "Modelos de generación de texto a imagen.","audioDesc": "Modelos de generación de texto a voz.","mediaHint": "Generar mediante",- "mediaEmpty": "Aún no hay modelos: se sincronizan desde el catálogo.",+ "mediaEmpty": "Aún no hay modelos. Se sincronizan desde el catálogo.","newBadge": "Nuevo","monthlyTokenBudget": "Presupuesto mensual de tokens","remaining": "restante",@@ -109,7 +109,8 @@"copyModelId": "Copiar id del modelo","showingCount": "{shown} de {total} modelos","clearFilters": "Borrar filtros",- "noMatches": "Ningún modelo coincide con tus filtros."+ "noMatches": "Ningún modelo coincide con tus filtros.",+ "noModelsTitle": "No hay modelos configurados"},"strategies": {"title": "Estrategia de enrutamiento",@@ -310,7 +311,9 @@"unsavedChanges": "Cambios sin guardar","saveChanges": "Guardar cambios","savingChanges": "Guardando…",- "tokMax": "{tokens} tok máx."+ "tokMax": "{tokens} tok máx.",+ "emptyTitle": "Aún no hay modelos de embeddings",+ "emptyDesc": "Las familias de embeddings aparecen aquí cuando añades una clave de proveedor compatible con embeddings."},"fusion": {"title": "Fusión",@@ -398,5 +401,22 @@"notFound": {"title": "Página no encontrada","description": "Esta página no existe o puede haberse movido."+ },+ "setup": {+ "title": "Primeros pasos",+ "subtitle": "Tres pasos para enrutar tu primera solicitud.",+ "progress": "{done} de {total}",+ "step1Title": "Añade una clave de proveedor",+ "step1Desc": "Conecta al menos una cuenta de proveedor. Las claves gratuitas funcionan.",+ "step1Cta": "Añadir claves",+ "step2Title": "Envía una solicitud de prueba",+ "step2Desc": "Elige cualquier modelo en el Playground y saluda.",+ "step2Cta": "Abrir Playground",+ "step3Title": "Conecta tu aplicación",+ "step3Desc": "Usa tu clave API unificada con cualquier cliente compatible con OpenAI.",+ "copyKey": "Copiar clave API",+ "copyUrl": "Copiar URL base",+ "copiedKey": "Clave API copiada al portapapeles",+ "copiedUrl": "URL base copiada al portapapeles"}}diff --git a/client/src/i18n/locales/fr.json b/client/src/i18n/locales/fr.jsonindex bdd7e5ca..8e98b059 100644--- a/client/src/i18n/locales/fr.json+++ b/client/src/i18n/locales/fr.json@@ -76,7 +76,7 @@"imageDesc": "Modèles de génération texte-image.","audioDesc": "Modèles de synthèse vocale.","mediaHint": "Générer via",- "mediaEmpty": "Aucun modèle pour l'instant — ils se synchronisent depuis le catalogue.",+ "mediaEmpty": "Aucun modèle pour l'instant. Ils se synchronisent depuis le catalogue.","newBadge": "Nouveau","monthlyTokenBudget": "Budget mensuel de tokens","remaining": "restant",@@ -109,7 +109,8 @@"copyModelId": "Copier l'identifiant du modèle","showingCount": "{shown} sur {total} modèles","clearFilters": "Effacer les filtres",- "noMatches": "Aucun modèle ne correspond à vos filtres."+ "noMatches": "Aucun modèle ne correspond à vos filtres.",+ "noModelsTitle": "Aucun modèle configuré"},"strategies": {"title": "Stratégie de routage",@@ -310,7 +311,9 @@"unsavedChanges": "Modifications non enregistrées","saveChanges": "Enregistrer les modifications","savingChanges": "Enregistrement…",- "tokMax": "{tokens} tok max."+ "tokMax": "{tokens} tok max.",+ "emptyTitle": "Aucun modèle d'embeddings pour l'instant",+ "emptyDesc": "Les familles d'embeddings apparaissent ici dès que vous ajoutez une clé de fournisseur prenant en charge les embeddings."},"fusion": {"title": "Fusion",@@ -398,5 +401,22 @@"notFound": {"title": "Page introuvable","description": "Cette page n'existe pas ou a peut-être été déplacée."+ },+ "setup": {+ "title": "Premiers pas",+ "subtitle": "Trois étapes pour router votre première requête.",+ "progress": "{done} sur {total}",+ "step1Title": "Ajoutez une clé de fournisseur",+ "step1Desc": "Connectez au moins un compte fournisseur. Les clés gratuites fonctionnent.",+ "step1Cta": "Ajouter des clés",+ "step2Title": "Envoyez une requête de test",+ "step2Desc": "Choisissez un modèle dans le Playground et dites bonjour.",+ "step2Cta": "Ouvrir le Playground",+ "step3Title": "Connectez votre application",+ "step3Desc": "Utilisez votre clé API unifiée avec n'importe quel client compatible OpenAI.",+ "copyKey": "Copier la clé API",+ "copyUrl": "Copier l'URL de base",+ "copiedKey": "Clé API copiée dans le presse-papiers",+ "copiedUrl": "URL de base copiée dans le presse-papiers"}}diff --git a/client/src/i18n/locales/it.json b/client/src/i18n/locales/it.jsonindex 97fcd8fa..5e4e2111 100644--- a/client/src/i18n/locales/it.json+++ b/client/src/i18n/locales/it.json@@ -76,7 +76,7 @@"imageDesc": "Modelli di generazione testo-immagine.","audioDesc": "Modelli di generazione testo-parlato.","mediaHint": "Genera tramite",- "mediaEmpty": "Nessun modello ancora — vengono sincronizzati dal catalogo.",+ "mediaEmpty": "Nessun modello ancora. Vengono sincronizzati dal catalogo.","newBadge": "Nuovo","monthlyTokenBudget": "Budget mensile di token","remaining": "rimanenti",@@ -127,7 +127,8 @@"copyModelId": "Copia ID modello","showingCount": "{shown} di {total} modelli","clearFilters": "Cancella filtri",- "noMatches": "Nessun modello corrisponde ai tuoi filtri."+ "noMatches": "Nessun modello corrisponde ai tuoi filtri.",+ "noModelsTitle": "Nessun modello configurato"},"strategies": {"title": "Strategia di routing",@@ -331,7 +332,9 @@"unsavedChanges": "Modifiche non salvate","saveChanges": "Salva modifiche","savingChanges": "Salvataggio…",- "tokMax": "{tokens} tok max"+ "tokMax": "{tokens} tok max",+ "emptyTitle": "Ancora nessun modello di embedding",+ "emptyDesc": "Le famiglie di embedding compaiono qui quando aggiungi una chiave provider che supporta gli embedding."},"fusion": {"title": "Fusion",@@ -419,5 +422,22 @@"notFound": {"title": "Pagina non trovata","description": "Questa pagina non esiste o potrebbe essere stata spostata."+ },+ "setup": {+ "title": "Per iniziare",+ "subtitle": "Tre passaggi per instradare la tua prima richiesta.",+ "progress": "{done} di {total}",+ "step1Title": "Aggiungi una chiave provider",+ "step1Desc": "Collega almeno un account provider. Le chiavi gratuite funzionano.",+ "step1Cta": "Aggiungi chiavi",+ "step2Title": "Invia una richiesta di prova",+ "step2Desc": "Scegli un modello nel Playground e saluta.",+ "step2Cta": "Apri Playground",+ "step3Title": "Collega la tua app",+ "step3Desc": "Usa la tua chiave API unificata con qualsiasi client compatibile OpenAI.",+ "copyKey": "Copia chiave API",+ "copyUrl": "Copia URL di base",+ "copiedKey": "Chiave API copiata negli appunti",+ "copiedUrl": "URL di base copiato negli appunti"}}diff --git a/client/src/i18n/locales/pt-BR.json b/client/src/i18n/locales/pt-BR.jsonindex c727ca86..20c0468a 100644--- a/client/src/i18n/locales/pt-BR.json+++ b/client/src/i18n/locales/pt-BR.json@@ -76,7 +76,7 @@"imageDesc": "Modelos de geração de texto para imagem.","audioDesc": "Modelos de geração de texto para fala.","mediaHint": "Gerar via",- "mediaEmpty": "Ainda sem modelos — eles sincronizam do catálogo.",+ "mediaEmpty": "Ainda sem modelos. Eles sincronizam do catálogo.","newBadge": "Novo","monthlyTokenBudget": "Orçamento mensal de tokens","remaining": "restante",@@ -109,7 +109,8 @@"copyModelId": "Copiar id do modelo","showingCount": "{shown} de {total} modelos","clearFilters": "Limpar filtros",- "noMatches": "Nenhum modelo corresponde aos seus filtros."+ "noMatches": "Nenhum modelo corresponde aos seus filtros.",+ "noModelsTitle": "Nenhum modelo configurado"},"strategies": {"title": "Estratégia de roteamento",@@ -310,7 +311,9 @@"unsavedChanges": "Alterações não salvas","saveChanges": "Salvar alterações","savingChanges": "Salvando…",- "tokMax": "{tokens} tok máx."+ "tokMax": "{tokens} tok máx.",+ "emptyTitle": "Ainda sem modelos de embeddings",+ "emptyDesc": "As famílias de embeddings aparecem aqui quando você adiciona uma chave de provedor com suporte a embeddings."},"fusion": {"title": "Fusão",@@ -398,5 +401,22 @@"notFound": {"title": "Página não encontrada","description": "Esta página não existe ou pode ter sido movida."+ },+ "setup": {+ "title": "Primeiros passos",+ "subtitle": "Três passos para rotear sua primeira solicitação.",+ "progress": "{done} de {total}",+ "step1Title": "Adicione uma chave de provedor",+ "step1Desc": "Conecte pelo menos uma conta de provedor. Chaves gratuitas funcionam.",+ "step1Cta": "Adicionar chaves",+ "step2Title": "Envie uma solicitação de teste",+ "step2Desc": "Escolha qualquer modelo no Playground e diga olá.",+ "step2Cta": "Abrir Playground",+ "step3Title": "Conecte seu aplicativo",+ "step3Desc": "Use sua chave de API unificada com qualquer cliente compatível com OpenAI.",+ "copyKey": "Copiar chave de API",+ "copyUrl": "Copiar URL base",+ "copiedKey": "Chave de API copiada para a área de transferência",+ "copiedUrl": "URL base copiada para a área de transferência"}}diff --git a/client/src/i18n/locales/zh-CN.json b/client/src/i18n/locales/zh-CN.jsonindex 1fdd96f0..ec0667c2 100644--- a/client/src/i18n/locales/zh-CN.json+++ b/client/src/i18n/locales/zh-CN.json@@ -76,7 +76,7 @@"imageDesc": "文本生成图像模型。","audioDesc": "文本转语音模型。","mediaHint": "通过以下端点生成",- "mediaEmpty": "暂无模型 — 将从目录同步。",+ "mediaEmpty": "暂无模型,将从目录同步。","newBadge": "新","monthlyTokenBudget": "每月令牌额度","remaining": "剩余",@@ -127,7 +127,8 @@"copyModelId": "复制模型 ID","showingCount": "{total} 个模型中的 {shown} 个","clearFilters": "清除筛选",- "noMatches": "没有符合筛选条件的模型。"+ "noMatches": "没有符合筛选条件的模型。",+ "noModelsTitle": "尚未配置模型"},"strategies": {"title": "路由策略",@@ -333,7 +334,9 @@"unsavedChanges": "有未保存的修改","saveChanges": "保存修改","savingChanges": "保存中…",- "tokMax": "最多 {tokens} tok"+ "tokMax": "最多 {tokens} tok",+ "emptyTitle": "暂无嵌入模型",+ "emptyDesc": "添加支持嵌入的提供商密钥后,嵌入系列会显示在这里。"},"fusion": {"title": "融合",@@ -421,5 +424,22 @@"notFound": {"title": "页面未找到","description": "此页面不存在或已被移动。"+ },+ "setup": {+ "title": "快速开始",+ "subtitle": "三步完成首个请求的路由。",+ "progress": "{done} / {total}",+ "step1Title": "添加提供商密钥",+ "step1Desc": "至少连接一个提供商账户,免费密钥即可。",+ "step1Cta": "添加密钥",+ "step2Title": "发送测试请求",+ "step2Desc": "在 Playground 中任选一个模型打个招呼。",+ "step2Cta": "打开 Playground",+ "step3Title": "接入你的应用",+ "step3Desc": "在任何兼容 OpenAI 的客户端中使用统一 API 密钥。",+ "copyKey": "复制 API 密钥",+ "copyUrl": "复制基础 URL",+ "copiedKey": "API 密钥已复制到剪贴板",+ "copiedUrl": "基础 URL 已复制到剪贴板"}}diff --git a/client/src/pages/AnalyticsPage.tsx b/client/src/pages/AnalyticsPage.tsxindex cc1b4271..fdc49362 100644--- a/client/src/pages/AnalyticsPage.tsx+++ b/client/src/pages/AnalyticsPage.tsx@@ -8,6 +8,7 @@ import { apiFetch } from '@/lib/api'import { Button } from '@/components/ui/button'import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table'import { PageHeader } from '@/components/page-header'+import { Skeleton } from '@/components/ui/skeleton'import { Tooltip as HoverTooltip } from '@/components/tooltip'import { formatSqliteUtcToLocalTime } from '@/lib/utils'import { useI18n } from '@/i18n'@@ -52,7 +53,7 @@ export default function AnalyticsPage() {const { t } = useI18n()const [range, setRange] = useState<TimeRange>('7d')- const { data: summary } = useQuery({+ const { data: summary, isLoading: summaryLoading } = useQuery({queryKey: ['analytics', 'summary', range],queryFn: () => apiFetch<any>(`/api/analytics/summary?range=${range}`),})@@ -143,16 +144,22 @@ export default function AnalyticsPage() {<div className="space-y-6">{/* Summary stats */}<div className="grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-3">- <Stat label={t('analytics.requests')} value={summary?.totalRequests ?? 0} hint={requestsHint} />- <Stat label={t('analytics.successRate')} value={`${summary?.successRate ?? 0}%`} />- <Stat label={t('analytics.inputTokens')} value={formatTokens(summary?.totalInputTokens)} />- <Stat label={t('analytics.outputTokens')} value={formatTokens(summary?.totalOutputTokens)} />- <Stat label={t('analytics.avgLatency')} value={`${summary?.avgLatencyMs ?? 0} ms`} />- {/* Priced per request at the served model's paid-API equivalent- rate (not a flat frontier-model rate) — see db/model-pricing.ts.- The value is a 30-day projection; the hover hint tells the whole- story (actual period amount + whether it was extrapolated). */}- <Stat label={t('analytics.estSavings')} value={`$${savings30d.toFixed(2)}`} hint={savingsHint} />+ {summaryLoading ? (+ Array.from({ length: 6 }).map((_, i) => <Skeleton key={i} className="h-[74px] rounded-3xl" />)+ ) : (+ <>+ <Stat label={t('analytics.requests')} value={summary?.totalRequests ?? 0} hint={requestsHint} />+ <Stat label={t('analytics.successRate')} value={`${summary?.successRate ?? 0}%`} />+ <Stat label={t('analytics.inputTokens')} value={formatTokens(summary?.totalInputTokens)} />+ <Stat label={t('analytics.outputTokens')} value={formatTokens(summary?.totalOutputTokens)} />+ <Stat label={t('analytics.avgLatency')} value={`${summary?.avgLatencyMs ?? 0} ms`} />+ {/* Priced per request at the served model's paid-API equivalent+ rate (not a flat frontier-model rate) — see db/model-pricing.ts.+ The value is a 30-day projection; the hover hint tells the whole+ story (actual period amount + whether it was extrapolated). */}+ <Stat label={t('analytics.estSavings')} value={`$${savings30d.toFixed(2)}`} hint={savingsHint} />+ </>+ )}</div><div className="grid grid-cols-1 lg:grid-cols-2 gap-6">diff --git a/client/src/pages/EmbeddingsPage.tsx b/client/src/pages/EmbeddingsPage.tsxindex d93e33d0..abeef7d7 100644--- a/client/src/pages/EmbeddingsPage.tsx+++ b/client/src/pages/EmbeddingsPage.tsx@@ -1,10 +1,12 @@import { useState } from 'react'import { Link } from 'react-router-dom'import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'-import { ArrowDown, ArrowUp } from 'lucide-react'+import { ArrowDown, ArrowUp, Layers } from 'lucide-react'import { apiFetch } from '@/lib/api'import { Button } from '@/components/ui/button'import { ConfirmButton } from '@/components/confirm-button'+import { EmptyState } from '@/components/empty-state'+import { CardSkeleton } from '@/components/ui/skeleton'import { Switch } from '@/components/ui/switch'import { PageHeader } from '@/components/page-header'import { FloatingBar } from '@/components/floating-bar'@@ -136,7 +138,21 @@ export default function EmbeddingsPage() {</p>{isLoading ? (- <p className="text-sm text-muted-foreground">{t('common.loading')}</p>+ <>+ <CardSkeleton />+ <CardSkeleton />+ </>+ ) : families.length === 0 ? (+ <EmptyState+ icon={Layers}+ title={t('embeddings.emptyTitle')}+ description={t('embeddings.emptyDesc')}+ action={+ <Link to="/keys">+ <Button size="sm">{t('setup.step1Cta')}</Button>+ </Link>+ }+ />) : (families.map(f => {const u = usageByFamily.get(f.family)diff --git a/client/src/pages/FallbackPage.tsx b/client/src/pages/FallbackPage.tsxindex c76b675a..18db242a 100644--- a/client/src/pages/FallbackPage.tsx+++ b/client/src/pages/FallbackPage.tsx@@ -17,14 +17,17 @@ import {verticalListSortingStrategy,} from '@dnd-kit/sortable'import { CSS } from '@dnd-kit/utilities'-import { ChevronDown, SlidersHorizontal, Search, X } from 'lucide-react'+import { Boxes, ChevronDown, SlidersHorizontal, Search, X } from 'lucide-react'import { Link, useNavigate } from 'react-router-dom'import { useI18n } from '@/i18n'import { apiFetch } from '@/lib/api'import { Button } from '@/components/ui/button'import { CopyButton } from '@/components/copy-button'+import { EmptyState } from '@/components/empty-state'+import { GettingStarted } from '@/components/getting-started'import { Popover, PopoverTrigger, PopoverContent } from '@/components/ui/popover'import { Switch } from '@/components/ui/switch'+import { TableSkeleton } from '@/components/ui/skeleton'import { PageHeader } from '@/components/page-header'import { FloatingBar } from '@/components/floating-bar'import { ModelsTabs } from '@/components/models-tabs'@@ -830,6 +833,9 @@ export default function FallbackPage() {/><div className="space-y-6">+ {/* First-run checklist: hides itself once the install has keys + a request */}+ <GettingStarted />+{/* Monthly token budget — moved to the top */}{tokenUsage && tokenUsage.totalBudget > 0 && <TokenUsageBar data={tokenUsage} />}@@ -882,13 +888,18 @@ export default function FallbackPage() {{/* Unified routing / fallback table */}{isLoading ? (- <p className="text-sm text-muted-foreground">{t('common.loading')}</p>+ <TableSkeleton rows={8} />) : orderedGroups.length === 0 ? (- <div className="rounded-3xl border border-dashed p-8 text-center">- <p className="text-sm text-muted-foreground">- {t('models.noModelsBefore')}<a href="/keys" className="underline text-foreground">{t('models.keysPageLink')}</a>{t('models.noModelsAfter')}- </p>- </div>+ <EmptyState+ icon={Boxes}+ title={t('models.noModelsTitle')}+ description={<>{t('models.noModelsBefore')}<Link to="/keys" className="underline text-foreground">{t('models.keysPageLink')}</Link>{t('models.noModelsAfter')}</>}+ action={+ <Link to="/keys">+ <Button size="sm">{t('setup.step1Cta')}</Button>+ </Link>+ }+ />) : (<>{/* Catalog toolbar: search + capability/context filters (#343) */}@@ -951,9 +962,12 @@ export default function FallbackPage() {{/* DndContext must wrap OUTSIDE the table: it renders hidden a11ylive-region <div>s, which are invalid as direct <table> children. */}{visibleGroups.length === 0 ? (- <div className="rounded-3xl border border-dashed p-8 text-center">- <p className="text-sm text-muted-foreground">{t('models.noMatches')}</p>- </div>+ <EmptyState+ title={t('models.noMatches')}+ action={+ <Button variant="outline" size="sm" onClick={clearFilters}>{t('models.clearFilters')}</Button>+ }+ />) : draggable ? (<DndContext sensors={sensors} collisionDetection={closestCenter} onDragEnd={handleGroupedDragEnd}><div className="rounded-2xl border overflow-x-auto">diff --git a/client/src/pages/KeysPage.tsx b/client/src/pages/KeysPage.tsxindex 08de3016..50e41bb8 100644--- a/client/src/pages/KeysPage.tsx+++ b/client/src/pages/KeysPage.tsx@@ -11,7 +11,9 @@ import { Switch } from '@/components/ui/switch'import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table'import { PageHeader } from '@/components/page-header'import type { ApiKey, ApiKeyModel, ImportKey, ImportSelectedResponse, Platform, PreviewKey, PreviewResponse, ProviderQuotaState } from '../../../shared/types'-import { ChevronDown, Pencil, ExternalLink, Globe, Trash2, Upload } from 'lucide-react'+import { ChevronDown, KeyRound, Pencil, ExternalLink, Globe, Trash2, Upload } from 'lucide-react'+import { EmptyState } from '@/components/empty-state'+import { TableSkeleton } from '@/components/ui/skeleton'import { formatSqliteUtcToLocalTime } from '@/lib/utils'import { useI18n } from '@/i18n'@@ -1160,13 +1162,9 @@ export default function KeysPage() {<section><h2 className="text-sm font-medium mb-3">{t('keys.configuredProviders')}</h2>{isLoading ? (- <p className="text-sm text-muted-foreground">{t('common.loading')}</p>+ <TableSkeleton rows={4} />) : keys.length === 0 ? (- <div className="rounded-3xl border border-dashed p-8 text-center">- <p className="text-sm text-muted-foreground">- {t('keys.noProviderKeys')}- </p>- </div>+ <EmptyState icon={KeyRound} title={t('keys.noProviderKeys')} />) : (<div className="space-y-6">{grouped.map(group => (diff --git a/client/src/pages/ModelDetailPage.tsx b/client/src/pages/ModelDetailPage.tsxindex 1bc9847a..bb320b07 100644--- a/client/src/pages/ModelDetailPage.tsx+++ b/client/src/pages/ModelDetailPage.tsx@@ -9,6 +9,7 @@ import { ConfirmButton } from '@/components/confirm-button'import { Input } from '@/components/ui/input'import { Switch } from '@/components/ui/switch'import { CopyButton } from '@/components/copy-button'+import { TableSkeleton } from '@/components/ui/skeleton'import { Tooltip } from '@/components/tooltip'import { PageHeader } from '@/components/page-header'import { ModelsTabs } from '@/components/models-tabs'@@ -127,7 +128,7 @@ export default function ModelDetailPage() {</Link>{isLoading ? (- <p className="text-sm text-muted-foreground">{t('common.loading')}</p>+ <TableSkeleton rows={3} />) : members.length === 0 ? (<div className="rounded-3xl border border-dashed p-8 text-center"><p className="text-sm text-muted-foreground">{t('models.modelNotFound')}</p>diff --git a/client/src/pages/PremiumPage.tsx b/client/src/pages/PremiumPage.tsxindex 4e89ad4a..b5871686 100644--- a/client/src/pages/PremiumPage.tsx+++ b/client/src/pages/PremiumPage.tsx@@ -7,6 +7,7 @@ import { Button } from '@/components/ui/button'import { Input } from '@/components/ui/input'import { Label } from '@/components/ui/label'import { Badge } from '@/components/ui/badge'+import { CardSkeleton } from '@/components/ui/skeleton'import { useI18n } from '@/i18n'interface LicenseStatus {@@ -93,7 +94,10 @@ export default function PremiumPage() {return (<div><PageHeader title={t('premium.title')} description={t('premium.description')} />- <p className="text-sm text-muted-foreground">{t('premium.loading')}</p>+ <div className="space-y-6">+ <CardSkeleton />+ <CardSkeleton />+ </div></div>)}