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

feat: Add gen ai org and project settings to Compass for CompassWeb usage COMPASS-8377 #6434

Merged
merged 16 commits into from
Nov 7, 2024

Conversation

ruchitharajaghatta
Copy link
Contributor

Description

Add the settings to Compass' preferences schema. We'll want to update how CompassWeb handles its preferences (they're currently read-only) to be able to save the user setting when a user will opt-in (the opt-in modal is added in the next ticket).

The org settings override the group (project) settings. This ticket does not involve passing these in yet from the mms frontend, just default them to off.

See tech design for more info https://docs.google.com/document/d/1to8ghEzI600WxQm08T5nzNfFLkeLDx55EtYxDb4Lvno/edit#bookmark=id.d6b8bffb4yih

Checklist

Motivation and Context

  • Bugfix
  • New feature
  • Dependency update
  • Misc

Open Questions

Dependents

Types of changes

  • Backport Needed
  • Patch (non-breaking change which fixes an issue)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to change)

@Anemy Anemy added the no release notes Fix or feature not for release notes label Nov 1, 2024
Object.keys(_attributes).length === 1 &&
'optInDataExplorerGenAIFeatures' in _attributes
) {
return Promise.resolve(this._preferences.savePreferences(_attributes));
Copy link
Member

@Anemy Anemy Nov 1, 2024

Choose a reason for hiding this comment

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

At the moment this doesn't actually save the preference to the user's AppUser in Atlas since it requires a post request to mms to do that. We'll need to update the PreferencesStorage that CompassWeb uses to make the post request, and then only update the preference when the request succeeds.

preferencesStorage: new InMemoryStorage(preferencesOverrides),

I'm thinking we'll want to create a CompassWebPreferencesStorage for that, it would effectively be an InMemoryStorage with the same single preference optInDataExplorerGenAIFeatures override when the updatePreferences function is called, which would then perform the post request. I'm thinking we could either do that work in a separate ticket/pr, or include it here.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Actually, one thing that hit me when looking at how we did this the initial hello check is that we don't make preferences themselves to hit the endpoint, right? We send the request and separately update the preferences, so maybe while we're still dealing with just one extra preference here that requires a backend request, we should follow the pattern. What do you think?

Copy link
Member

@Anemy Anemy Nov 4, 2024

Choose a reason for hiding this comment

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

That makes way more sense, thanks for the suggestion. Keep the existing InMemoryStorage and have the preference update POST request happen in the AtlasAIService and then call this savePreferences from there when it's successful. @ruchitharajaghatta does that sound good to you?

Copy link
Member

Choose a reason for hiding this comment

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

Chatting with Ruchitha, we'll do it in a follow up pr where we actually use the setting.

@ruchitharajaghatta ruchitharajaghatta marked this pull request as ready for review November 7, 2024 19:09
@ruchitharajaghatta ruchitharajaghatta changed the title <feat>: Add gen ai org and project settings to Compass for CompassWeb usage COMPASS-8377 feat: Add gen ai org and project settings to Compass for CompassWeb usage COMPASS-8377 Nov 7, 2024
@github-actions github-actions bot added the feat label Nov 7, 2024
export type AtlasOrgPreferences = {
enableGenAIFeaturesAtlasOrg?: boolean;
};

Copy link
Member

Choose a reason for hiding this comment

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

nit: Can we move these definitions higher up, above export type AllPreferences = UserPreferences & on line 116 to follow the other preferences?

Object.keys(_attributes).length === 1 &&
'optInDataExplorerGenAIFeatures' in _attributes
) {
return Promise.resolve(this._preferences.savePreferences(_attributes));
Copy link
Member

Choose a reason for hiding this comment

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

Chatting with Ruchitha, we'll do it in a follow up pr where we actually use the setting.

@ruchitharajaghatta ruchitharajaghatta merged commit 5bc3fe9 into main Nov 7, 2024
32 of 33 checks passed
@ruchitharajaghatta ruchitharajaghatta deleted the COMPASS-8377 branch November 7, 2024 23:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat no release notes Fix or feature not for release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants