Skip to content

Commit 8b88964

Browse files
authored
chore(generative-ai): add url endpoints for compass web usage COMPASS-8376 (#6423)
1 parent 6c4d534 commit 8b88964

File tree

10 files changed

+488
-316
lines changed

10 files changed

+488
-316
lines changed

package-lock.json

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/atlas-service/src/atlas-service.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,8 @@ export class AtlasService {
2929
) {
3030
this.config = getAtlasConfig(preferences);
3131
}
32-
adminApiEndpoint(path?: string, requestId?: string): string {
33-
const uri = `${this.config.atlasApiBaseUrl}${normalizePath(path)}`;
34-
const query = requestId
35-
? `?request_id=${encodeURIComponent(requestId)}`
36-
: '';
37-
return `${uri}${query}`;
32+
adminApiEndpoint(path?: string): string {
33+
return `${this.config.atlasApiBaseUrl}${normalizePath(path)}`;
3834
}
3935
cloudEndpoint(path?: string): string {
4036
return `${this.config.cloudBaseUrl}${normalizePath(path)}`;

packages/compass-aggregations/src/modules/pipeline-builder/pipeline-ai.ts

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -281,20 +281,23 @@ export const runAIPipelineGeneration = (
281281

282282
const { collection: collectionName, database: databaseName } =
283283
toNS(namespace);
284-
jsonResponse = await atlasAiService.getAggregationFromUserInput({
285-
signal: abortController.signal,
286-
userInput,
287-
collectionName,
288-
databaseName,
289-
schema,
290-
// Provide sample documents when the user has opted in in their settings.
291-
...(provideSampleDocuments
292-
? {
293-
sampleDocuments,
294-
}
295-
: undefined),
296-
requestId,
297-
});
284+
jsonResponse = await atlasAiService.getAggregationFromUserInput(
285+
{
286+
signal: abortController.signal,
287+
userInput,
288+
collectionName,
289+
databaseName,
290+
schema,
291+
// Provide sample documents when the user has opted in in their settings.
292+
...(provideSampleDocuments
293+
? {
294+
sampleDocuments,
295+
}
296+
: undefined),
297+
requestId,
298+
},
299+
connectionInfo
300+
);
298301
} catch (err: any) {
299302
if (signal.aborted) {
300303
// If we already aborted so we ignore the error.

packages/compass-generative-ai/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
"dependencies": {
5555
"@mongodb-js/atlas-service": "^0.31.0",
5656
"@mongodb-js/compass-components": "^1.31.0",
57+
"@mongodb-js/compass-connections": "^1.45.0",
5758
"@mongodb-js/compass-intercom": "^0.13.2",
5859
"@mongodb-js/compass-logging": "^1.4.9",
5960
"bson": "^6.8.0",
@@ -64,6 +65,7 @@
6465
"react": "^17.0.2"
6566
},
6667
"devDependencies": {
68+
"@mongodb-js/connection-info": "^0.9.2",
6769
"@mongodb-js/eslint-config-compass": "^1.1.7",
6870
"@mongodb-js/mocha-config-compass": "^1.4.2",
6971
"@mongodb-js/prettier-config-compass": "^1.0.2",

0 commit comments

Comments
 (0)