mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
The dashboard's template picker imported autorouter_presets.json at build time, so every catalog change needed a dashboard rebuild and artifacts refresh. The catalog now lives in litellm/proxy/public_endpoints/ and GET /public/autorouter_presets serves it, fetching litellm.autorouter_presets_url (GitHub raw on main, 1h in-process cache, bundled fallback) so a merged catalog change propagates to running proxies like the model cost map does. The dashboard fetches it at runtime via useAutoRouterPresets and keeps no local copy. Resolves LIT-6764
16 lines
697 B
TypeScript
16 lines
697 B
TypeScript
import { vi } from "vitest";
|
|
import bundledPresets from "../../../../litellm/proxy/public_endpoints/autorouter_presets.json";
|
|
import { hydratePresets, type AutoRouterPresetsResponse } from "@/lib/autorouter_presets";
|
|
|
|
// Derived from the real bundled catalog so a preset edit there flows into test expectations
|
|
// instead of redding on a stale copy. Exported as vi.fn so a test can override the query state.
|
|
export const BUNDLED_PRESETS = hydratePresets(bundledPresets as AutoRouterPresetsResponse);
|
|
|
|
export const LOADED_PRESETS_QUERY = {
|
|
data: BUNDLED_PRESETS,
|
|
isPending: false,
|
|
isError: false,
|
|
refetch: vi.fn(),
|
|
};
|
|
|
|
export const useAutoRouterPresets = vi.fn(() => LOADED_PRESETS_QUERY);
|