diff --git a/front/poke/temporal/activities.ts b/front/poke/temporal/activities.ts index d83f71d7c1ed..9f471c54eb6c 100644 --- a/front/poke/temporal/activities.ts +++ b/front/poke/temporal/activities.ts @@ -19,6 +19,10 @@ import { AgentDustAppRunAction, AgentDustAppRunConfiguration, } from "@app/lib/models/assistant/actions/dust_app_run"; +import { + AgentProcessAction, + AgentProcessConfiguration, +} from "@app/lib/models/assistant/actions/process"; import { AgentRetrievalConfiguration } from "@app/lib/models/assistant/actions/retrieval"; import { AgentTablesQueryAction, @@ -323,6 +327,28 @@ export async function deleteAgentsActivity({ transaction: t, }); + const agentProcessConfigurations = + await AgentProcessConfiguration.findAll({ + where: { + agentConfigurationId: agent.id, + }, + transaction: t, + }); + await AgentProcessAction.destroy({ + where: { + processConfigurationId: { + [Op.in]: agentProcessConfigurations.map((r) => r.sId), + }, + }, + transaction: t, + }); + await AgentProcessConfiguration.destroy({ + where: { + agentConfigurationId: agent.id, + }, + transaction: t, + }); + await AgentUserRelation.destroy({ where: { agentConfiguration: agent.sId,