forked from phoenix/litellm-mirror
build(ui): add enterprise cta
This commit is contained in:
parent
4e230f0a2e
commit
01adeda2e4
8 changed files with 106 additions and 30 deletions
|
@ -837,6 +837,7 @@ class ConfigList(LiteLLMBase):
|
||||||
field_value: Any
|
field_value: Any
|
||||||
stored_in_db: Optional[bool]
|
stored_in_db: Optional[bool]
|
||||||
field_default_value: Any
|
field_default_value: Any
|
||||||
|
premium_field: bool = False
|
||||||
|
|
||||||
|
|
||||||
class ConfigGeneralSettings(LiteLLMBase):
|
class ConfigGeneralSettings(LiteLLMBase):
|
||||||
|
|
|
@ -9918,6 +9918,9 @@ async def alerting_settings(
|
||||||
field_value=_slack_alerting_args_dict.get(field_name, None),
|
field_value=_slack_alerting_args_dict.get(field_name, None),
|
||||||
stored_in_db=_stored_in_db,
|
stored_in_db=_stored_in_db,
|
||||||
field_default_value=field_info.default,
|
field_default_value=field_info.default,
|
||||||
|
premium_field=(
|
||||||
|
True if field_name == "region_outage_alert_ttl" else False
|
||||||
|
),
|
||||||
)
|
)
|
||||||
return_val.append(_response_obj)
|
return_val.append(_response_obj)
|
||||||
return return_val
|
return return_val
|
||||||
|
|
|
@ -182,6 +182,7 @@ const CreateKeyPage = () => {
|
||||||
userID={userID}
|
userID={userID}
|
||||||
userRole={userRole}
|
userRole={userRole}
|
||||||
accessToken={accessToken}
|
accessToken={accessToken}
|
||||||
|
premiumUser={premiumUser}
|
||||||
/>
|
/>
|
||||||
) : page == "budgets" ? (
|
) : page == "budgets" ? (
|
||||||
<BudgetPanel accessToken={accessToken} />
|
<BudgetPanel accessToken={accessToken} />
|
||||||
|
|
|
@ -25,13 +25,18 @@ interface alertingSettingsItem {
|
||||||
field_default_value: any;
|
field_default_value: any;
|
||||||
field_description: string;
|
field_description: string;
|
||||||
stored_in_db: boolean | null;
|
stored_in_db: boolean | null;
|
||||||
|
premium_field: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface AlertingSettingsProps {
|
interface AlertingSettingsProps {
|
||||||
accessToken: string | null;
|
accessToken: string | null;
|
||||||
|
premiumUser: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const AlertingSettings: React.FC<AlertingSettingsProps> = ({ accessToken }) => {
|
const AlertingSettings: React.FC<AlertingSettingsProps> = ({
|
||||||
|
accessToken,
|
||||||
|
premiumUser,
|
||||||
|
}) => {
|
||||||
const [alertingSettings, setAlertingSettings] = useState<
|
const [alertingSettings, setAlertingSettings] = useState<
|
||||||
alertingSettingsItem[]
|
alertingSettingsItem[]
|
||||||
>([]);
|
>([]);
|
||||||
|
@ -116,6 +121,7 @@ const AlertingSettings: React.FC<AlertingSettingsProps> = ({ accessToken }) => {
|
||||||
handleInputChange={handleInputChange}
|
handleInputChange={handleInputChange}
|
||||||
handleResetField={handleResetField}
|
handleResetField={handleResetField}
|
||||||
handleSubmit={handleSubmit}
|
handleSubmit={handleSubmit}
|
||||||
|
premiumUser={premiumUser}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,6 +9,7 @@ interface AlertingSetting {
|
||||||
field_type: string;
|
field_type: string;
|
||||||
field_value: any;
|
field_value: any;
|
||||||
stored_in_db: boolean | null;
|
stored_in_db: boolean | null;
|
||||||
|
premium_field: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface DynamicFormProps {
|
interface DynamicFormProps {
|
||||||
|
@ -16,6 +17,7 @@ interface DynamicFormProps {
|
||||||
handleInputChange: (fieldName: string, newValue: any) => void;
|
handleInputChange: (fieldName: string, newValue: any) => void;
|
||||||
handleResetField: (fieldName: string, index: number) => void;
|
handleResetField: (fieldName: string, index: number) => void;
|
||||||
handleSubmit: (formValues: Record<string, any>) => void;
|
handleSubmit: (formValues: Record<string, any>) => void;
|
||||||
|
premiumUser: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const DynamicForm: React.FC<DynamicFormProps> = ({
|
const DynamicForm: React.FC<DynamicFormProps> = ({
|
||||||
|
@ -23,19 +25,27 @@ const DynamicForm: React.FC<DynamicFormProps> = ({
|
||||||
handleInputChange,
|
handleInputChange,
|
||||||
handleResetField,
|
handleResetField,
|
||||||
handleSubmit,
|
handleSubmit,
|
||||||
|
premiumUser,
|
||||||
}) => {
|
}) => {
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
|
|
||||||
const onFinish = () => {
|
const onFinish = () => {
|
||||||
const formData = form.getFieldsValue();
|
const formData = form.getFieldsValue();
|
||||||
|
const isEmpty = Object.values(formData).some(
|
||||||
|
(value) => value === "" || value === null || value === undefined
|
||||||
|
);
|
||||||
|
if (!isEmpty) {
|
||||||
handleSubmit(formData);
|
handleSubmit(formData);
|
||||||
|
} else {
|
||||||
|
console.log("Some form fields are empty.");
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form form={form} onFinish={onFinish} labelAlign="left">
|
<Form form={form} onFinish={onFinish} labelAlign="left">
|
||||||
{alertingSettings.map((value, index) => (
|
{alertingSettings.map((value, index) => (
|
||||||
<TableRow key={index}>
|
<TableRow key={index}>
|
||||||
<TableCell>
|
<TableCell align="center">
|
||||||
<Text>{value.field_name}</Text>
|
<Text>{value.field_name}</Text>
|
||||||
<p
|
<p
|
||||||
style={{
|
style={{
|
||||||
|
@ -48,6 +58,8 @@ const DynamicForm: React.FC<DynamicFormProps> = ({
|
||||||
{value.field_description}
|
{value.field_description}
|
||||||
</p>
|
</p>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
|
{value.premium_field ? (
|
||||||
|
premiumUser ? (
|
||||||
<Form.Item name={value.field_name}>
|
<Form.Item name={value.field_name}>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
{value.field_type === "Integer" ? (
|
{value.field_type === "Integer" ? (
|
||||||
|
@ -64,6 +76,34 @@ const DynamicForm: React.FC<DynamicFormProps> = ({
|
||||||
)}
|
)}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
) : (
|
||||||
|
<TableCell>
|
||||||
|
<Button className="flex items-center justify-center">
|
||||||
|
<a href="https://forms.gle/W3U4PZpJGFHWtHyA9" target="_blank">
|
||||||
|
✨ Enterprise Feature
|
||||||
|
</a>
|
||||||
|
</Button>
|
||||||
|
</TableCell>
|
||||||
|
)
|
||||||
|
) : (
|
||||||
|
<Form.Item name={value.field_name} className="mb-0">
|
||||||
|
<TableCell>
|
||||||
|
{value.field_type === "Integer" ? (
|
||||||
|
<InputNumber
|
||||||
|
step={1}
|
||||||
|
value={value.field_value}
|
||||||
|
onChange={(e) => handleInputChange(value.field_name, e)}
|
||||||
|
className="p-0"
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<Input
|
||||||
|
value={value.field_value}
|
||||||
|
onChange={(e) => handleInputChange(value.field_name, e)}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</TableCell>
|
||||||
|
</Form.Item>
|
||||||
|
)}
|
||||||
<TableCell>
|
<TableCell>
|
||||||
{value.stored_in_db == true ? (
|
{value.stored_in_db == true ? (
|
||||||
<Badge icon={CheckCircleIcon} className="text-white">
|
<Badge icon={CheckCircleIcon} className="text-white">
|
||||||
|
|
|
@ -27,9 +27,9 @@ const TimeToFirstToken: React.FC<TimeToFirstTokenProps> = ({
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<div>
|
<div>
|
||||||
<Callout title="Premium Feature" color="teal" className="mt-2 mb-4">
|
<Callout title="✨ Enterprise Feature" color="teal" className="mt-2 mb-4">
|
||||||
Premium features are available for users with a specific license, please
|
Enterprise features are available for users with a specific license,
|
||||||
contact LiteLLM to unlock this limitation.
|
please contact LiteLLM to unlock this limitation.
|
||||||
</Callout>
|
</Callout>
|
||||||
<Button variant="primary">
|
<Button variant="primary">
|
||||||
<a href="https://forms.gle/W3U4PZpJGFHWtHyA9" target="_blank">
|
<a href="https://forms.gle/W3U4PZpJGFHWtHyA9" target="_blank">
|
||||||
|
|
|
@ -88,7 +88,7 @@ const Navbar: React.FC<NavbarProps> = ({
|
||||||
textDecoration: "underline",
|
textDecoration: "underline",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Request hosted proxy
|
Get enterpise license
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
|
@ -36,6 +36,7 @@ interface SettingsPageProps {
|
||||||
accessToken: string | null;
|
accessToken: string | null;
|
||||||
userRole: string | null;
|
userRole: string | null;
|
||||||
userID: string | null;
|
userID: string | null;
|
||||||
|
premiumUser: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface AlertingVariables {
|
interface AlertingVariables {
|
||||||
|
@ -88,6 +89,7 @@ const Settings: React.FC<SettingsPageProps> = ({
|
||||||
accessToken,
|
accessToken,
|
||||||
userRole,
|
userRole,
|
||||||
userID,
|
userID,
|
||||||
|
premiumUser,
|
||||||
}) => {
|
}) => {
|
||||||
const [callbacks, setCallbacks] =
|
const [callbacks, setCallbacks] =
|
||||||
useState<AlertingObject[]>(defaultLoggingObject);
|
useState<AlertingObject[]>(defaultLoggingObject);
|
||||||
|
@ -460,12 +462,32 @@ const Settings: React.FC<SettingsPageProps> = ({
|
||||||
([key, value], index) => (
|
([key, value], index) => (
|
||||||
<TableRow key={index}>
|
<TableRow key={index}>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
|
{key == "region_outage_alerts" ? (
|
||||||
|
premiumUser ? (
|
||||||
<Switch
|
<Switch
|
||||||
id="switch"
|
id="switch"
|
||||||
name="switch"
|
name="switch"
|
||||||
checked={isAlertOn(key)}
|
checked={isAlertOn(key)}
|
||||||
onChange={() => handleSwitchChange(key)}
|
onChange={() => handleSwitchChange(key)}
|
||||||
/>
|
/>
|
||||||
|
) : (
|
||||||
|
<Button className="flex items-center justify-center">
|
||||||
|
<a
|
||||||
|
href="https://forms.gle/W3U4PZpJGFHWtHyA9"
|
||||||
|
target="_blank"
|
||||||
|
>
|
||||||
|
✨ Enterprise Feature
|
||||||
|
</a>
|
||||||
|
</Button>
|
||||||
|
)
|
||||||
|
) : (
|
||||||
|
<Switch
|
||||||
|
id="switch"
|
||||||
|
name="switch"
|
||||||
|
checked={isAlertOn(key)}
|
||||||
|
onChange={() => handleSwitchChange(key)}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
<Text>{value}</Text>
|
<Text>{value}</Text>
|
||||||
|
@ -499,7 +521,10 @@ const Settings: React.FC<SettingsPageProps> = ({
|
||||||
</Card>
|
</Card>
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
<TabPanel>
|
<TabPanel>
|
||||||
<AlertingSettings accessToken={accessToken} />
|
<AlertingSettings
|
||||||
|
accessToken={accessToken}
|
||||||
|
premiumUser={premiumUser}
|
||||||
|
/>
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
</TabPanels>
|
</TabPanels>
|
||||||
</TabGroup>
|
</TabGroup>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue