11import { QueryKeys } from '@/app/constants/query-keys' ;
2+ import { AiConfigIndicator } from '@/app/features/ai/ai-config-indicator' ;
23import { AiSettingsForm } from '@/app/features/ai/ai-settings-form' ;
34import {
45 AI_SETTINGS_SAVED_SUCCESSFULLY_TOAST ,
@@ -9,7 +10,7 @@ import { aiSettingsApi } from '@/app/features/ai/lib/ai-settings-api';
910import { aiSettingsHooks } from '@/app/features/ai/lib/ai-settings-hooks' ;
1011import { mcpSettingsHooks } from '@/app/features/ai/lib/mcp-settings-hooks' ;
1112import { blocksHooks } from '@/app/features/blocks/lib/blocks-hook' ;
12- import { INTERNAL_ERROR_TOAST , toast } from '@openops/components/ui' ;
13+ import { INTERNAL_ERROR_TOAST , Skeleton , toast } from '@openops/components/ui' ;
1314import {
1415 ApplicationErrorParams ,
1516 ErrorCode ,
@@ -85,7 +86,7 @@ const AiSettingsPage = () => {
8586
8687 return (
8788 < div className = "flex w-full flex-col items-center justify-center gap-4" >
88- < div className = "mx-auto w-full flex-col" >
89+ < div className = "mx-auto w-full flex flex -col gap-4 " >
8990 < h1 className = "text-[24px] font-bold text-primary-900" >
9091 { t ( 'OpenOps AI' ) }
9192 </ h1 >
@@ -94,47 +95,56 @@ const AiSettingsPage = () => {
9495 'Enable OpenOps Assistant and other AI-powered features such as the CLI command generation.' ,
9596 ) }
9697 </ p >
97- < div className = "flex flex-col gap-8 p-6 border rounded-[11px]" >
98- { aiBlockModel && (
99- < AiSettingsForm
100- block = { aiBlockModel }
101- providerKey = { 'AI' }
102- initialConnection = { aiSettings ?. [ 0 ] ?. connection }
103- onSave = { ( connectionName ) =>
104- onSaveAiSettings ( {
105- ...aiSettings ?. [ 0 ] ,
106- enabled : ! ! connectionName ,
107- connection : connectionName ,
108- } )
109- }
110- disabled = { isSavingAiSettings }
111- displayName = { t ( 'Select Connection' ) }
112- />
113- ) }
114-
115- { awsBlockModel && (
116- < AiSettingsForm
117- block = { awsBlockModel }
118- providerKey = { 'AWS' }
119- initialConnection = { mcpSettings ?. awsCost ?. connectionName }
120- onSave = { ( connectionName : string ) =>
121- onSaveMcpSettings ( {
122- ...mcpSettings ,
123- awsCost : {
98+ < AiConfigIndicator enabled = { ! ! aiSettings ?. [ 0 ] ?. connection } />
99+ < div className = "p-6 border rounded-[11px]" >
100+ < div className = "max-w-[648px] flex flex-col gap-4" >
101+ < h3 className = "text-base font-bold" > { t ( 'AI connection' ) } </ h3 >
102+ { aiBlockModel ? (
103+ < AiSettingsForm
104+ block = { aiBlockModel }
105+ providerKey = { 'AI' }
106+ initialConnection = { aiSettings ?. [ 0 ] ?. connection }
107+ onSave = { ( connectionName ) =>
108+ onSaveAiSettings ( {
109+ ...aiSettings ?. [ 0 ] ,
124110 enabled : ! ! connectionName ,
125- connectionName :
126- removeConnectionBrackets ( connectionName ) ?? '' ,
127- } ,
128- } )
129- }
130- disabled = {
131- isSavingMcpSettings ||
132- ! aiSettings ?. [ 0 ] ?. connection ||
133- isSavingAiSettings
134- }
135- displayName = { t ( 'AWS Cost' ) }
136- />
137- ) }
111+ connection : connectionName ,
112+ } )
113+ }
114+ disabled = { isSavingAiSettings }
115+ displayName = { t ( 'Select Connection' ) }
116+ />
117+ ) : (
118+ < Skeleton className = "h-[78px]" />
119+ ) }
120+
121+ < h3 className = "text-sm font-normal" > { t ( 'MCP' ) } </ h3 >
122+ { awsBlockModel ? (
123+ < AiSettingsForm
124+ block = { awsBlockModel }
125+ providerKey = { 'AWS' }
126+ initialConnection = { mcpSettings ?. awsCost ?. connectionName }
127+ onSave = { ( connectionName : string ) =>
128+ onSaveMcpSettings ( {
129+ ...mcpSettings ,
130+ awsCost : {
131+ enabled : ! ! connectionName ,
132+ connectionName :
133+ removeConnectionBrackets ( connectionName ) ?? '' ,
134+ } ,
135+ } )
136+ }
137+ disabled = {
138+ isSavingMcpSettings ||
139+ ! aiSettings ?. [ 0 ] ?. connection ||
140+ isSavingAiSettings
141+ }
142+ displayName = { t ( 'AWS Cost' ) }
143+ />
144+ ) : (
145+ < Skeleton className = "h-[78px]" />
146+ ) }
147+ </ div >
138148 </ div >
139149 </ div >
140150 </ div >
0 commit comments