✨(ai) add message reply generation tool#309
Draft
MathisRouget wants to merge 1 commit intosuitenumerique:mainfrom
Draft
✨(ai) add message reply generation tool#309MathisRouget wants to merge 1 commit intosuitenumerique:mainfrom
MathisRouget wants to merge 1 commit intosuitenumerique:mainfrom
Conversation
5a832dc to
33480f4
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR introduces AI-powered message generation capabilities to the email application, allowing users to generate new messages and replies using AI assistance based on prompts and context from previous emails.
- Adds backend API endpoints for generating new messages and reply messages using AI
- Implements frontend feature flags to control AI message generation functionality
- Integrates AI prompts configuration for multiple languages
Reviewed Changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/frontend/src/hooks/use-feature.ts | Adds feature flag for AI message generation |
| src/frontend/src/features/providers/config.tsx | Adds default config for message generation feature |
| src/frontend/src/features/api/gen/threads/threads.ts | Adds API client functions for new and reply message generation |
| src/frontend/src/features/api/gen/models/*.ts | Adds TypeScript types for API requests and responses |
| src/backend/messages/settings.py | Adds backend configuration for message generation feature |
| src/backend/core/tests/api/test_config.py | Updates config tests with new feature flag |
| src/backend/core/api/viewsets/thread.py | Implements API endpoints for message generation |
| src/backend/core/api/viewsets/config.py | Exposes message generation feature flag in config API |
| src/backend/core/ai/utils.py | Adds utility functions for AI prompt management |
| src/backend/core/ai/message_generator.py | Implements core AI message generation logic |
| src/backend/core/ai/ai_prompts.json | Adds AI prompts for message generation in multiple languages |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| # Get the prompt for the active language | ||
| prompts = load_ai_prompts() | ||
| prompt_template = prompts.get(active_language) | ||
| prompt_query = prompt_template["reply_message_generation_query"] |
There was a problem hiding this comment.
The code references 'reply_message_generation_query' but the JSON file defines 'thread_response_generation_query'. This will cause a KeyError at runtime when trying to generate reply messages.
Suggested change
| prompt_query = prompt_template["reply_message_generation_query"] | |
| prompt_query = prompt_template["thread_response_generation_query"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
This feature allows user to generate new messages and answers by AI thanks to a prompt and previous mails context.
Proposal
Add backend feature and frontend AI Toolbar