mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-10 03:28:53 +00:00
fix(ui): show guardrails selector for internal users in key edit view
This commit is contained in:
parent
d4125edb59
commit
f81b252e9b
1 changed files with 4 additions and 2 deletions
|
|
@ -6,6 +6,7 @@ import { InfoCircleOutlined } from "@ant-design/icons";
|
|||
import { TextInput, Button as TremorButton } from "@tremor/react";
|
||||
import { Form, Input, Select, Switch, Tooltip } from "antd";
|
||||
import { useEffect, useState } from "react";
|
||||
import { rolesWithWriteAccess } from "../../utils/roles";
|
||||
import AgentSelector from "../agent_management/AgentSelector";
|
||||
import AccessGroupSelector from "../common_components/AccessGroupSelector";
|
||||
import { mapInternalToDisplayNames } from "../callback_info_helpers";
|
||||
|
|
@ -84,6 +85,7 @@ export function KeyEditView({
|
|||
userRole,
|
||||
premiumUser = false,
|
||||
}: KeyEditViewProps) {
|
||||
const canEditGuardrails = premiumUser || (userRole != null && rolesWithWriteAccess.includes(userRole));
|
||||
const [form] = Form.useForm();
|
||||
const [promptsList, setPromptsList] = useState<string[]>([]);
|
||||
const [tagsList, setTagsList] = useState<Record<string, Tag>>({});
|
||||
|
|
@ -443,7 +445,7 @@ export function KeyEditView({
|
|||
form.setFieldValue("guardrails", v);
|
||||
}}
|
||||
accessToken={accessToken}
|
||||
disabled={!premiumUser}
|
||||
disabled={!canEditGuardrails}
|
||||
/>
|
||||
)}
|
||||
</Form.Item>
|
||||
|
|
@ -460,7 +462,7 @@ export function KeyEditView({
|
|||
name="disable_global_guardrails"
|
||||
valuePropName="checked"
|
||||
>
|
||||
<Switch disabled={!premiumUser} checkedChildren="Yes" unCheckedChildren="No" />
|
||||
<Switch disabled={!canEditGuardrails} checkedChildren="Yes" unCheckedChildren="No" />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue