Skip to content

Commit

Permalink
poke delete: fix agent deletion (#9657)
Browse files Browse the repository at this point in the history
  • Loading branch information
spolu authored Dec 30, 2024
1 parent 69d6b6e commit 786a402
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions front/poke/temporal/activities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import { hardDeleteDataSource } from "@app/lib/api/data_sources";
import { hardDeleteSpace } from "@app/lib/api/spaces";
import { areAllSubscriptionsCanceled } from "@app/lib/api/workspace";
import { Authenticator } from "@app/lib/auth";
import {
AgentBrowseAction,
AgentBrowseConfiguration,
} from "@app/lib/models/assistant/actions/browse";
import { AgentDataSourceConfiguration } from "@app/lib/models/assistant/actions/data_sources";
import {
AgentDustAppRunAction,
Expand Down Expand Up @@ -219,6 +223,7 @@ export async function deleteAgentsActivity({
},
transaction: t,
});

const dustAppRunConfigurations =
await AgentDustAppRunConfiguration.findAll({
where: {
Expand All @@ -240,6 +245,7 @@ export async function deleteAgentsActivity({
},
transaction: t,
});

const tablesQueryConfigurations =
await AgentTablesQueryConfiguration.findAll({
where: {
Expand Down Expand Up @@ -269,6 +275,28 @@ export async function deleteAgentsActivity({
},
transaction: t,
});

const agentBrowseConfigurations = await AgentBrowseConfiguration.findAll({
where: {
agentConfigurationId: agent.id,
},
transaction: t,
});
await AgentBrowseAction.destroy({
where: {
browseConfigurationId: {
[Op.in]: agentBrowseConfigurations.map((r) => r.sId),
},
},
transaction: t,
});
await AgentBrowseConfiguration.destroy({
where: {
agentConfigurationId: agent.id,
},
transaction: t,
});

await AgentUserRelation.destroy({
where: {
agentConfiguration: agent.sId,
Expand Down

0 comments on commit 786a402

Please sign in to comment.