Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- **feat(radar):** The Radar catalog table now shows two facts it was already receiving from the feed and dropping on the floor: the per-model rate limits (requests and tokens, per minute and per day) in a new column, and a badge when a provider's terms state it may train on the prompts you send. A limit of zero renders as zero rather than "rate-only" — for a ceiling those are opposite facts — and a model with no training statement gets no badge, because an absent statement is not a guarantee ([#12320](https://github.com/diegosouzapw/OmniRoute/pull/12320))
52 changes: 49 additions & 3 deletions src/app/(dashboard)/dashboard/radar/RadarCatalogTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,47 @@ interface RadarCatalogTableProps {
onError: (message: string) => void;
}

/**
* Compact a plain count. Locale-independent on purpose: `toLocaleString()` would
* make the rendering — and any test asserting on it — depend on the machine's
* locale.
*/
export function compactCount(value: number): string {
// The feed is JSON off the network, so the declared `number` is a hope, not a
// guarantee: a string, a NaN or an Infinity would otherwise render as
// "InfinityM" or "NaN/min" in the operator's table.
const numeric = typeof value === "number" ? value : Number(value);
if (!Number.isFinite(numeric) || numeric < 0) return "?";
if (numeric >= 1_000_000) return `${(numeric / 1_000_000).toFixed(1)}M`;
if (numeric >= 1_000) return `${(numeric / 1_000).toFixed(0)}K`;
return String(numeric);
}

function formatTokens(value: number): string {
// A monthly budget of zero means the pool is rate-limited rather than
// token-limited. That reading is specific to budgets — see `formatLimits`.
if (value === 0) return "rate-only";
if (value >= 1_000_000) return `${(value / 1_000_000).toFixed(1)}M`;
if (value >= 1_000) return `${(value / 1_000).toFixed(0)}K`;
return String(value);
return compactCount(value);
}

/**
* Render the rate limits the feed reported, and nothing else. Each of the four
* values is independently nullable, so an absent one is omitted rather than
* printed as zero — "no reported limit" and "a limit of zero" are opposite
* facts, and the second one is worth noticing. An entry with no limits at all,
* or with four nulls, reads "—".
*
* Deliberately not built on `formatTokens`: that one maps 0 to "rate-only",
* which would render a zero ceiling as "rate-only/min".
*/
export function formatLimits(entry: Pick<RadarMergedEntry, "limits">): string {
const { rpm, rpd, tpm, tpd } = entry.limits ?? {};
const parts: string[] = [];
if (rpm != null) parts.push(`${compactCount(rpm)}/min`);
if (rpd != null) parts.push(`${compactCount(rpd)}/day`);
if (tpm != null) parts.push(`${compactCount(tpm)} tok/min`);
if (tpd != null) parts.push(`${compactCount(tpd)} tok/day`);
return parts.length ? parts.join(" · ") : "—";
}

