diff --git a/scripts/generate-docs-index.mjs b/scripts/generate-docs-index.mjs index 482c435f11..69c6babd88 100644 --- a/scripts/generate-docs-index.mjs +++ b/scripts/generate-docs-index.mjs @@ -116,6 +116,52 @@ function extractContentPreview(content) { // ---------- Main ---------- +if (!fs.existsSync(DOCS_DIR)) { + if (fs.existsSync(OUT_FILE)) { + console.warn( + `[generate-docs-index] ${DOCS_DIR} not found; keeping existing generated docs index.` + ); + process.exit(0); + } + + fs.mkdirSync(path.dirname(OUT_FILE), { recursive: true }); + fs.writeFileSync( + OUT_FILE, + `// AUTO-GENERATED by scripts/generate-docs-index.mjs — DO NOT EDIT MANUALLY +// Regenerate with: node scripts/generate-docs-index.mjs + +export interface AutoGenDocItem { + slug: string; + title: string; + fileName: string; +} + +export interface AutoGenNavSection { + title: string; + items: AutoGenDocItem[]; +} + +export interface AutoGenSearchItem { + slug: string; + title: string; + fileName: string; + section: string; + content: string; + headings: string[]; +} + +export const autoNavSections: AutoGenNavSection[] = []; + +export const autoSearchIndex: AutoGenSearchItem[] = []; + +export const autoAllSlugs: string[] = []; +`, + "utf8" + ); + console.warn(`[generate-docs-index] ${DOCS_DIR} not found; generated empty docs index.`); + process.exit(0); +} + const files = fs.readdirSync(DOCS_DIR).filter((f) => f.endsWith(".md") || f.endsWith(".mdx")); const docs = []; diff --git a/src/shared/components/analytics/charts.tsx b/src/shared/components/analytics/charts.tsx index 0d5cefb1fa..70c9612342 100644 --- a/src/shared/components/analytics/charts.tsx +++ b/src/shared/components/analytics/charts.tsx @@ -966,70 +966,6 @@ export function ModelTable({ byModel, summary }) { [sortBy] ); - export function ServiceTierBreakdown({ byServiceTier, summary }) { - const data = useMemo(() => byServiceTier || [], [byServiceTier]); - const totalRequests = Number(summary?.totalRequests || 0); - const totalCost = Number(summary?.totalCost || 0); - - if (!data.length) { - return null; - } - - return ( - -
-

- Service Tier -

- Fast / Standard cost split -
-
- {data.map((tier) => { - const isFast = tier.serviceTier === "priority"; - const requestPct = - totalRequests > 0 - ? ((Number(tier.requests || 0) / totalRequests) * 100).toFixed(1) - : "0"; - const costPct = - totalCost > 0 ? ((Number(tier.cost || 0) / totalCost) * 100).toFixed(1) : "0"; - return ( -
-
-
- - {isFast ? "bolt" : "speed"} - -
-
{tier.label}
-
- {fmtFull(tier.requests)} requests · {fmt(tier.totalTokens)} tokens -
-
-
-
-
- {fmtCost(tier.cost)} -
-
{costPct}% of cost
-
-
-
-
-
-
- ); - })} -
- - ); - } const sorted = useMemo(() => { const arr = [...(byModel || [])]; arr.sort((a, b) => { @@ -1145,6 +1081,71 @@ export function ModelTable({ byModel, summary }) { ); } +export function ServiceTierBreakdown({ byServiceTier, summary }) { + const data = useMemo(() => byServiceTier || [], [byServiceTier]); + const totalRequests = Number(summary?.totalRequests || 0); + const totalCost = Number(summary?.totalCost || 0); + + if (!data.length) { + return null; + } + + return ( + +
+

+ Service Tier +

+ Fast / Standard cost split +
+
+ {data.map((tier) => { + const isFast = tier.serviceTier === "priority"; + const requestPct = + totalRequests > 0 + ? ((Number(tier.requests || 0) / totalRequests) * 100).toFixed(1) + : "0"; + const costPct = + totalCost > 0 ? ((Number(tier.cost || 0) / totalCost) * 100).toFixed(1) : "0"; + return ( +
+
+
+ + {isFast ? "bolt" : "speed"} + +
+
{tier.label}
+
+ {fmtFull(tier.requests)} requests · {fmt(tier.totalTokens)} tokens +
+
+
+
+
+ {fmtCost(tier.cost)} +
+
{costPct}% of cost
+
+
+
+
+
+
+ ); + })} +
+ + ); +} + // ── UsageDetail ──────────────────────────────────────────────────────────── export function UsageDetail({ summary }) {