Spaces:
Runtime error
Runtime error
Download apps/web/src/api/analytics.ts from ClaraSu/llm-router: direct link, hf CLI and curl.
- Browser
- Download file 809 Bytes
-
https://huggingface.co/spaces/ClaraSu/llm-router/resolve/main/apps/web/src/api/analytics.ts
- Command line
-
hf download hf://spaces/ClaraSu/llm-router/apps/web/src/api/analytics.ts
-
curl -L -o analytics.ts https://huggingface.co/spaces/ClaraSu/llm-router/resolve/main/apps/web/src/api/analytics.ts
809 Bytes
| import { apiFetch } from './client' | |
| import type { Summary, Trends } from '@llm-router/shared' | |
| export async function getSummary(month?: string): Promise<Summary> { | |
| const params = new URLSearchParams() | |
| if (month) params.set('month', month) | |
| const query = params.toString() | |
| const res = await apiFetch(`/v1/expense/summary${query ? `?${query}` : ''}`) | |
| if (!res.ok) throw new Error('Failed to load summary') | |
| return res.json() as Promise<Summary> | |
| } | |
| export async function getTrends(months = 6, month?: string): Promise<Trends> { | |
| const params = new URLSearchParams({ months: String(months) }) | |
| if (month) params.set('month', month) | |
| const res = await apiFetch(`/v1/expense/trends?${params.toString()}`) | |
| if (!res.ok) throw new Error('Failed to load trends') | |
| return res.json() as Promise<Trends> | |
| } | |