chore: open carbon modal when creating agent from scratch (#40477)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - The "Carbon" modal now opens automatically when importing certain templates. - Feature-flagged integrations can be enabled during template import if applicable. - **Bug Fixes** - No bug fixes included in this release. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
parent
557ee052f0
commit
d5eb1f3564
|
|
@ -7,3 +7,17 @@ export const setCreateAgentModalOpen = ({ isOpen }: { isOpen: boolean }) => ({
|
|||
type: "",
|
||||
payload: { isOpen },
|
||||
});
|
||||
|
||||
export const openCarbonModal = ({ shouldOpen }: { shouldOpen: boolean }) => ({
|
||||
type: "",
|
||||
payload: { shouldOpen },
|
||||
});
|
||||
|
||||
export const toggleFCIntegrations = ({
|
||||
isEnabled,
|
||||
}: {
|
||||
isEnabled: boolean;
|
||||
}) => ({
|
||||
type: "",
|
||||
payload: { isEnabled },
|
||||
});
|
||||
|
|
|
|||
|
|
@ -46,8 +46,13 @@ import {
|
|||
import { validateResponse } from "./ErrorSagas";
|
||||
import { failFastApiCalls } from "./InitSagas";
|
||||
import { getAllPageIdentities } from "./selectors";
|
||||
import { setCreateAgentModalOpen } from "ee/actions/aiAgentActions";
|
||||
import {
|
||||
openCarbonModal,
|
||||
setCreateAgentModalOpen,
|
||||
toggleFCIntegrations,
|
||||
} from "ee/actions/aiAgentActions";
|
||||
import { getIsAiAgentFlowEnabled } from "ee/selectors/aiAgentSelectors";
|
||||
import { getTemplatesByFlagSelector } from "selectors/templatesSelectors";
|
||||
|
||||
const isAirgappedInstance = isAirgapped();
|
||||
const AI_DATASOURCE_NAME = "AI Datasource";
|
||||
|
|
@ -79,6 +84,9 @@ function* importTemplateToWorkspaceSaga(
|
|||
action: ReduxAction<{ templateId: string; workspaceId: string }>,
|
||||
) {
|
||||
const isAiAgentFlowEnabled: boolean = yield select(getIsAiAgentFlowEnabled);
|
||||
const templates: ReturnType<typeof getTemplatesByFlagSelector> = yield select(
|
||||
getTemplatesByFlagSelector,
|
||||
);
|
||||
|
||||
try {
|
||||
const response: ImportTemplateResponse = yield call(
|
||||
|
|
@ -102,6 +110,15 @@ function* importTemplateToWorkspaceSaga(
|
|||
});
|
||||
|
||||
if (isAiAgentFlowEnabled) {
|
||||
const isScratchTemplate = templates.find(
|
||||
(template) => template.title === "AI Agent",
|
||||
);
|
||||
|
||||
if (isScratchTemplate) {
|
||||
yield put(openCarbonModal({ shouldOpen: true }));
|
||||
yield put(toggleFCIntegrations({ isEnabled: true }));
|
||||
}
|
||||
|
||||
yield put(setCreateAgentModalOpen({ isOpen: false }));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user