From 4117d9f7860bc7bba6250682654f5cddeca4cd3f Mon Sep 17 00:00:00 2001 From: yuneng Date: Mon, 21 Sep 2026 20:01:08 +0000 Subject: [PATCH] style(ui): format complexity router files Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../ComplexityRouterAdvancedSections.tsx | 8 ++++---- .../add_model/ComplexityRouterConfig.test.tsx | 12 ++---------- .../add_model/HeuristicKeywordOverrides.tsx | 4 ++-- .../components/add_model/ReminderMarkers.tsx | 17 ++++++++++++----- .../add_model/ResponseFormatControls.tsx | 4 ++-- .../add_model/build_complexity_router_config.ts | 4 +--- .../edit_auto_router/edit_auto_router_modal.tsx | 13 ++++++++----- .../hydrate_complexity_router_config.ts | 11 ++++++----- 8 files changed, 37 insertions(+), 36 deletions(-) diff --git a/ui/litellm-dashboard/src/components/add_model/ComplexityRouterAdvancedSections.tsx b/ui/litellm-dashboard/src/components/add_model/ComplexityRouterAdvancedSections.tsx index 0412298ccdd..71f8bce76b5 100644 --- a/ui/litellm-dashboard/src/components/add_model/ComplexityRouterAdvancedSections.tsx +++ b/ui/litellm-dashboard/src/components/add_model/ComplexityRouterAdvancedSections.tsx @@ -130,7 +130,9 @@ const ComplexityRouterAdvancedSections: React.FCAdvanced: Plan-Mode Override, - children: , + children: ( + + ), }, { key: "housekeeping", @@ -195,9 +197,7 @@ const ComplexityRouterAdvancedSections: React.FC )} {onKeywordTierRulesChange && onSemanticMatchingEnabledChange && } diff --git a/ui/litellm-dashboard/src/components/add_model/ComplexityRouterConfig.test.tsx b/ui/litellm-dashboard/src/components/add_model/ComplexityRouterConfig.test.tsx index 9a8577100df..56b37b92af3 100644 --- a/ui/litellm-dashboard/src/components/add_model/ComplexityRouterConfig.test.tsx +++ b/ui/litellm-dashboard/src/components/add_model/ComplexityRouterConfig.test.tsx @@ -106,7 +106,6 @@ describe("ComplexityRouterConfig", () => { const capabilityValue = { ...defaultValue, classifier_type: "capability" as const }; rerender(); expect(screen.queryByText("Advanced: Heuristic Keyword Overrides")).not.toBeInTheDocument(); - }); it.each([ @@ -127,11 +126,7 @@ describe("ComplexityRouterConfig", () => { it.each([true, false])("shows reminder marker validation only when requested: %s", (showValidationErrors) => { const value = { ...defaultValue, reminder_markers: [{ open: "", close: "x" }] }; renderWithProviders( - , + , ); fireEvent.click(screen.getByText("Advanced: Reminder Markers")); const validation = screen.queryByText(/needs both/i); @@ -144,10 +139,7 @@ describe("ComplexityRouterConfig", () => { it("disables housekeeping sentinels when cheapest-tier routing is off", () => { renderWithProviders( - , + , ); fireEvent.click(screen.getByText("Advanced: Housekeeping Routing")); const sentinelInput = screen.getByRole("combobox", { name: "e.g., conversation title" }); diff --git a/ui/litellm-dashboard/src/components/add_model/HeuristicKeywordOverrides.tsx b/ui/litellm-dashboard/src/components/add_model/HeuristicKeywordOverrides.tsx index 696924f4e77..185f187bbfc 100644 --- a/ui/litellm-dashboard/src/components/add_model/HeuristicKeywordOverrides.tsx +++ b/ui/litellm-dashboard/src/components/add_model/HeuristicKeywordOverrides.tsx @@ -15,8 +15,8 @@ const HeuristicKeywordOverrides: React.FC<{ }> = ({ value, onChange }) => (

- Each list replaces the built-in keyword list of the same name for the heuristic scorer. Leave a list empty to - keep the built-in one. To add technical terms without replacing the list, use custom technical keywords under + Each list replaces the built-in keyword list of the same name for the heuristic scorer. Leave a list empty to keep + the built-in one. To add technical terms without replacing the list, use custom technical keywords under Classification Method.

{fields.map(([key, label]) => { diff --git a/ui/litellm-dashboard/src/components/add_model/ReminderMarkers.tsx b/ui/litellm-dashboard/src/components/add_model/ReminderMarkers.tsx index 970394291d4..c7f9ee48e0b 100644 --- a/ui/litellm-dashboard/src/components/add_model/ReminderMarkers.tsx +++ b/ui/litellm-dashboard/src/components/add_model/ReminderMarkers.tsx @@ -14,7 +14,9 @@ const ReminderMarkers: React.FC<{ const update = (index: number, patch: Partial) => onChange({ ...value, - reminder_markers: markers.map((marker, markerIndex) => (markerIndex === index ? { ...marker, ...patch } : marker)), + reminder_markers: markers.map((marker, markerIndex) => + markerIndex === index ? { ...marker, ...patch } : marker, + ), }); const remove = (index: number) => { const next = markers.filter((_, markerIndex) => markerIndex !== index); @@ -24,9 +26,9 @@ const ReminderMarkers: React.FC<{ return (

- Delimiter pairs that wrap harness-injected reminder blocks, which are stripped before classification. Setting any - pair replaces the built-in pairs, so list every pair your harness emits. Matching is case-insensitive and values - are saved lowercased. + Delimiter pairs that wrap harness-injected reminder blocks, which are stripped before classification. Setting + any pair replaces the built-in pairs, so list every pair your harness emits. Matching is case-insensitive and + values are saved lowercased.

{markers.map((marker, index) => ( @@ -53,7 +55,12 @@ const ReminderMarkers: React.FC<{ onChange={(event) => update(index, { close: event.target.value })} />
-
diff --git a/ui/litellm-dashboard/src/components/add_model/ResponseFormatControls.tsx b/ui/litellm-dashboard/src/components/add_model/ResponseFormatControls.tsx index 9edbf204a6d..6e7b1489a4c 100644 --- a/ui/litellm-dashboard/src/components/add_model/ResponseFormatControls.tsx +++ b/ui/litellm-dashboard/src/components/add_model/ResponseFormatControls.tsx @@ -27,8 +27,8 @@ const ResponseFormatControls: React.FC<{ Cap max_tokens at the tier model's output ceiling
- Replace the caller's max_tokens with the routed tier model's output ceiling so one client value fits every - tier. Off forwards the caller's value unchanged. + Replace the caller's max_tokens with the routed tier model's output ceiling so one client value fits + every tier. Off forwards the caller's value unchanged. ); diff --git a/ui/litellm-dashboard/src/components/add_model/build_complexity_router_config.ts b/ui/litellm-dashboard/src/components/add_model/build_complexity_router_config.ts index 4782a58513d..ca46e171970 100644 --- a/ui/litellm-dashboard/src/components/add_model/build_complexity_router_config.ts +++ b/ui/litellm-dashboard/src/components/add_model/build_complexity_router_config.ts @@ -752,9 +752,7 @@ export const buildComplexityRouterConfig = ({ plan_mode_patterns: cleanList(planModePatterns), housekeeping_patterns: cleanList(housekeepingPatterns), }; - const cleanedLists = Object.fromEntries( - Object.entries(cleanedListValues).filter(([, list]) => list !== undefined), - ); + const cleanedLists = Object.fromEntries(Object.entries(cleanedListValues).filter(([, list]) => list !== undefined)); const hasValidCustomClassifierTimeout = classifierType === "custom" && classifierPluginTimeoutMs !== undefined && diff --git a/ui/litellm-dashboard/src/components/edit_auto_router/edit_auto_router_modal.tsx b/ui/litellm-dashboard/src/components/edit_auto_router/edit_auto_router_modal.tsx index e6f1ccd0e17..0dafa9b330a 100644 --- a/ui/litellm-dashboard/src/components/edit_auto_router/edit_auto_router_modal.tsx +++ b/ui/litellm-dashboard/src/components/edit_auto_router/edit_auto_router_modal.tsx @@ -1,10 +1,7 @@ import AutoRouterClassifierTabs from "../add_model/AutoRouterClassifierTabs"; import { usesClassifierContext } from "../add_model/classifier_types"; export type { StoredComplexityRouterConfig } from "../add_model/build_complexity_router_config"; -import { - getForecastConfigError, - isForecastClassifier, -} from "../add_model/forecast_classifier_config"; +import { getForecastConfigError, isForecastClassifier } from "../add_model/forecast_classifier_config"; import React, { useEffect, useMemo, useState } from "react"; import { complexityRouterSchema, @@ -457,7 +454,13 @@ const EditAutoRouterModal: React.FC = ({ // Dual write: complexity_router_config.default_model (the pin marker hydratePinnedDefaultModel // reads back) and complexity_router_default_model (what the backend routes on) must always be // written together from the same value. Same pairing in add_auto_router_tab.tsx. - const keywordMatching = { keywordTierRules, escalationKeywords, semanticMatchingEnabled, embeddingModel, matchThreshold }; + const keywordMatching = { + keywordTierRules, + escalationKeywords, + semanticMatchingEnabled, + embeddingModel, + matchThreshold, + }; const updatedConfig = buildUpdatedComplexityRouterConfig( modelData.litellm_params?.complexity_router_config, complexityRouterConfig, diff --git a/ui/litellm-dashboard/src/components/edit_auto_router/hydrate_complexity_router_config.ts b/ui/litellm-dashboard/src/components/edit_auto_router/hydrate_complexity_router_config.ts index b3a9ae0a504..6dbd2b19b52 100644 --- a/ui/litellm-dashboard/src/components/edit_auto_router/hydrate_complexity_router_config.ts +++ b/ui/litellm-dashboard/src/components/edit_auto_router/hydrate_complexity_router_config.ts @@ -24,9 +24,7 @@ import { resolveComplexityDefaultModel, } from "../add_model/tier_rows"; -const isReminderMarkerPair = ( - input: unknown, -): input is { open: string; close: string } => { +const isReminderMarkerPair = (input: unknown): input is { open: string; close: string } => { if (typeof input !== "object" || input === null) { return false; } @@ -176,9 +174,12 @@ export const hydrateComplexityRouterConfig = ( ? parsedConfig.reminder_markers.filter(isReminderMarkerPair) : undefined, max_tokens_from_tier_model: - typeof parsedConfig.max_tokens_from_tier_model === "boolean" ? parsedConfig.max_tokens_from_tier_model : undefined, + typeof parsedConfig.max_tokens_from_tier_model === "boolean" + ? parsedConfig.max_tokens_from_tier_model + : undefined, classifier_plugin_timeout_ms: - typeof parsedConfig.classifier_plugin_timeout_ms === "number" && Number.isFinite(parsedConfig.classifier_plugin_timeout_ms) + typeof parsedConfig.classifier_plugin_timeout_ms === "number" && + Number.isFinite(parsedConfig.classifier_plugin_timeout_ms) ? parsedConfig.classifier_plugin_timeout_ms : undefined, };