Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

refactor(ui): move the model team selector into ModelTeamSelect to keep ModelInfoEditForm under the eslint line cap

ryan-crabbe-berri790c3ab71bf4
diff --git a/ui/litellm-dashboard/src/components/ModelInfoEditForm.tsx b/ui/litellm-dashboard/src/components/ModelInfoEditForm.tsx
index d76d7c88437..f0186ff4500 100644
--- a/ui/litellm-dashboard/src/components/ModelInfoEditForm.tsx
+++ b/ui/litellm-dashboard/src/components/ModelInfoEditForm.tsx
@@ -28,6 +28,7 @@ import type { Team } from "./key_team_helpers/key_list";
import type { CredentialItem } from "./networking";
import NumericalInput from "./shared/numerical_input";
import type { Tag } from "./tag_management/types";
+import { ModelTeamSelect } from "./view_model/ModelTeamSelect";
import VectorStoreSelector from "./vector_store_management/VectorStoreSelector";
import { formatPtuUtcDisplay, utcIsoToPickerValue } from "../utils/ptuDatetime";
import { isMaskedSecret } from "../utils/maskedSecretUtils";
@@ -810,30 +811,9 @@ const ModelInfoEditForm: React.FC<ModelInfoEditFormProps> = ({
<FieldLabel>Team</FieldLabel>
{isEditing ? (
<FormField control={form.control} name="team_id">
- {({ id, value, onChange, onBlur }) => {
- const items = (teams ?? []).map((team) => ({
- value: team.team_id,
- label: team.team_alias ? `${team.team_alias} (${team.team_id})` : team.team_id,
- }));
- return (
- <Select
- items={items}
- value={(value as string | undefined) || null}
- onValueChange={(selected: string | null) => onChange(selected ?? "")}
- >
- <SelectTrigger id={id} className="w-full" onBlur={onBlur}>
- <SelectValue placeholder="Select a team" />
- </SelectTrigger>
- <SelectContent>
- {items.map((item) => (
- <SelectItem key={item.value} value={item.value}>
- {item.label}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- );
- }}
+ {({ id, value, onChange, onBlur }) => (
+ <ModelTeamSelect id={id} value={value} onChange={onChange} onBlur={onBlur} teams={teams} />
+ )}
</FormField>
) : (
<Display>
diff --git a/ui/litellm-dashboard/src/components/view_model/ModelTeamSelect.tsx b/ui/litellm-dashboard/src/components/view_model/ModelTeamSelect.tsx
new file mode 100644
index 00000000000..e00626ea132
--- /dev/null
+++ b/ui/litellm-dashboard/src/components/view_model/ModelTeamSelect.tsx
@@ -0,0 +1,31 @@
+import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
+import type { Team } from "../key_team_helpers/key_list";
+
+interface ModelTeamSelectProps {
+ id: string;
+ value: string | undefined;
+ onChange: (teamId: string) => void;
+ onBlur: () => void;
+ teams: Team[] | null;
+}
+
+export const ModelTeamSelect: React.FC<ModelTeamSelectProps> = ({ id, value, onChange, onBlur, teams }) => {
+ const items = (teams ?? []).map((team) => ({
+ value: team.team_id,
+ label: team.team_alias ? `${team.team_alias} (${team.team_id})` : team.team_id,
+ }));
+ return (
+ <Select items={items} value={value || null} onValueChange={(selected: string | null) => onChange(selected ?? "")}>
+ <SelectTrigger id={id} className="w-full" onBlur={onBlur}>
+ <SelectValue placeholder="Select a team" />
+ </SelectTrigger>
+ <SelectContent>
+ {items.map((item) => (
+ <SelectItem key={item.value} value={item.value}>
+ {item.label}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ );
+};