Skip to content

Commit 79e3f8c

Browse files
committed
Update AI settings page to align with updated terminology
1 parent a8796bb commit 79e3f8c

2 files changed

Lines changed: 41 additions & 16 deletions

File tree

packages/react-ui/src/app/features/ai/ai-settings-form.tsx

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {
22
aiFormSchemaResolver,
33
AiSettingsFormSchema,
44
} from '@/app/features/ai/lib/ai-form-utils';
5+
import { useAssistantName } from '@/app/features/ai/lib/use-assistant-name';
56
import { ConnectionSelect } from '@/app/features/builder/step-settings/block-settings/connection-select';
67
import {
78
BlockMetadataModel,
@@ -40,6 +41,9 @@ const AiSettingsForm = ({
4041
onSave,
4142
isSaving,
4243
}: AiSettingsFormProps) => {
44+
const assistantName = useAssistantName();
45+
const isEnterprise = assistantName === t('OpenOps Agent');
46+
4347
const form = useForm<AiSettingsFormSchema>({
4448
resolver: aiFormSchemaResolver,
4549
defaultValues: EMPTY_FORM_VALUE,
@@ -84,32 +88,43 @@ const AiSettingsForm = ({
8488
});
8589
};
8690

91+
const descriptionText = isEnterprise
92+
? `Enables ${assistantName} and other AI-powered features such as the CLI command generation and chat interfaces.`
93+
: `Enables ${assistantName} and other AI-powered features such as the CLI command generation.`;
94+
8795
return (
8896
<Form {...form}>
89-
<form className="flex-1 flex flex-col gap-4 max-w-[516px]">
97+
<form className="flex-1 flex flex-col gap-4">
9098
<FormField
9199
control={form.control}
92100
name="enabled"
93101
render={({ field }) => (
94-
<FormItem className="flex gap-[6px]">
95-
<Switch
96-
id="enabled"
97-
checked={field.value}
98-
onCheckedChange={field.onChange}
99-
/>
100-
<Label htmlFor="enabled">{t('Enable AI')}</Label>
102+
<FormItem className="flex flex-col">
103+
<div className="flex items-center gap-[6px]">
104+
<Switch
105+
id="enabled"
106+
checked={field.value}
107+
onCheckedChange={field.onChange}
108+
/>
109+
<Label htmlFor="enabled">{t('Enable OpenOps AI')}</Label>
110+
</div>
111+
<p className="mt-8 text-base font-normal leading-6 text-primary-900">
112+
{descriptionText}
113+
</p>
101114
</FormItem>
102115
)}
103116
/>
104-
<ConnectionSelect
105-
disabled={!currentFormValue.enabled}
106-
allowDynamicValues={false}
107-
block={block}
108-
providerKey={'AI'}
109-
name={'connection'}
110-
/>
117+
<div className="max-w-[516px]">
118+
<ConnectionSelect
119+
disabled={!currentFormValue.enabled}
120+
allowDynamicValues={false}
121+
block={block}
122+
providerKey={'AI'}
123+
name={'connection'}
124+
/>
125+
</div>
111126

112-
<div className="flex items-center justify-between ">
127+
<div className="flex items-center justify-between max-w-[516px]">
113128
<div className="flex gap-2">
114129
<Button
115130
variant="outline"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { flagsHooks } from '@/app/common/hooks/flags-hooks';
2+
import { FlagId, OpsEdition } from '@openops/shared';
3+
import { t } from 'i18next';
4+
5+
export const useAssistantName = () => {
6+
const edition = flagsHooks.useFlag<OpsEdition>(FlagId.EDITION).data;
7+
return edition === OpsEdition.COMMUNITY
8+
? t('OpenOps Assistant')
9+
: t('OpenOps Agent');
10+
};

0 commit comments

Comments
 (0)