-
Notifications
You must be signed in to change notification settings - Fork 239
feat(compass-assistant): ensure opt-in before sending the first message COMPASS-9759 #7263
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements opt-in functionality for the MongoDB Compass Assistant feature to ensure users provide consent before sending their first message to the AI service. The implementation adds a new ensureOptInAndSend method that checks for AI feature access before sending messages.
- Adds opt-in requirement before sending messages to the AI assistant
- Refactors message sending to use the new opt-in flow
- Updates imports to use
@mongodb-js/connection-infoinstead of compass-connections
Reviewed Changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/compass-generative-ai/src/atlas-ai-service.ts | Updates import to use connection-info package |
| packages/compass-generative-ai/package.json | Moves connection-info from dev to production dependencies |
| packages/compass-assistant/src/compass-assistant-provider.tsx | Implements ensureOptInAndSend method and integrates atlas AI service |
| packages/compass-assistant/src/compass-assistant-provider.spec.tsx | Updates tests to mock AtlasAiService and test opt-in behavior |
| packages/compass-assistant/src/assistant-chat.tsx | Replaces direct sendMessage calls with ensureOptInAndSend |
| packages/compass-assistant/src/assistant-chat.spec.tsx | Updates tests to mock ensureOptInAndSend context |
| packages/compass-assistant/package.json | Adds dependency on compass-generative-ai |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks reasonable, the Copilot comment about sendMessage options should be addressed although we don't use options ourselves
6e50395 to
a6f9fdc
Compare
| : undefined, | ||
| onDebugClick: | ||
| compassAssistant.interpretConnectionError && connectionInfo | ||
| compassAssistant.getIsAssistantEnabled() && connectionInfo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This keeps getting the initial value. I've tried various extra things, can't figure it out and I'm just filing a ticket for now. https://jira.mongodb.org/browse/COMPASS-9803 cc @gagik @gribnoysup
I'm gonna merge for now because that's actually an existing bug that I tried to fix as a drive-by.
Draft - still needs tests.