SPB Git forge

spb/ai-atlas

Public
41commits 1branches 0releases
4.6 MBsize
maindefault branch
12 days agolast push
HTML 77.2% TypeScript 10.5% Python 9.6% JavaScript 2.5%
1.3 KB · 28 lines tsx
Raw Blame History
1import { ImageResponse } from 'next/og';2import { Wallpaper } from '@/components/brand/og';3import { api, safe } from '@/lib/api';4import { fmtInt, num } from '@/lib/format';5import { SITE_NAME, TAGLINE } from '@/lib/site';67export const runtime = 'nodejs';8export const alt = `${SITE_NAME} — ${TAGLINE}`;9export const size = { width: 1200, height: 630 };10export const contentType = 'image/png';1112/** Root Open Graph "wallpaper": the atlas-plate mark, name + tagline and four live counters from /stats (brand-only when the API is down). */13export default async function OpenGraphImage() {14  const stats = await safe(api.stats());15  const e = stats?.entities ?? {};16  const orgs = stats ? (num(e.company) ?? 0) + (num(e.organization) ?? 0) + (num(e.lab) ?? 0) + (num(e.university) ?? 0) : null;17  const counters: [string, string][] = stats18    ? ([19        ['Models', fmtInt(e.model)],20        ['Organizations', orgs ? fmtInt(orgs) : '—'],21        ['Benchmark results', fmtInt(stats.benchmark_results)],22        ['Source documents', fmtInt(stats.documents)],23      ].filter((c) => c[1] !== '—') as [string, string][])24    : [];2526  return new ImageResponse(<Wallpaper eyebrow="Temporal knowledge graph" title="AI Atlas" subtitle={`${TAGLINE}. Every number answers: who said it, when, where, and how it was extracted.`} counters={counters} />, { ...size });27}28