Skip to content

Conversation

@MathisRouget
Copy link
Collaborator

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

@jbpenrath jbpenrath force-pushed the ai-response-generation-pr-base branch from 5a832dc to 33480f4 Compare August 19, 2025 21:53
@jbpenrath jbpenrath requested a review from Copilot August 19, 2025 21:53
@jbpenrath jbpenrath self-assigned this Aug 19, 2025
Copy link

Copilot AI left a 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 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"]
Copy link

Copilot AI Aug 19, 2025

Choose a reason for hiding this comment

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

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"]

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants