- Generic AI integration (Admin > Integracje > "Integracja AI"), optional and
  off by default: an OpenAI-compatible /chat/completions client (Groq, OpenAI,
  or a self-hosted Ollama instance) configured by base URL, optional API key,
  model, and an SSL-verification toggle. Foundation for the two AI features
  below and anything else that wants an LLM call in the future.
- BookStack automatic content tagging (AI): "Otaguj nową treść"/"Otaguj
  wszystko ponownie" buttons plus `php artisan bookstack:tag-content`
  (--dry-run/--force/--limit=N) tag every book/chapter/page with matching
  helpdesk subcategory names, idempotent by default.
- BookStack search refinement: "Przeszukuj" is now three independent
  checkboxes (Książki/Strony/Rozdziały) instead of a single dropdown, plus a
  new "Szukaj po" setting (nazwa/tagi/oba) — tag matching uses the bare
  subcategory name, matching what auto-tagging writes.
- AI-driven ticket triage + summary (Admin > Integracje > "Automatyzacja AI
  dla zgłoszeń", via new scheduled ai:run-ticket-automation): five toggles
  auto-assign/correct category+subcategory, rewrite an unclear subject, and
  set priority from content, once per ticket in the background; every change
  is logged in the ticket's history. Separately, an AI summary + suggested
  action for every ticket, shown to operators only, with an admin-editable
  prompt.
- Operators can now reassign a ticket to any team, not just one they belong
  to.
- The auto-refresh countdown badges (ticket view, operator queue) are now
  clickable — fetch immediately and reset the countdown.
- All 7 "cyclical" intervals (3 browser refresh countdowns, the notification
  bell poll, and the 4 background scheduled commands) are now configurable
  from Admin > Konfiguracja instead of fixed in code.
- Fixed: an operator viewing a ticket that's deleted or moved outside their
  team scope mid-session is now redirected to the operator queue instead of
  hitting an error.
- Docs: README/ARCHITECTURE/CLAUDE/install/wiki updated for all of the above.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-24 13:38:39 +02:00
parent 0d116dfd98
commit 313e01ad24
46 changed files with 3224 additions and 150 deletions

View File

@@ -0,0 +1,42 @@
<?php
use App\Support\Settings;
use Illuminate\Support\Carbon;
test('dueEveryMinutes is true on a minute that is a multiple of the configured interval', function () {
Carbon::setTestNow(Carbon::parse('2026-01-01 12:14:00'));
Settings::set('schedule_imap_fetch_minutes', '7');
expect(Settings::dueEveryMinutes('schedule_imap_fetch_minutes', 5))->toBeTrue();
Carbon::setTestNow();
});
test('dueEveryMinutes is false on a minute that is not a multiple of the configured interval', function () {
Carbon::setTestNow(Carbon::parse('2026-01-01 12:15:00'));
Settings::set('schedule_imap_fetch_minutes', '7');
expect(Settings::dueEveryMinutes('schedule_imap_fetch_minutes', 5))->toBeFalse();
Carbon::setTestNow();
});
test('dueEveryMinutes falls back to the given default when unset', function () {
Carbon::setTestNow(Carbon::parse('2026-01-01 12:15:00'));
expect(Settings::dueEveryMinutes('schedule_ai_automation_minutes', 5))->toBeTrue();
Carbon::setTestNow();
});
test('dueEveryMinutes clamps a zero or negative stored value to 1, so it is always due', function () {
Carbon::setTestNow(Carbon::parse('2026-01-01 12:13:00'));
Settings::set('schedule_sla_check_minutes', '0');
expect(Settings::dueEveryMinutes('schedule_sla_check_minutes', 15))->toBeTrue();
Settings::set('schedule_sla_check_minutes', '-4');
expect(Settings::dueEveryMinutes('schedule_sla_check_minutes', 15))->toBeTrue();
Carbon::setTestNow();
});