Skip to content

Conversation

@MathisRouget
Copy link
Collaborator

Purpose

Some threads and messages can be very long. Summarizing them helps users quickly retrieve key information.
We also want to assist users in avoiding common mistakes when sending messages.

Proposal

Introduce an AI-powered summarization feature for threads.
Also add a simple rule-based system to detect forgotten attachments.

AI Summarization

  • Uses the AlbertAPI with the albert-large model.
  • If a thread is too long, a summary is automatically generated upon reception.
  • If no API key is configured, the feature is hidden from the frontend.
  • Users can manually update the generated summary.

Attachment Reminder (non-AI)

  • Detects when users mention an attachment (e.g. “see attached”, “voir PJ”) but forget to include a file.
  • Displays a warning before sending the message.

@sylvinus sylvinus marked this pull request as ready for review July 22, 2025 07:51
@sylvinus sylvinus requested review from Copilot and jbpenrath July 22, 2025 07:51
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 thread summarization and a rule-based attachment reminder system. The changes enhance user experience by automatically summarizing long threads and preventing users from forgetting to attach files when mentioned in their messages.

Key changes:

  • Adds AI thread summarization using the AlbertAPI with automatic generation for threads with sufficient content and manual refresh capabilities
  • Implements attachment reminder detection that warns users when they mention attachments but haven't included any files
  • Adds comprehensive configuration system to conditionally enable AI features based on required settings

Reviewed Changes

Copilot reviewed 29 out of 31 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/frontend/src/features/layouts/components/thread-view/components/thread-summary/index.tsx New React component for displaying and refreshing AI-generated thread summaries
src/frontend/src/features/forms/components/message-form/index.tsx Enhanced message form with attachment detection logic using keywords from multiple languages
src/backend/core/ai/thread_summarizer.py Core AI service integration for thread summarization using OpenAI-compatible API
src/backend/core/models.py Added summary field to Thread model for storing AI-generated summaries
src/backend/core/api/viewsets/thread.py New API endpoints for retrieving and refreshing thread summaries with proper permission checks
Files not reviewed (1)
  • src/frontend/package-lock.json: Language not supported
Comments suppressed due to low confidence (1)

Copy link
Member

@sylvinus sylvinus left a comment

Choose a reason for hiding this comment

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

Great work!

I focused mainly on the backend

We should add `AI_FEATURE_THREAD_SUMMARY=1" env var to enable specific features individually ?

@MathisRouget MathisRouget requested a review from sylvinus July 22, 2025 11:19
Copy link
Contributor

@jbpenrath jbpenrath left a comment

Choose a reason for hiding this comment

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

Last few nitpicks from my side

Copy link
Member

@sylvinus sylvinus left a comment

Choose a reason for hiding this comment

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

Good for me once JB's feedbacks are done

@MathisRouget MathisRouget force-pushed the ai-summary-pr-base branch 2 times, most recently from ea92afa to e114144 Compare July 24, 2025 08:48
@jbpenrath jbpenrath merged commit e32862e into suitenumerique:main Jul 24, 2025
7 of 9 checks passed
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.

3 participants