Skip to content

Commit 23bdca9

Browse files
raunakabaronszanto
authored andcommitted
fix: Remove advanced options toggle if enterprise features are not enabled (onyx-dot-app#4489)
* Only show advanced options for custom llm providers *if* the paid features are enabled * Change variable name
1 parent 5dcb178 commit 23bdca9

File tree

1 file changed

+38
-32
lines changed

1 file changed

+38
-32
lines changed

web/src/app/admin/configuration/llm/CustomLLMProviderUpdateForm.tsx

Lines changed: 38 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import { PopupSpec } from "@/components/admin/connectors/Popup";
2626
import * as Yup from "yup";
2727
import isEqual from "lodash/isEqual";
2828
import { IsPublicGroupSelector } from "@/components/IsPublicGroupSelector";
29+
import { usePaidEnterpriseFeaturesEnabled } from "@/components/settings/usePaidEnterpriseFeaturesEnabled";
2930

3031
function customConfigProcessing(customConfigsList: [string, string][]) {
3132
const customConfig: { [key: string]: string } = {};
@@ -91,6 +92,8 @@ export function CustomLLMProviderUpdateForm({
9192
deployment_name: Yup.string().nullable(),
9293
});
9394

95+
const arePaidEnterpriseFeaturesEnabled = usePaidEnterpriseFeaturesEnabled();
96+
9497
return (
9598
<Formik
9699
initialValues={initialValues}
@@ -305,13 +308,13 @@ export function CustomLLMProviderUpdateForm({
305308
<Field
306309
name={`custom_config_list[${index}][0]`}
307310
className={`
308-
border
309-
border-border
310-
bg-background
311-
rounded
312-
w-full
313-
py-2
314-
px-3
311+
border
312+
border-border
313+
bg-background
314+
rounded
315+
w-full
316+
py-2
317+
px-3
315318
mr-4
316319
`}
317320
autoComplete="off"
@@ -328,13 +331,13 @@ export function CustomLLMProviderUpdateForm({
328331
<Field
329332
name={`custom_config_list[${index}][1]`}
330333
className={`
331-
border
332-
border-border
333-
bg-background
334-
rounded
335-
w-full
336-
py-2
337-
px-3
334+
border
335+
border-border
336+
bg-background
337+
rounded
338+
w-full
339+
py-2
340+
px-3
338341
mr-4
339342
`}
340343
autoComplete="off"
@@ -404,8 +407,8 @@ export function CustomLLMProviderUpdateForm({
404407
<TextFormField
405408
name="default_model_name"
406409
subtext={`
407-
The model to use by default for this provider unless
408-
otherwise specified. Must be one of the models listed
410+
The model to use by default for this provider unless
411+
otherwise specified. Must be one of the models listed
409412
above.`}
410413
label="Default Model"
411414
placeholder="E.g. gpt-4"
@@ -414,28 +417,31 @@ export function CustomLLMProviderUpdateForm({
414417
{!existingLlmProvider?.deployment_name && (
415418
<TextFormField
416419
name="fast_default_model_name"
417-
subtext={`The model to use for lighter flows like \`LLM Chunk Filter\`
418-
for this provider. If not set, will use
420+
subtext={`The model to use for lighter flows like \`LLM Chunk Filter\`
421+
for this provider. If not set, will use
419422
the Default Model configured above.`}
420423
label="[Optional] Fast Model"
421424
placeholder="E.g. gpt-4"
422425
/>
423426
)}
424427

425-
<Separator />
426-
427-
<AdvancedOptionsToggle
428-
showAdvancedOptions={showAdvancedOptions}
429-
setShowAdvancedOptions={setShowAdvancedOptions}
430-
/>
431-
432-
{showAdvancedOptions && (
433-
<IsPublicGroupSelector
434-
formikProps={formikProps}
435-
objectName="LLM Provider"
436-
publicToWhom="all users"
437-
enforceGroupSelection={true}
438-
/>
428+
{arePaidEnterpriseFeaturesEnabled && (
429+
<>
430+
<Separator />
431+
<AdvancedOptionsToggle
432+
showAdvancedOptions={showAdvancedOptions}
433+
setShowAdvancedOptions={setShowAdvancedOptions}
434+
/>
435+
436+
{showAdvancedOptions && (
437+
<IsPublicGroupSelector
438+
formikProps={formikProps}
439+
objectName="LLM Provider"
440+
publicToWhom="all users"
441+
enforceGroupSelection={true}
442+
/>
443+
)}
444+
</>
439445
)}
440446

441447
<div>

0 commit comments

Comments
 (0)