-
Notifications
You must be signed in to change notification settings - Fork 0
Add AI-powered email summarization with Norwegian language support #48
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: HNygard <168380+HNygard@users.noreply.github.com>
Co-authored-by: HNygard <168380+HNygard@users.noreply.github.com>
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 introduces an AI-powered email summarization system that generates concise Norwegian summaries of ThreadEmails and automatically classifies their status types based on content analysis.
- Adds comprehensive email summarization using OpenAI's GPT-4o-mini model with Norwegian language support
- Implements automatic status classification for emails (asking for copy, rejected, more time, information release)
- Integrates the new functionality into existing extraction infrastructure with processing controls
Reviewed Changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| organizer/src/system-pages/scheduled-email-extraction.php | Adds support for new 'prompt_summary' extraction type |
| organizer/src/system-pages/extraction-overview.php | Includes summary prompt in queue status display and processing controls |
| organizer/src/class/Extraction/ThreadEmailStatusUpdater.php | New service for updating email status fields based on AI summaries while respecting manual classifications |
| organizer/src/class/Extraction/ThreadEmailExtractorPromptSummary.php | New extractor class that extends ThreadEmailExtractorPrompt for summary processing |
| organizer/src/class/Extraction/Prompts/ThreadEmailSummaryPrompt.php | AI prompt implementation for generating Norwegian email summaries with content filtering |
| organizer/src/class/Extraction/Prompts/PromptService.php | Registers the new ThreadEmailSummaryPrompt in the service |
| data/test-prompts/thread-email-summary/*.txt | Test data files covering various Norwegian email scenarios |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| // Look for keywords that indicate specific status types | ||
| // Order matters - check more specific patterns first | ||
|
|
||
| if (preg_match('/\b(mer tid|utsette|forlenge|frist)\b/u', $summary_lower)) { |
Copilot
AI
Sep 6, 2025
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.
[nitpick] The Norwegian keyword patterns for status classification are hardcoded and scattered across multiple if statements. Consider extracting these patterns to class constants or a configuration array to improve maintainability and make it easier to update keywords.
| return ThreadEmailStatusType::ASKING_FOR_MORE_TIME; | ||
| } | ||
|
|
||
| if (preg_match('/\b(kopi|kopi av|kan vi få|send|videresend)\b/u', $summary_lower)) { |
Copilot
AI
Sep 6, 2025
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.
[nitpick] The Norwegian keyword patterns for status classification are hardcoded and scattered across multiple if statements. Consider extracting these patterns to class constants or a configuration array to improve maintainability and make it easier to update keywords.
| return ThreadEmailStatusType::ASKING_FOR_COPY; | ||
| } | ||
|
|
||
| if (preg_match('/\b(avslag|avslår|ikke|kan ikke|avvise)\b/u', $summary_lower)) { |
Copilot
AI
Sep 6, 2025
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.
[nitpick] The Norwegian keyword patterns for status classification are hardcoded and scattered across multiple if statements. Consider extracting these patterns to class constants or a configuration array to improve maintainability and make it easier to update keywords.
| return ThreadEmailStatusType::REQUEST_REJECTED; | ||
| } | ||
|
|
||
| if (preg_match('/\b(sendt|vedlagt|informasjon|dokumenter|vedlegg)\b/u', $summary_lower)) { |
Copilot
AI
Sep 6, 2025
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.
[nitpick] The Norwegian keyword patterns for status classification are hardcoded and scattered across multiple if statements. Consider extracting these patterns to class constants or a configuration array to improve maintainability and make it easier to update keywords.
Co-authored-by: HNygard <168380+HNygard@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…t.php Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
7a694fc to
51f1206
Compare
|
@copilot : Fix ci |
…ive path to OpenAiPrompt.php Co-authored-by: HNygard <168380+HNygard@users.noreply.github.com>
CI failure fixed. The issue was an incorrect require_once path in ThreadEmailSummaryPrompt.php. Changed Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
…for files in same directory Co-authored-by: HNygard <168380+HNygard@users.noreply.github.com>
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.