v0.11 U6: Bring your own key für die KI-Auswertung (Anthropic, OpenRouter)
Deploy FeWo mit PipelineManager / deploy (push) Successful in 5m11s
Deploy FeWo mit PipelineManager / deploy (push) Successful in 5m11s
- Jeder Mandant verbindet unter „System › KI-Anbindung“ seinen eigenen Zugang: Anbieter (Anthropic oder OpenRouter), API-Schlüssel, Modell für die erste Auswertung und für die Prüfung – keine Modellkennung im Code, kein zentraler Betreiberschlüssel (FEWO_AI_API_KEY entfällt). - Gespeichert im bestehenden TenantService (ai_guest_mail): Schlüssel verschlüsselt, nie wieder angezeigt, nie in Meldungen; Anbieter/Modelle in settings, Prüfergebnis in check_status/check_message/checked_at. - Feste Endpunkte je Anbieter (AiProvider), nicht konfigurierbar. OpenRouter mit response_format json_schema (strict) und provider.require_parameters. - „Verbindung prüfen“ testet beide Modelle. Ein abgelehnter Zugang (401/402/403) schaltet die Auswertung für den Mandanten ab, meldet es im Postfach der Verwaltung; Nachrichten bleiben zur Prüfung im Posteingang. - Zweistufige Extraktion und ihre Sicherheitsregeln unverändert. - Zielarchitektur §3.8, Umsetzungsplan U6, Bericht, Drehbuch, Status. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6f9aa46943
commit
6862dec201
20 files changed
+752
-95
No files matched your search
@@ -2,11 +2,13 @@
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Communication\Extraction\AiAccess;
|
||||
use App\Communication\Extraction\ExtractionFailed;
|
||||
use App\Communication\Extraction\MessageExtractor;
|
||||
use App\Models\Booking;
|
||||
use App\Models\InboundMessage;
|
||||
use App\Models\Property;
|
||||
use App\Models\Tenant;
|
||||
use Illuminate\Console\Attributes\Description;
|
||||
use Illuminate\Console\Attributes\Signature;
|
||||
use Illuminate\Console\Command;
|
||||
@@ -16,16 +18,19 @@
|
||||
* counted separately – no system guarantees that it finds every detail, so the rate of missed ones is reported, not
|
||||
* hidden. Calls the configured models (costs money); meant for calibrating prompts and thresholds before go-live.
|
||||
*/
|
||||
#[Signature('ai:evaluate {--path= : JSON file with samples} {--key= : API key (default: FEWO_AI_API_KEY)}')]
|
||||
#[Signature('ai:evaluate {tenant : ID of the landlord whose own AI access is used} {--path= : JSON file with samples}')]
|
||||
#[Description('Evaluate the guest message extraction against sample messages (wrong values and missed details)')]
|
||||
class EvaluateExtraction extends Command
|
||||
{
|
||||
public function handle(MessageExtractor $extractor): int
|
||||
{
|
||||
$path = (string) ($this->option('path') ?: resource_path('prompts/extraction/evaluation/samples.json'));
|
||||
$key = (string) ($this->option('key') ?: config('fewo.ai.api_key'));
|
||||
if ($key === '') {
|
||||
$this->error('Kein API-Schlüssel (FEWO_AI_API_KEY oder --key).');
|
||||
// Bring your own key: the landlord's own access, as configured (System › KI-Anbindung).
|
||||
$tenant = Tenant::query()->find((int) $this->argument('tenant'));
|
||||
$service = $tenant === null ? null : AiAccess::service($tenant);
|
||||
$access = $service === null ? null : AiAccess::fromService($service);
|
||||
if ($access === null) {
|
||||
$this->error('Für diesen Mandanten ist keine vollständige KI-Anbindung gespeichert.');
|
||||
|
||||
return self::FAILURE;
|
||||
}
|
||||
@@ -41,7 +46,7 @@ public function handle(MessageExtractor $extractor): int
|
||||
$message = new InboundMessage(['subject' => $sample['subject'], 'body' => $sample['body']]);
|
||||
|
||||
try {
|
||||
$result = $extractor->extract($key, $message, $booking)['data'];
|
||||
$result = $extractor->extract($access, $message, $booking)['data'];
|
||||
} catch (ExtractionFailed $exception) {
|
||||
$totals['failed']++;
|
||||
$this->warn("{$sample['id']}: {$exception->getMessage()}");
|
||||
|
||||
Reference in new issue
Block a user