mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
[Feature] UI - Teams: Add router settings to team Settings tab
Add RouterSettingsAccordion to the team edit form and a read-only display of router settings (routing strategy, retries, fallbacks, cooldown, timeout, tag filtering) in the Settings tab.
This commit is contained in:
parent
97f722f558
commit
6fd7a3ec76
1 changed files with 61 additions and 0 deletions
|
|
@ -41,6 +41,7 @@ import ObjectPermissionsView from "../object_permissions_view";
|
|||
import NumericalInput from "../shared/numerical_input";
|
||||
import VectorStoreSelector from "../vector_store_management/VectorStoreSelector";
|
||||
import EditLoggingSettings from "./EditLoggingSettings";
|
||||
import RouterSettingsAccordion, { RouterSettingsAccordionValue } from "../common_components/RouterSettingsAccordion";
|
||||
import MemberModal from "./EditMembership";
|
||||
import MemberPermissions from "./member_permissions";
|
||||
import {
|
||||
|
|
@ -98,6 +99,7 @@ export interface TeamData {
|
|||
access_group_models?: string[];
|
||||
access_group_mcp_server_ids?: string[];
|
||||
access_group_agent_ids?: string[];
|
||||
router_settings?: Record<string, any>;
|
||||
guardrails?: string[];
|
||||
policies?: string[];
|
||||
object_permission?: {
|
||||
|
|
@ -187,6 +189,7 @@ const TeamInfoView: React.FC<TeamInfoProps> = ({
|
|||
const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false);
|
||||
const [isDeleting, setIsDeleting] = useState(false);
|
||||
const [isTeamSaving, setIsTeamSaving] = useState(false);
|
||||
const [routerSettings, setRouterSettings] = useState<RouterSettingsAccordionValue | null>(null);
|
||||
const [organization, setOrganization] = useState<Organization | null>(null);
|
||||
const { userRole, userId } = useAuthorized();
|
||||
const { data: userOrganizations = [] } = useOrganizations();
|
||||
|
|
@ -588,10 +591,21 @@ const TeamInfoView: React.FC<TeamInfoProps> = ({
|
|||
updateData.access_group_ids = values.access_group_ids;
|
||||
}
|
||||
|
||||
// Handle router_settings
|
||||
if (routerSettings?.router_settings) {
|
||||
const hasValues = Object.values(routerSettings.router_settings).some(
|
||||
(value) => value !== null && value !== undefined && value !== "",
|
||||
);
|
||||
if (hasValues) {
|
||||
updateData.router_settings = routerSettings.router_settings;
|
||||
}
|
||||
}
|
||||
|
||||
const response = await teamUpdateCall(accessToken, updateData);
|
||||
|
||||
NotificationsManager.success("Team settings updated successfully");
|
||||
setIsEditing(false);
|
||||
setRouterSettings(null);
|
||||
fetchTeamInfo();
|
||||
} catch (error) {
|
||||
console.error("Error updating team:", error);
|
||||
|
|
@ -1086,6 +1100,15 @@ const TeamInfoView: React.FC<TeamInfoProps> = ({
|
|||
</Form.List>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label="Router Settings">
|
||||
<RouterSettingsAccordion
|
||||
accessToken={accessToken || ""}
|
||||
value={routerSettings || (info.router_settings ? { router_settings: info.router_settings } : undefined)}
|
||||
onChange={setRouterSettings}
|
||||
modelData={userModels.length > 0 ? { data: userModels.map((model) => ({ model_name: model })) } : undefined}
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
label={
|
||||
<span>
|
||||
|
|
@ -1373,6 +1396,44 @@ const TeamInfoView: React.FC<TeamInfoProps> = ({
|
|||
<div>TPM Limit: {info.team_member_budget_table?.tpm_limit || "No Limit"}</div>
|
||||
<div>RPM Limit: {info.team_member_budget_table?.rpm_limit || "No Limit"}</div>
|
||||
</div>
|
||||
<div>
|
||||
<Text className="font-medium">Router Settings</Text>
|
||||
{info.router_settings && Object.values(info.router_settings).some(
|
||||
(v) => v !== null && v !== undefined && v !== "" && !(Array.isArray(v) && v.length === 0)
|
||||
) ? (
|
||||
<div className="mt-1 space-y-1">
|
||||
{info.router_settings.routing_strategy && (
|
||||
<div>
|
||||
Routing Strategy:{" "}
|
||||
<Badge color="blue">{info.router_settings.routing_strategy}</Badge>
|
||||
</div>
|
||||
)}
|
||||
{info.router_settings.num_retries != null && (
|
||||
<div>Number of Retries: {info.router_settings.num_retries}</div>
|
||||
)}
|
||||
{info.router_settings.allowed_fails != null && (
|
||||
<div>Allowed Failures: {info.router_settings.allowed_fails}</div>
|
||||
)}
|
||||
{info.router_settings.cooldown_time != null && (
|
||||
<div>Cooldown Time: {info.router_settings.cooldown_time}s</div>
|
||||
)}
|
||||
{info.router_settings.timeout != null && (
|
||||
<div>Timeout: {info.router_settings.timeout}s</div>
|
||||
)}
|
||||
{info.router_settings.retry_after != null && (
|
||||
<div>Retry After: {info.router_settings.retry_after}s</div>
|
||||
)}
|
||||
{info.router_settings.fallbacks && Array.isArray(info.router_settings.fallbacks) && info.router_settings.fallbacks.length > 0 && (
|
||||
<div>Fallbacks: {info.router_settings.fallbacks.length} configured</div>
|
||||
)}
|
||||
{info.router_settings.enable_tag_filtering && (
|
||||
<div>Tag Filtering: Enabled</div>
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
<div className="text-gray-400">No router settings configured</div>
|
||||
)}
|
||||
</div>
|
||||
<div>
|
||||
<Text className="font-medium">Organization ID</Text>
|
||||
<div>{info.organization_id}</div>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue