fix: Remove advanced options toggle if enterprise features are not enabled (#4489)

* Only show advanced options for custom llm providers *if* the paid features are enabled

* Change variable name
This commit is contained in:
Raunak Bhagat
2025-04-09 13:42:20 -07:00
committed by GitHub
parent 15c74224ad
commit eeab3f06ec

View File

@ -26,6 +26,7 @@ import { PopupSpec } from "@/components/admin/connectors/Popup";
import * as Yup from "yup"; import * as Yup from "yup";
import isEqual from "lodash/isEqual"; import isEqual from "lodash/isEqual";
import { IsPublicGroupSelector } from "@/components/IsPublicGroupSelector"; import { IsPublicGroupSelector } from "@/components/IsPublicGroupSelector";
import { usePaidEnterpriseFeaturesEnabled } from "@/components/settings/usePaidEnterpriseFeaturesEnabled";
function customConfigProcessing(customConfigsList: [string, string][]) { function customConfigProcessing(customConfigsList: [string, string][]) {
const customConfig: { [key: string]: string } = {}; const customConfig: { [key: string]: string } = {};
@ -91,6 +92,8 @@ export function CustomLLMProviderUpdateForm({
deployment_name: Yup.string().nullable(), deployment_name: Yup.string().nullable(),
}); });
const arePaidEnterpriseFeaturesEnabled = usePaidEnterpriseFeaturesEnabled();
return ( return (
<Formik <Formik
initialValues={initialValues} initialValues={initialValues}
@ -305,13 +308,13 @@ export function CustomLLMProviderUpdateForm({
<Field <Field
name={`custom_config_list[${index}][0]`} name={`custom_config_list[${index}][0]`}
className={` className={`
border border
border-border border-border
bg-background bg-background
rounded rounded
w-full w-full
py-2 py-2
px-3 px-3
mr-4 mr-4
`} `}
autoComplete="off" autoComplete="off"
@ -328,13 +331,13 @@ export function CustomLLMProviderUpdateForm({
<Field <Field
name={`custom_config_list[${index}][1]`} name={`custom_config_list[${index}][1]`}
className={` className={`
border border
border-border border-border
bg-background bg-background
rounded rounded
w-full w-full
py-2 py-2
px-3 px-3
mr-4 mr-4
`} `}
autoComplete="off" autoComplete="off"
@ -404,8 +407,8 @@ export function CustomLLMProviderUpdateForm({
<TextFormField <TextFormField
name="default_model_name" name="default_model_name"
subtext={` subtext={`
The model to use by default for this provider unless The model to use by default for this provider unless
otherwise specified. Must be one of the models listed otherwise specified. Must be one of the models listed
above.`} above.`}
label="Default Model" label="Default Model"
placeholder="E.g. gpt-4" placeholder="E.g. gpt-4"
@ -414,28 +417,31 @@ export function CustomLLMProviderUpdateForm({
{!existingLlmProvider?.deployment_name && ( {!existingLlmProvider?.deployment_name && (
<TextFormField <TextFormField
name="fast_default_model_name" name="fast_default_model_name"
subtext={`The model to use for lighter flows like \`LLM Chunk Filter\` subtext={`The model to use for lighter flows like \`LLM Chunk Filter\`
for this provider. If not set, will use for this provider. If not set, will use
the Default Model configured above.`} the Default Model configured above.`}
label="[Optional] Fast Model" label="[Optional] Fast Model"
placeholder="E.g. gpt-4" placeholder="E.g. gpt-4"
/> />
)} )}
<Separator /> {arePaidEnterpriseFeaturesEnabled && (
<>
<Separator />
<AdvancedOptionsToggle
showAdvancedOptions={showAdvancedOptions}
setShowAdvancedOptions={setShowAdvancedOptions}
/>
<AdvancedOptionsToggle {showAdvancedOptions && (
showAdvancedOptions={showAdvancedOptions} <IsPublicGroupSelector
setShowAdvancedOptions={setShowAdvancedOptions} formikProps={formikProps}
/> objectName="LLM Provider"
publicToWhom="all users"
{showAdvancedOptions && ( enforceGroupSelection={true}
<IsPublicGroupSelector />
formikProps={formikProps} )}
objectName="LLM Provider" </>
publicToWhom="all users"
enforceGroupSelection={true}
/>
)} )}
<div> <div>