Skip to content

Commit

Permalink
Removed usage of get_content_node_parents (#9926)
Browse files Browse the repository at this point in the history
* Removed usage of get_content_node_parents

* front linter
  • Loading branch information
overmode authored Jan 13, 2025
1 parent eef1178 commit 4f51273
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 117 deletions.
77 changes: 0 additions & 77 deletions connectors/src/api/get_content_node_parents.ts

This file was deleted.

6 changes: 0 additions & 6 deletions connectors/src/api_server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
getConnectorsAPIHandler,
} from "@connectors/api/get_connector";
import { getConnectorPermissionsAPIHandler } from "@connectors/api/get_connector_permissions";
import { getContentNodesParentsAPIHandler } from "@connectors/api/get_content_node_parents";
import { getContentNodesAPIHandler } from "@connectors/api/get_content_nodes";
import { pauseConnectorAPIHandler } from "@connectors/api/pause_connector";
import { resumeConnectorAPIHandler } from "@connectors/api/resume_connector";
Expand Down Expand Up @@ -112,11 +111,6 @@ export function startServer(port: number) {
"/connectors/:connector_id/permissions",
getConnectorPermissionsAPIHandler
);
app.post(
// must be POST because of body
"/connectors/:connector_id/content_nodes/parents",
getContentNodesParentsAPIHandler
);
app.post(
// must be POST because of body
"/connectors/:connector_id/content_nodes",
Expand Down
10 changes: 6 additions & 4 deletions front/temporal/tracker/activities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
Err,
GPT_4O_MODEL_CONFIG,
Ok,
removeNulls,
} from "@dust-tt/types";
import { Context } from "@temporalio/activity";
import _ from "lodash";
Expand Down Expand Up @@ -484,18 +485,19 @@ async function getTrackersToRun(
config.getConnectorsAPIConfig(),
logger
);
const parentsResult = await connectorsAPI.getContentNodesParents({
const parentsResult = await connectorsAPI.getContentNodes({
connectorId: dataSource.connectorId,
internalIds: [documentId],
includeParents: true,
});
if (parentsResult.isErr()) {
throw parentsResult.error;
}

docParentIds = [
docParentIds = removeNulls([
documentId,
...parentsResult.value.nodes.flatMap((node) => node.parents),
];
...parentsResult.value.nodes.flatMap((node) => node.parentInternalIds),
]);
}

return TrackerConfigurationResource.fetchAllWatchedForDocument(auth, {
Expand Down
30 changes: 0 additions & 30 deletions types/src/front/lib/connectors_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -497,36 +497,6 @@ export class ConnectorsAPI {
return this._resultFromResponse(res);
}

async getContentNodesParents({
connectorId,
internalIds,
}: {
connectorId: string;
internalIds: string[];
}): Promise<
ConnectorsAPIResponse<{
nodes: {
internalId: string;
parents: string[];
}[];
}>
> {
const res = await this._fetchWithError(
`${this._url}/connectors/${encodeURIComponent(
connectorId
)}/content_nodes/parents`,
{
method: "POST",
headers: this.getDefaultHeaders(),
body: JSON.stringify({
internalIds,
}),
}
);

return this._resultFromResponse(res);
}

async getContentNodes<IncludeParents extends boolean>({
connectorId,
includeParents,
Expand Down

0 comments on commit 4f51273

Please sign in to comment.