Skip to content

Commit 78f87dc

Browse files
authored
Remove the dependency on EDITION fag to name the AI Assistant (#1656)
Fixes OPS-3126 ## Additional Notes
1 parent 07c88c4 commit 78f87dc

File tree

8 files changed

+15
-29
lines changed

8 files changed

+15
-29
lines changed

packages/react-ui/src/app/features/ai/ai-assistant-button.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { useAssistantName } from '@/app/features/ai/lib/use-assistant-name';
21
import { useAppStore } from '@/app/store/app-store';
32
import { Button, cn, TooltipWrapper } from '@openops/components/ui';
3+
import { t } from 'i18next';
44
import { Bot } from 'lucide-react';
55
import { useCallback } from 'react';
66

@@ -10,14 +10,15 @@ const AiAssistantButton = ({ className }: { className?: string }) => {
1010
setIsAiChatOpened: s.setIsAiChatOpened,
1111
}));
1212

13-
const assistantName = useAssistantName();
14-
1513
const onToggleAiChat = useCallback(() => {
1614
setIsAiChatOpened(!isAiChatOpened);
1715
}, [isAiChatOpened, setIsAiChatOpened]);
1816

1917
return (
20-
<TooltipWrapper tooltipText={assistantName} tooltipPlacement="right">
18+
<TooltipWrapper
19+
tooltipText={t('OpenOps Assistant')}
20+
tooltipPlacement="right"
21+
>
2122
<Button
2223
variant="ai"
2324
className={cn('size-9 p-0 gap-2', className, {

packages/react-ui/src/app/features/ai/ai-configuration-prompt.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { aiSettingsHooks } from '@/app/features/ai/lib/ai-settings-hooks';
2-
import { useAssistantName } from '@/app/features/ai/lib/use-assistant-name';
32
import { useAppStore } from '@/app/store/app-store';
43
import { cn, NoAiEnabledPopover } from '@openops/components/ui';
54

@@ -16,15 +15,12 @@ const AiConfigurationPrompt = ({ className }: AiConfigurationPromptProps) => {
1615
setIsAiChatOpened: s.setIsAiChatOpened,
1716
}));
1817

19-
const assistantName = useAssistantName();
20-
2118
if (isLoading || hasActiveAiSettings || !isAiChatOpened) return null;
2219

2320
return (
2421
<NoAiEnabledPopover
2522
className={cn('absolute left-4 bottom-[17px] z-50', className)}
2623
onCloseClick={() => setIsAiChatOpened(false)}
27-
title={assistantName}
2824
/>
2925
);
3026
};

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,12 @@ const AiSettingsForm = ({
8484
});
8585
};
8686

87-
const descriptionText =
88-
'Enables OpenOps Assistant and other AI-powered features such as the CLI command generation.';
87+
const descriptionText = t(
88+
'Enables {assistantName} and other AI-powered features such as the CLI command generation.',
89+
{
90+
assistantName: t('OpenOps Assistant'),
91+
},
92+
);
8993

9094
return (
9195
<Form {...form}>

packages/react-ui/src/app/features/ai/assistant/ai-chat-resizable-panel.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import { useResizablePanelGroup } from '@/app/common/hooks/use-resizable-panel-g
22
import { RESIZABLE_PANEL_IDS } from '@/app/constants/layout';
33
import AssistantUiChat from '@/app/features/ai/assistant/assistant-ui-chat';
44
import { aiSettingsHooks } from '@/app/features/ai/lib/ai-settings-hooks';
5-
import { useAssistantName } from '@/app/features/ai/lib/use-assistant-name';
65
import { useAppStore } from '@/app/store/app-store';
76
import { cn, ResizableHandle, ResizablePanel } from '@openops/components/ui';
7+
import { t } from 'i18next';
88
import { useCallback, useEffect, useMemo, useRef } from 'react';
99
import { ImperativePanelHandle } from 'react-resizable-panels';
1010

@@ -21,8 +21,6 @@ const AiChatResizablePanel = ({ onDragging }: AiChatResizablePanelProps) => {
2121
const { hasActiveAiSettings, isLoading } =
2222
aiSettingsHooks.useHasActiveAiSettings();
2323

24-
const assistantName = useAssistantName();
25-
2624
const resizablePanelRef = useRef<ImperativePanelHandle | null>(null);
2725

2826
const { getPanelSize } = useResizablePanelGroup();
@@ -73,7 +71,7 @@ const AiChatResizablePanel = ({ onDragging }: AiChatResizablePanelProps) => {
7371
>
7472
<div className="w-full h-full flex bg-secondary overflow-hidden border-r">
7573
<AssistantUiChat
76-
title={assistantName}
74+
title={t('OpenOps Assistant')}
7775
onClose={() => setIsAiChatOpened(false)}
7876
/>
7977
</div>

packages/react-ui/src/app/features/ai/assistant/assistant-ui-chat.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { useAssistantChatHistory } from '../lib/use-ai-assistant-chat-history';
1717

1818
type AssistantUiChatProps = {
1919
onClose: () => void;
20-
title?: string;
20+
title: string;
2121
children?: ReactNode;
2222
handleInject?: (codeContent: string | SourceCode) => void;
2323
};

packages/react-ui/src/app/features/ai/lib/use-assistant-name.ts

Lines changed: 0 additions & 10 deletions
This file was deleted.

packages/ui-components/src/components/ai-chat-container/no-ai-enabled-popover.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@ import { TooltipWrapper } from '../tooltip-wrapper';
88
const NoAiEnabledPopover = ({
99
className,
1010
onCloseClick,
11-
title,
1211
}: {
1312
className?: string;
1413
onCloseClick: () => void;
15-
title: string;
1614
}) => {
1715
return (
1816
<div className={cn('bg-background shadow-editor rounded-lg', className)}>
@@ -21,7 +19,7 @@ const NoAiEnabledPopover = ({
2119
<div className="size-8 flex justify-center items-center bg-background bg-gradient-to-b from-ring/40 to-primary-200/40 rounded-xl">
2220
<Bot size={20} />
2321
</div>
24-
<h2 className="font-bold text-base">{title}</h2>
22+
<h2 className="font-bold text-base">{t('OpenOps Assistant')}</h2>
2523
</div>
2624
<TooltipWrapper tooltipText={t('Close')}>
2725
<Button

packages/ui-components/src/stories/ai-chat/no-ai-enabled.stories.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ const meta = {
1212
},
1313
args: {
1414
onCloseClick: action('onCloseClick'),
15-
title: 'OpenOps Assistant',
1615
},
1716
tags: ['autodocs'],
1817
render: (args) => (

0 commit comments

Comments
 (0)