Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed usage of get_content_node_parents #9926

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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),
]);
Comment on lines +497 to +500
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we might want to keep unique values no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As seen irl, this should be safe because we only get the parents for a single node 👍

}

return TrackerConfigurationResource.fetchAllWatchedForDocument(auth, {
Expand Down
7 changes: 6 additions & 1 deletion types/src/front/data_source_view.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { ModelId } from "../shared/model_id";
import { DataSourceViewCategory } from "./api_handlers/public/spaces";
import { ConnectorStatusDetails, DataSourceType, DataSourceWithAgentsUsageType, EditedByUser } from "./data_source";
import {
ConnectorStatusDetails,
DataSourceType,
DataSourceWithAgentsUsageType,
EditedByUser,
} from "./data_source";
import { ContentNode } from "./lib/connectors_api";

export interface DataSourceViewType {
Expand Down
35 changes: 4 additions & 31 deletions types/src/front/lib/connectors_api.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { AdminCommandType, AdminResponseType } from "../../connectors/admin/cli";
import {
AdminCommandType,
AdminResponseType,
} from "../../connectors/admin/cli";
import { ConnectorsAPIError, isConnectorsAPIError } from "../../connectors/api";
import { UpdateConnectorConfigurationType } from "../../connectors/api_handlers/connector_configuration";
import { ConnectorCreateRequestBody } from "../../connectors/api_handlers/create_connector";
Expand Down Expand Up @@ -495,36 +498,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
Loading