function budgetLabel(entry: RadarMergedEntry): string {
Expand Down Expand Up @@ -184,6 +220,7 @@ export function RadarCatalogTable({ entries, refreshCatalog, onError }: RadarCat
<th className="pb-3 font-medium">{t("colProvider")}</th>
<th className="pb-3 font-medium">{t("colModel")}</th>
<th className="pb-3 font-medium">{t("colQuota")}</th>
<th className="pb-3 font-medium">{t("colLimits")}</th>
<th className="pb-3 font-medium">{t("colContext")}</th>
<th className="pb-3 font-medium">{t("colCapabilities")}</th>
<th className="pb-3 font-medium">{t("colTos")}</th>
Expand Down Expand Up @@ -245,6 +282,7 @@ export function RadarCatalogTable({ entries, refreshCatalog, onError }: RadarCat
)}
</td>
<td className="py-3 text-sm">{budgetLabel(entry)}</td>
<td className="py-3 text-sm text-text-muted">{formatLimits(entry)}</td>
<td className="py-3 text-sm text-text-muted">
{entry.contextWindow ? `${(entry.contextWindow / 1000).toFixed(0)}K` : "—"}
</td>
Expand Down Expand Up @@ -281,6 +319,14 @@ export function RadarCatalogTable({ entries, refreshCatalog, onError }: RadarCat
>
{entry.tos}
</span>
{entry.trainsOnPrompts === true && (
<span
className="ml-1 text-xs px-2 py-1 rounded bg-orange-500/10 text-orange-400"
title={t("trainsOnPromptsHelp")}
>
{t("trainsOnPrompts")}
</span>
)}
</td>
<td className="py-3 pl-3">
{editingKey === key ? (
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/messages/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -13370,6 +13370,9 @@
"colContext": "السياق",
"colCapabilities": "القدرات",
"colTos": "مخاطر شروط الخدمة",
"colLimits": "__MISSING__:Rate limits",
"trainsOnPrompts": "__MISSING__:Trains on prompts",
"trainsOnPromptsHelp": "__MISSING__:This provider's terms state it may train on the prompts you send. Models without this badge either state they do not, or do not document it — an absent statement is not a guarantee.",
"newBadge": "جديد",
"setupGuide": "دليل الإعداد",
"disabledByFeed": "معطل بواسطة تغذية الرادار",
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/messages/az.json
Original file line number Diff line number Diff line change
Expand Up @@ -13370,6 +13370,9 @@
"colContext": "Kontekst",
"colCapabilities": "İmkanlar",
"colTos": "ToS Riski",
"colLimits": "__MISSING__:Rate limits",
"trainsOnPrompts": "__MISSING__:Trains on prompts",
"trainsOnPromptsHelp": "__MISSING__:This provider's terms state it may train on the prompts you send. Models without this badge either state they do not, or do not document it — an absent statement is not a guarantee.",
"newBadge": "yeni",
"setupGuide": "Quraşdırma bələdçisi",
"disabledByFeed": "Radar axını tərəfindən deaktiv edilmişdir",
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/messages/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -13370,6 +13370,9 @@
"colContext": "Контекст",
"colCapabilities": "Възможности",
"colTos": "Риск от ToS",
"colLimits": "__MISSING__:Rate limits",
"trainsOnPrompts": "__MISSING__:Trains on prompts",
"trainsOnPromptsHelp": "__MISSING__:This provider's terms state it may train on the prompts you send. Models without this badge either state they do not, or do not document it — an absent statement is not a guarantee.",
"newBadge": "нов",
"setupGuide": "Ръководство за настройка",
"disabledByFeed": "Деактивирано от фийда на радара",
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/messages/bn.json
Original file line number Diff line number Diff line change
Expand Up @@ -13370,6 +13370,9 @@
"colContext": "প্রসঙ্গ",
"colCapabilities": "সক্ষমতা",
"colTos": "ToS ঝুঁকি",
"colLimits": "__MISSING__:Rate limits",
"trainsOnPrompts": "__MISSING__:Trains on prompts",
"trainsOnPromptsHelp": "__MISSING__:This provider's terms state it may train on the prompts you send. Models without this badge either state they do not, or do not document it — an absent statement is not a guarantee.",
"newBadge": "নতুন",
"setupGuide": "সেটআপ গাইড",
"disabledByFeed": "রাডার ফিড দ্বারা নিষ্ক্রিয়",
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/messages/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -13370,6 +13370,9 @@
"colContext": "Kontext",
"colCapabilities": "Schopnosti",
"colTos": "Riziko ToS",
"colLimits": "__MISSING__:Rate limits",
"trainsOnPrompts": "__MISSING__:Trains on prompts",
"trainsOnPromptsHelp": "__MISSING__:This provider's terms state it may train on the prompts you send. Models without this badge either state they do not, or do not document it — an absent statement is not a guarantee.",
"newBadge": "nové",
"setupGuide": "Průvodce nastavením",
"disabledByFeed": "Zakázáno zdrojem Radar",
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/messages/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -13370,6 +13370,9 @@
"colContext": "Kontekst",
"colCapabilities": "Funktioner",
"colTos": "ToS Risiko",
"colLimits": "__MISSING__:Rate limits",
"trainsOnPrompts": "__MISSING__:Trains on prompts",
"trainsOnPromptsHelp": "__MISSING__:This provider's terms state it may train on the prompts you send. Models without this badge either state they do not, or do not document it — an absent statement is not a guarantee.",
"newBadge": "ny",
"setupGuide": "Opsætningsvejledning",
"disabledByFeed": "Deaktiveret af Radar feed",
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/messages/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -13377,6 +13377,9 @@
"colContext": "Kontext",
"colCapabilities": "Fähigkeiten",
"colTos": "ToS-Risiko",
"colLimits": "__MISSING__:Rate limits",
"trainsOnPrompts": "__MISSING__:Trains on prompts",
"trainsOnPromptsHelp": "__MISSING__:This provider's terms state it may train on the prompts you send. Models without this badge either state they do not, or do not document it — an absent statement is not a guarantee.",
"newBadge": "neu",
"setupGuide": "Einrichtungsanleitung",
"disabledByFeed": "Durch den Radar-Feed deaktiviert",
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/messages/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -13370,6 +13370,9 @@
"colContext": "Contexto",
"colCapabilities": "Capacidades",
"colTos": "Riesgo de ToS",
"colLimits": "__MISSING__:Rate limits",
"trainsOnPrompts": "__MISSING__:Trains on prompts",
"trainsOnPromptsHelp": "__MISSING__:This provider's terms state it may train on the prompts you send. Models without this badge either state they do not, or do not document it — an absent statement is not a guarantee.",
"newBadge": "nuevo",
"setupGuide": "Guía de configuración",
"disabledByFeed": "Desactivado por el feed de Radar",
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/messages/fa.json
Original file line number Diff line number Diff line change
Expand Up @@ -13370,6 +13370,9 @@
"colContext": "زمینه",
"colCapabilities": "قابلیت‌ها",
"colTos": "ریسک شرایط خدمات",
"colLimits": "__MISSING__:Rate limits",
"trainsOnPrompts": "__MISSING__:Trains on prompts",
"trainsOnPromptsHelp": "__MISSING__:This provider's terms state it may train on the prompts you send. Models without this badge either state they do not, or do not document it — an absent statement is not a guarantee.",
"newBadge": "جدید",
"setupGuide": "راهنمای راه‌اندازی",
"disabledByFeed": "غیرفعال شده توسط فید رادار",
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/messages/fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -13370,6 +13370,9 @@
"colContext": "Konteksti",
"colCapabilities": "Ominaisuudet",
"colTos": "ToS-riski",
"colLimits": "__MISSING__:Rate limits",
"trainsOnPrompts": "__MISSING__:Trains on prompts",
"trainsOnPromptsHelp": "__MISSING__:This provider's terms state it may train on the prompts you send. Models without this badge either state they do not, or do not document it — an absent statement is not a guarantee.",
"newBadge": "uusi",
"setupGuide": "Asennusopas",
"disabledByFeed": "Poissa käytöstä Radar-syötteen vuoksi",
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/messages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -13370,6 +13370,9 @@
"colContext": "Contexte",
"colCapabilities": "Capacités",
"colTos": "Risque des CGU",
"colLimits": "__MISSING__:Rate limits",
"trainsOnPrompts": "__MISSING__:Trains on prompts",
"trainsOnPromptsHelp": "__MISSING__:This provider's terms state it may train on the prompts you send. Models without this badge either state they do not, or do not document it — an absent statement is not a guarantee.",
"newBadge": "nouveau",
"setupGuide": "Guide de configuration",
"disabledByFeed": "Désactivé par le flux Radar",
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/messages/gu.json
Original file line number Diff line number Diff line change
Expand Up @@ -13370,6 +13370,9 @@
"colContext": "સંદર્ભ",
"colCapabilities": "ક્ષમતાઓ",
"colTos": "ToS જોખમ",
"colLimits": "__MISSING__:Rate limits",
"trainsOnPrompts": "__MISSING__:Trains on prompts",
"trainsOnPromptsHelp": "__MISSING__:This provider's terms state it may train on the prompts you send. Models without this badge either state they do not, or do not document it — an absent statement is not a guarantee.",
"newBadge": "નવું",
"setupGuide": "સેટઅપ માર્ગદર્શિકા",
"disabledByFeed": "રેડાર ફીડ દ્વારા અક્ષિપ્ત",
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/messages/he.json
Original file line number Diff line number Diff line change
Expand Up @@ -13370,6 +13370,9 @@
"colContext": "הקשר",
"colCapabilities": "יכולות",
"colTos": "סיכון תנאי שירות",
"colLimits": "__MISSING__:Rate limits",
"trainsOnPrompts": "__MISSING__:Trains on prompts",
"trainsOnPromptsHelp": "__MISSING__:This provider's terms state it may train on the prompts you send. Models without this badge either state they do not, or do not document it — an absent statement is not a guarantee.",
"newBadge": "חדש",
"setupGuide": "מדריך התקנה",
"disabledByFeed": "מושבת על ידי פיד רדאר",
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/messages/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -13370,6 +13370,9 @@
"colContext": "संदर्भ",
"colCapabilities": "क्षमताएँ",
"colTos": "ToS जोखिम",
"colLimits": "__MISSING__:Rate limits",
"trainsOnPrompts": "__MISSING__:Trains on prompts",
"trainsOnPromptsHelp": "__MISSING__:This provider's terms state it may train on the prompts you send. Models without this badge either state they do not, or do not document it — an absent statement is not a guarantee.",
"newBadge": "नया",
"setupGuide": "सेटअप गाइड",
"disabledByFeed": "रडार फीड द्वारा अक्षम",
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/messages/hu.json
Original file line number Diff line number Diff line change
Expand Up @@ -13370,6 +13370,9 @@
"colContext": "Kontextus",
"colCapabilities": "Képességek",
"colTos": "ToS Kockázat",
"colLimits": "__MISSING__:Rate limits",
"trainsOnPrompts": "__MISSING__:Trains on prompts",
"trainsOnPromptsHelp": "__MISSING__:This provider's terms state it may train on the prompts you send. Models without this badge either state they do not, or do not document it — an absent statement is not a guarantee.",
"newBadge": "új",
"setupGuide": "Beállítási útmutató",
"disabledByFeed": "A Radar feed letiltotta",
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/messages/id.json
Original file line number Diff line number Diff line change
Expand Up @@ -13370,6 +13370,9 @@
"colContext": "Konteks",
"colCapabilities": "Kemampuan",
"colTos": "Risiko ToS",
"colLimits": "__MISSING__:Rate limits",
"trainsOnPrompts": "__MISSING__:Trains on prompts",
"trainsOnPromptsHelp": "__MISSING__:This provider's terms state it may train on the prompts you send. Models without this badge either state they do not, or do not document it — an absent statement is not a guarantee.",
"newBadge": "baru",
"setupGuide": "Panduan pengaturan",
"disabledByFeed": "Dinonaktifkan oleh umpan Radar",
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/messages/in.json
Original file line number Diff line number Diff line change
Expand Up @@ -13370,6 +13370,9 @@
"colContext": "संदर्भ",
"colCapabilities": "क्षमताएँ",
"colTos": "ToS जोखिम",
"colLimits": "__MISSING__:Rate limits",
"trainsOnPrompts": "__MISSING__:Trains on prompts",
"trainsOnPromptsHelp": "__MISSING__:This provider's terms state it may train on the prompts you send. Models without this badge either state they do not, or do not document it — an absent statement is not a guarantee.",
"newBadge": "नया",
"setupGuide": "सेटअप गाइड",
"disabledByFeed": "रडार फीड द्वारा अक्षम",
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/messages/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -13370,6 +13370,9 @@
"colContext": "Contesto",
"colCapabilities": "Capacità",
"colTos": "Rischio ToS",
"colLimits": "__MISSING__:Rate limits",
"trainsOnPrompts": "__MISSING__:Trains on prompts",
"trainsOnPromptsHelp": "__MISSING__:This provider's terms state it may train on the prompts you send. Models without this badge either state they do not, or do not document it — an absent statement is not a guarantee.",
"newBadge": "nuovo",
"setupGuide": "Guida alla configurazione",
"disabledByFeed": "Disabilitato dal feed Radar",
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/messages/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -13370,6 +13370,9 @@
"colContext": "コンテキスト",
"colCapabilities": "機能",
"colTos": "ToSリスク",
"colLimits": "__MISSING__:Rate limits",
"trainsOnPrompts": "__MISSING__:Trains on prompts",
"trainsOnPromptsHelp": "__MISSING__:This provider's terms state it may train on the prompts you send. Models without this badge either state they do not, or do not document it — an absent statement is not a guarantee.",
"newBadge": "新しい",
"setupGuide": "セットアップガイド",
"disabledByFeed": "レーダーフィードによって無効化されています",
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/messages/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -13370,6 +13370,9 @@
"colContext": "컨텍스트",
"colCapabilities": "기능",
"colTos": "ToS 위험",
"colLimits": "__MISSING__:Rate limits",
"trainsOnPrompts": "__MISSING__:Trains on prompts",
"trainsOnPromptsHelp": "__MISSING__:This provider's terms state it may train on the prompts you send. Models without this badge either state they do not, or do not document it — an absent statement is not a guarantee.",
"newBadge": "새로 만들기",
"setupGuide": "설정 가이드",
"disabledByFeed": "레이더 피드에 의해 비활성화됨",
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/messages/mr.json
Original file line number Diff line number Diff line change
Expand Up @@ -13370,6 +13370,9 @@
"colContext": "संदर्भ",
"colCapabilities": "क्षमता",
"colTos": "ToS धोका",
"colLimits": "__MISSING__:Rate limits",
"trainsOnPrompts": "__MISSING__:Trains on prompts",
"trainsOnPromptsHelp": "__MISSING__:This provider's terms state it may train on the prompts you send. Models without this badge either state they do not, or do not document it — an absent statement is not a guarantee.",
"newBadge": "नवीन",
"setupGuide": "सेटअप मार्गदर्शक",
"disabledByFeed": "रडार फीडद्वारे अक्षम",
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/messages/ms.json
Original file line number Diff line number Diff line change
Expand Up @@ -13370,6 +13370,9 @@
"colContext": "Konteks",
"colCapabilities": "Kebolehan",
"colTos": "Risiko ToS",
"colLimits": "__MISSING__:Rate limits",
"trainsOnPrompts": "__MISSING__:Trains on prompts",
"trainsOnPromptsHelp": "__MISSING__:This provider's terms state it may train on the prompts you send. Models without this badge either state they do not, or do not document it — an absent statement is not a guarantee.",
"newBadge": "baru",
"setupGuide": "Panduan penyediaan",
"disabledByFeed": "Dilumpuhkan oleh suapan Radar",
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/messages/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -13370,6 +13370,9 @@
"colContext": "Context",
"colCapabilities": "Capaciteiten",
"colTos": "ToS Risico",
"colLimits": "__MISSING__:Rate limits",
"trainsOnPrompts": "__MISSING__:Trains on prompts",
"trainsOnPromptsHelp": "__MISSING__:This provider's terms state it may train on the prompts you send. Models without this badge either state they do not, or do not document it — an absent statement is not a guarantee.",
"newBadge": "nieuw",
"setupGuide": "Installatiehandleiding",
"disabledByFeed": "Uitgeschakeld door Radar-feed",
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/messages/no.json
Original file line number Diff line number Diff line change
Expand Up @@ -13370,6 +13370,9 @@
"colContext": "Kontekst",
"colCapabilities": "Muligheter",
"colTos": "ToS Risiko",
"colLimits": "__MISSING__:Rate limits",
"trainsOnPrompts": "__MISSING__:Trains on prompts",
"trainsOnPromptsHelp": "__MISSING__:This provider's terms state it may train on the prompts you send. Models without this badge either state they do not, or do not document it — an absent statement is not a guarantee.",
"newBadge": "ny",
"setupGuide": "Oppsettsveiledning",
"disabledByFeed": "Deaktivert av Radar-strøm",
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/messages/phi.json
Original file line number Diff line number Diff line change
Expand Up @@ -13370,6 +13370,9 @@
"colContext": "Context",
"colCapabilities": "Capabilities",
"colTos": "ToS Risk",
"colLimits": "__MISSING__:Rate limits",
"trainsOnPrompts": "__MISSING__:Trains on prompts",
"trainsOnPromptsHelp": "__MISSING__:This provider's terms state it may train on the prompts you send. Models without this badge either state they do not, or do not document it — an absent statement is not a guarantee.",
"newBadge": "new",
"setupGuide": "Setup guide",
"disabledByFeed": "Disabled by Radar feed",
Expand Down
Loading
Loading