From 17e3dc1c791236bb59bbafa038a02611007d6560 Mon Sep 17 00:00:00 2001 From: moe-berri Date: Tue, 8 Sep 2026 15:57:08 -0700 Subject: [PATCH] refactor(ui): move nonReasoningTierFields into its own module Upstream grew ClassificationMethodConfig.tsx to 783 lines, so the 14 lines this PR added there pushed the merge result past the 800-line max-lines cap. The helper is standalone logic with its own unit tests, so it moves out rather than the cap moving up. --- .../add_model/ClassificationMethodConfig.tsx | 14 +------------- .../add_model/nonReasoningTierFields.test.ts | 2 +- .../components/add_model/nonReasoningTierFields.ts | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 14 deletions(-) create mode 100644 ui/litellm-dashboard/src/components/add_model/nonReasoningTierFields.ts diff --git a/ui/litellm-dashboard/src/components/add_model/ClassificationMethodConfig.tsx b/ui/litellm-dashboard/src/components/add_model/ClassificationMethodConfig.tsx index 61706985654..594c6d022ce 100644 --- a/ui/litellm-dashboard/src/components/add_model/ClassificationMethodConfig.tsx +++ b/ui/litellm-dashboard/src/components/add_model/ClassificationMethodConfig.tsx @@ -17,6 +17,7 @@ import ClassifierReasoningEffortSelect from "./ClassifierReasoningEffortSelect"; import ClassifierCircuitBreakerConfig from "./ClassifierCircuitBreakerConfig"; import ClassifierVisionConfig from "./ClassifierVisionConfig"; import type { ReasoningEffort } from "./complexity_router_tiers"; +import { nonReasoningTierFields } from "./nonReasoningTierFields"; import { useComplexityScorerDefaults } from "@/app/(dashboard)/hooks/autoRouter/useComplexityScorerDefaults"; import { ClassificationFrequency, @@ -237,19 +238,6 @@ const ClassifierTypeRadios: React.FC<{ ); }; -/** The NON_REASONING keys a classifier switch carries forward, or clears for a classifier that - * cannot emit the tier. Leaving them set there is a config the backend refuses on save. */ -export const nonReasoningTierFields = ( - classifierType: ClassifierType, - value: ComplexityRouterConfigValue, -): Pick => { - if (classifierType === "llm") { - return { enable_non_reasoning_tier: value.enable_non_reasoning_tier, tiers: value.tiers }; - } - const { NON_REASONING: _cleared, ...keptTiers } = value.tiers; - return { enable_non_reasoning_tier: undefined, tiers: keptTiers }; -}; - const ClassificationMethodConfig: React.FC = ({ value, onChange, diff --git a/ui/litellm-dashboard/src/components/add_model/nonReasoningTierFields.test.ts b/ui/litellm-dashboard/src/components/add_model/nonReasoningTierFields.test.ts index 86e50130e43..3f986d57dd9 100644 --- a/ui/litellm-dashboard/src/components/add_model/nonReasoningTierFields.test.ts +++ b/ui/litellm-dashboard/src/components/add_model/nonReasoningTierFields.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from "vitest"; import type { ComplexityRouterConfigValue } from "./ComplexityRouterConfig"; -import { nonReasoningTierFields } from "./ClassificationMethodConfig"; +import { nonReasoningTierFields } from "./nonReasoningTierFields"; const enabledValue: ComplexityRouterConfigValue = { classifier_type: "llm", diff --git a/ui/litellm-dashboard/src/components/add_model/nonReasoningTierFields.ts b/ui/litellm-dashboard/src/components/add_model/nonReasoningTierFields.ts new file mode 100644 index 00000000000..2ea7a3f3b97 --- /dev/null +++ b/ui/litellm-dashboard/src/components/add_model/nonReasoningTierFields.ts @@ -0,0 +1,14 @@ +import type { ClassifierType, ComplexityRouterConfigValue } from "./ComplexityRouterConfig"; + +/** The NON_REASONING keys a classifier switch carries forward, or clears for a classifier that + * cannot emit the tier. Leaving them set there is a config the backend refuses on save. */ +export const nonReasoningTierFields = ( + classifierType: ClassifierType, + value: ComplexityRouterConfigValue, +): Pick => { + if (classifierType === "llm") { + return { enable_non_reasoning_tier: value.enable_non_reasoning_tier, tiers: value.tiers }; + } + const { NON_REASONING: _cleared, ...keptTiers } = value.tiers; + return { enable_non_reasoning_tier: undefined, tiers: keptTiers }; +};