Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Aug 15, 2025

  • Fix missing require_once path in ThreadEmailSummaryPrompt.php
  • Fix incorrect require_once paths in PromptService.php
  • CI test failures resolved - all relative paths to class files corrected
  • Verify PHP syntax and file loading works correctly for all affected files
  • All AI email summarization components are properly integrated

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits August 15, 2025 08:59
Co-authored-by: HNygard <168380+HNygard@users.noreply.github.com>
Co-authored-by: HNygard <168380+HNygard@users.noreply.github.com>
Copilot AI changed the title [WIP] Summarize thread emails using AI prompt Add AI-powered email summarization with Norwegian language support Aug 15, 2025
Copilot AI requested a review from HNygard August 15, 2025 09:04
@HNygard HNygard marked this pull request as ready for review September 6, 2025 12:53
Copilot AI review requested due to automatic review settings September 6, 2025 12:53
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 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)) {
Copy link

Copilot AI Sep 6, 2025

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.

Copilot uses AI. Check for mistakes.
return ThreadEmailStatusType::ASKING_FOR_MORE_TIME;
}

if (preg_match('/\b(kopi|kopi av|kan vi få|send|videresend)\b/u', $summary_lower)) {
Copy link

Copilot AI Sep 6, 2025

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.

Copilot uses AI. Check for mistakes.
return ThreadEmailStatusType::ASKING_FOR_COPY;
}

if (preg_match('/\b(avslag|avslår|ikke|kan ikke|avvise)\b/u', $summary_lower)) {
Copy link

Copilot AI Sep 6, 2025

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.

Copilot uses AI. Check for mistakes.
return ThreadEmailStatusType::REQUEST_REJECTED;
}

if (preg_match('/\b(sendt|vedlagt|informasjon|dokumenter|vedlegg)\b/u', $summary_lower)) {
Copy link

Copilot AI Sep 6, 2025

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.

Copilot uses AI. Check for mistakes.
Co-authored-by: HNygard <168380+HNygard@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Sep 6, 2025

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:

  • https://api.github.com/repos/laminas/laminas-servicemanager/zipball/a8640182b892b99767d54404d19c5c3b3699f79b
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/FKFVuU /usr/bin/composer install --no-dev (http block)
  • https://api.github.com/repos/laminas/laminas-stdlib/zipball/8974a1213be42c3e2f70b2c27b17f910291ab2f4
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/3juwiz /usr/bin/composer install (http block)
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/FKFVuU /usr/bin/composer install --no-dev (http block)
  • https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/FKFVuU /usr/bin/composer install --no-dev (http block)
  • https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/FKFVuU /usr/bin/composer install --no-dev (http block)
  • https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/9614ac4d8061dc257ecc64cba1b140873dce8ad3
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/FKFVuU /usr/bin/composer install --no-dev (http block)
  • https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/3833d7255cc303546435cb650316bff708a1c75c
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/3juwiz /usr/bin/composer install (http block)
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/FKFVuU /usr/bin/composer install --no-dev (http block)
  • https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6d857f4d76bd4b343eac26d6b539585d2bc56493
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/3juwiz /usr/bin/composer install (http block)
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/FKFVuU /usr/bin/composer install --no-dev (http block)
  • https://api.github.com/repos/webmozarts/assert/zipball/11cb2199493b2f8a3b53e7f19068fc6aac760991
    • Triggering command: /usr/bin/php8.3 -n -c /tmp/FKFVuU /usr/bin/composer install --no-dev (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested a review from HNygard September 6, 2025 13:18
HNygard and others added 3 commits September 14, 2025 23:18
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…t.php

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@HNygard
Copy link
Owner

HNygard commented Dec 4, 2025

@copilot : Fix ci

…ive path to OpenAiPrompt.php

Co-authored-by: HNygard <168380+HNygard@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 4, 2025

@copilot : Fix ci

CI failure fixed. The issue was an incorrect require_once path in ThreadEmailSummaryPrompt.php. Changed require_once __DIR__ . '/../OpenAiPrompt.php'; to require_once __DIR__ . '/OpenAiPrompt.php'; since both files are in the same directory. Fix committed in a8272c5.

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:

  • https://api.github.com/repos/laminas/laminas-servicemanager/zipball/a8640182b892b99767d54404d19c5c3b3699f79b
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/c1vk7A /usr/bin/composer install (http block)
  • https://api.github.com/repos/laminas/laminas-stdlib/zipball/8974a1213be42c3e2f70b2c27b17f910291ab2f4
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/c1vk7A /usr/bin/composer install (http block)
  • https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/c1vk7A /usr/bin/composer install (http block)
  • https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/c1vk7A /usr/bin/composer install (http block)
  • https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/3833d7255cc303546435cb650316bff708a1c75c
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/c1vk7A /usr/bin/composer install (http block)

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