mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-11 22:51:28 +00:00
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.
This commit is contained in:
parent
c7b80f1966
commit
17e3dc1c79
3 changed files with 16 additions and 14 deletions
|
|
@ -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<ComplexityRouterConfigValue, "enable_non_reasoning_tier" | "tiers"> => {
|
||||
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<ClassificationMethodConfigProps> = ({
|
||||
value,
|
||||
onChange,
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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<ComplexityRouterConfigValue, "enable_non_reasoning_tier" | "tiers"> => {
|
||||
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 };
|
||||
};
|
||||
Loading…
Add table
Reference in a new issue