Phase 8 (Rest) + Umbauten vom 10./11.06.: - Ein Titelbild pro PM (Cover 1280x580), SVG-Platzhalter-Set + Picker, PressReleaseCoverImage-Resolver - Lizenz-/Rechteformular nach "Lizenztyp Bildupload" (7 Lizenztypen, Personen-/Sachrechte-Status, bedingte Pflichtfelder, Risikohinweise) - Veroeffentlichungs-Box vereinfacht (Embargo aus der Form-UI entfernt), geplante Termine in Europe/Berlin (Speicherung UTC, DISPLAY_TIMEZONE) - Quota-Stub (users.press_release_quota) + monatlicher Reset-Command - Einreichungs-Modal einheitlich in Show/Create/Edit; Ghost-Buttons auf filled; PM-Editor-Layout responsive entkoppelt (.pr-editor-layout) KI-Pruef-Pipeline (Phasen 1-5 des Entwicklungsplans): - API-Haertung: status nicht mehr per API setzbar, eigene Submit-Route durch denselben Funnel (Blacklist, Quota, Status-Log) - Klassifikation Rot/Gelb/Gruen asynchron (Queue classification, OpenAI-Treiber + deterministischer Fallback), ki_audits-Audit-Log - Routing: Rot -> rejected + Mail, Gelb -> Review-Queue, Gruen -> Auto-Publish; Scheduler publiziert nur gruene faellige PMs - Content-Score 0-100 -> Stufe (Standard/Geprueft/Hochwertig) inkl. Editor-Panel und Badges; Re-Klassifikation/-Score bei Aenderung - Admin: KI-Badge + Filter, On-Demand-Pruefung mit Anbieter-Override Suite: 442 passed, 4 skipped. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
44 lines
1.5 KiB
PHP
44 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Services\PressRelease\Classification\Drivers;
|
|
|
|
use App\Enums\PressReleaseClassification;
|
|
use App\Models\PressRelease;
|
|
use App\Services\PressRelease\BlacklistService;
|
|
use App\Services\PressRelease\Classification\ClassificationResult;
|
|
use App\Services\PressRelease\Classification\Contracts\ClassificationDriver;
|
|
|
|
/**
|
|
* Regelbasierter Fallback ohne externe API.
|
|
*
|
|
* Greift, wenn kein KI-Anbieter konfiguriert ist oder die KI ausfällt
|
|
* (Timeout, Rate-Limit, Fehler). Bewertet ausschließlich über die
|
|
* Wort-Blacklist: Treffer → Rot, sonst Grün. Liefert nie Gelb.
|
|
*/
|
|
class DeterministicClassificationDriver implements ClassificationDriver
|
|
{
|
|
public function __construct(private readonly BlacklistService $blacklist) {}
|
|
|
|
public function classify(PressRelease $pressRelease): ClassificationResult
|
|
{
|
|
$word = $this->blacklist->findInPressRelease($pressRelease);
|
|
|
|
if ($word !== null) {
|
|
return new ClassificationResult(
|
|
classification: PressReleaseClassification::Red,
|
|
reasons: [sprintf('Unzulässiges Wort gefunden: "%s".', $word)],
|
|
provider: 'deterministic',
|
|
model: null,
|
|
rawResponse: ['matched_word' => $word],
|
|
);
|
|
}
|
|
|
|
return new ClassificationResult(
|
|
classification: PressReleaseClassification::Green,
|
|
reasons: [],
|
|
provider: 'deterministic',
|
|
model: null,
|
|
rawResponse: ['matched_word' => null],
|
|
);
|
|
}
|
|
}
|