mirror of
https://github.com/BerriAI/litellm.git
synced 2026-08-28 05:25:59 +00:00
The editor over the model layer beneath it. An Edit tiers button turns the tier list into an editor: a tier takes a name, a classifier definition, and models, between two and eight rows. Restore defaults resets to the built-in four rather than stacking them on top. Keyword rules follow a rename, an orphaned rule blocks the save, and both forms dry-run the exact payload against the backend validator before writing. The edit modal hydrates a stored custom set into rows, and an untouched open-and-save round-trips byte-identically, per-model reasoning efforts included. A form that never opens the editor submits the same bytes as before. The cost-optimization tier chart renders arbitrary tier names: the guard that returned no models for a non-built-in name is gone, and the fixed four-color array gives way to the shared cycle.
24 lines
1,010 B
TypeScript
24 lines
1,010 B
TypeScript
import React from "react";
|
|
import { CUSTOM_TIER_RESTRICTIONS, CustomTierSet, TierRestriction } from "./tier_rows";
|
|
|
|
export const restrictedBy = (
|
|
value: { custom_tier_set?: CustomTierSet },
|
|
key: keyof typeof CUSTOM_TIER_RESTRICTIONS,
|
|
): TierRestriction | undefined => (value.custom_tier_set ? CUSTOM_TIER_RESTRICTIONS[key] : undefined);
|
|
|
|
export const Restricted: React.FC<{ by: TierRestriction | undefined; children: React.ReactNode }> = ({
|
|
by,
|
|
children,
|
|
}) => (by ? <span className="block text-sm text-muted-foreground">{by.reason}</span> : <>{children}</>);
|
|
|
|
/** A labelled section whose body is replaced by the reason an edited tier set forbids it. */
|
|
export const RestrictedSection: React.FC<{
|
|
heading: string;
|
|
by: TierRestriction | undefined;
|
|
children: React.ReactNode;
|
|
}> = ({ heading, by, children }) => (
|
|
<div>
|
|
<strong className="block mb-1 font-semibold">{heading}</strong>
|
|
{by ? <span className="block text-sm text-muted-foreground">{by.reason}</span> : children}
|
|
</div>
|
|
);
|