Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 0 additions & 7 deletions packages/compass-generative-ai/src/atlas-ai-service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,13 +327,6 @@ describe('AtlasAiService', function () {
// Reset preferences
await preferences.savePreferences({
optInGenAIFeatures: false,
enableUnauthenticatedGenAI: true,
});
});

afterEach(async function () {
await preferences.savePreferences({
enableUnauthenticatedGenAI: false,
});
});

Expand Down
19 changes: 5 additions & 14 deletions packages/compass-generative-ai/src/atlas-ai-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import type { Logger } from '@mongodb-js/compass-logging';
import { EJSON } from 'bson';
import { getStore } from './store/atlas-ai-store';
import { optIntoGenAIWithModalPrompt } from './store/atlas-optin-reducer';
import { signIntoAtlasWithModalPrompt } from './store/atlas-signin-reducer';

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

async ensureAiFeatureAccess({ signal }: { signal?: AbortSignal } = {}) {
if (this.preferences.getPreferences().enableUnauthenticatedGenAI) {
return getStore().dispatch(optIntoGenAIWithModalPrompt({ signal }));
}

// When the ai feature is attempted to be opened we make sure
// the user is signed into Atlas and opted in.

if (this.apiURLPreset === 'cloud') {
return getStore().dispatch(optIntoGenAIWithModalPrompt({ signal }));
}
return getStore().dispatch(signIntoAtlasWithModalPrompt({ signal }));
return getStore().dispatch(optIntoGenAIWithModalPrompt({ signal }));
}

private getQueryOrAggregationFromUserInput = async <T>(
Expand Down
8 changes: 0 additions & 8 deletions packages/compass-preferences-model/src/feature-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export type FeatureFlags = {
showIndexesGuidanceVariant: boolean;
enableContextMenus: boolean;
enableSearchActivationProgramP1: boolean;
enableUnauthenticatedGenAI: boolean;
};

export const featureFlags: Required<{
Expand Down Expand Up @@ -151,13 +150,6 @@ export const featureFlags: Required<{
},
},

enableUnauthenticatedGenAI: {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can just remove this rather than set stage to released, right? Or was there some reason you can't do that? I can never remember.

Copy link
Contributor

Choose a reason for hiding this comment

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

sounds fine to me, not sure how it works generally though

Copy link
Collaborator

Choose a reason for hiding this comment

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

We generally just set these to released, yes. Makes sure that we're not breaking anything that happens to set this flag and expect it to be recognized, and that it won't conflict with a future Compass option

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed it now, but does that mean we can never remove these?

stage: 'development',
description: {
short: 'Enable GenAI for unauthenticated users',
},
},

/**
* Feature flag for CLOUDP-308952.
*/
Expand Down
Loading