Skip to content

Commit 969bca8

Browse files
committed
Don't require Atlas login, use the unauthenticated NLQ endpoints.
1 parent 3b79fd9 commit 969bca8

File tree

3 files changed

+5
-29
lines changed

3 files changed

+5
-29
lines changed

packages/compass-generative-ai/src/atlas-ai-service.spec.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -327,13 +327,6 @@ describe('AtlasAiService', function () {
327327
// Reset preferences
328328
await preferences.savePreferences({
329329
optInGenAIFeatures: false,
330-
enableUnauthenticatedGenAI: true,
331-
});
332-
});
333-
334-
afterEach(async function () {
335-
await preferences.savePreferences({
336-
enableUnauthenticatedGenAI: false,
337330
});
338331
});
339332

packages/compass-generative-ai/src/atlas-ai-service.ts

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import type { Logger } from '@mongodb-js/compass-logging';
1111
import { EJSON } from 'bson';
1212
import { getStore } from './store/atlas-ai-store';
1313
import { optIntoGenAIWithModalPrompt } from './store/atlas-optin-reducer';
14-
import { signIntoAtlasWithModalPrompt } from './store/atlas-signin-reducer';
1514

1615
type GenerativeAiInput = {
1716
userInput: string;
@@ -197,9 +196,11 @@ const aiURLConfig = {
197196
// There are two different sets of endpoints we use for our requests.
198197
// Down the line we'd like to only use the admin api, however,
199198
// we cannot currently call that from the Atlas UI. Pending CLOUDP-251201
199+
// NOTE: The unauthenticated endpoints are also rate limited by IP address
200+
// rather than by logged in user.
200201
'admin-api': {
201-
aggregation: 'ai/api/v1/mql-aggregation',
202-
query: 'ai/api/v1/mql-query',
202+
aggregation: 'unauth/ai/api/v1/mql-aggregation',
203+
query: 'unauth/ai/api/v1/mql-query',
203204
},
204205
cloud: {
205206
aggregation: (groupId: string) => `ai/v1/groups/${groupId}/mql-aggregation`,
@@ -277,17 +278,7 @@ export class AtlasAiService {
277278
}
278279

279280
async ensureAiFeatureAccess({ signal }: { signal?: AbortSignal } = {}) {
280-
if (this.preferences.getPreferences().enableUnauthenticatedGenAI) {
281-
return getStore().dispatch(optIntoGenAIWithModalPrompt({ signal }));
282-
}
283-
284-
// When the ai feature is attempted to be opened we make sure
285-
// the user is signed into Atlas and opted in.
286-
287-
if (this.apiURLPreset === 'cloud') {
288-
return getStore().dispatch(optIntoGenAIWithModalPrompt({ signal }));
289-
}
290-
return getStore().dispatch(signIntoAtlasWithModalPrompt({ signal }));
281+
return getStore().dispatch(optIntoGenAIWithModalPrompt({ signal }));
291282
}
292283

293284
private getQueryOrAggregationFromUserInput = async <T>(

packages/compass-preferences-model/src/feature-flags.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ export type FeatureFlags = {
2828
showIndexesGuidanceVariant: boolean;
2929
enableContextMenus: boolean;
3030
enableSearchActivationProgramP1: boolean;
31-
enableUnauthenticatedGenAI: boolean;
3231
};
3332

3433
export const featureFlags: Required<{
@@ -151,13 +150,6 @@ export const featureFlags: Required<{
151150
},
152151
},
153152

154-
enableUnauthenticatedGenAI: {
155-
stage: 'development',
156-
description: {
157-
short: 'Enable GenAI for unauthenticated users',
158-
},
159-
},
160-
161153
/**
162154
* Feature flag for CLOUDP-308952.
163155
*/

0 commit comments

Comments
 (0)