import { ImageResponse } from 'next/og'; import { Wallpaper } from '@/components/brand/og'; import { api, safe } from '@/lib/api'; import { fmtInt, num } from '@/lib/format'; import { SITE_NAME, TAGLINE } from '@/lib/site'; export const runtime = 'nodejs'; export const alt = `${SITE_NAME} — ${TAGLINE}`; export const size = { width: 1200, height: 630 }; export const contentType = 'image/png'; /** Root Open Graph "wallpaper": the atlas-plate mark, name + tagline and four live counters from /stats (brand-only when the API is down). */ export default async function OpenGraphImage() { const stats = await safe(api.stats()); const e = stats?.entities ?? {}; const orgs = stats ? (num(e.company) ?? 0) + (num(e.organization) ?? 0) + (num(e.lab) ?? 0) + (num(e.university) ?? 0) : null; const counters: [string, string][] = stats ? ([ ['Models', fmtInt(e.model)], ['Organizations', orgs ? fmtInt(orgs) : '—'], ['Benchmark results', fmtInt(stats.benchmark_results)], ['Source documents', fmtInt(stats.documents)], ].filter((c) => c[1] !== '—') as [string, string][]) : []; return new ImageResponse(, { ...size }); }