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
@@ -56,7 +56,7 @@ protected function setUp(): void
|
||||
$this->property = Property::sole();
|
||||
Storage::fake('local');
|
||||
Content::save(['contract.terms' => '<p>Echte Bedingungen</p>', 'stay.cancellation' => '<p>Echtes Storno</p>']);
|
||||
config(['mail.default' => 'array', 'fewo.spam.min_seconds' => 0, 'fewo.ai.api_key' => 'test-key']);
|
||||
config(['mail.default' => 'array', 'fewo.spam.min_seconds' => 0]);
|
||||
Mail::swap(new MailManager($this->app));
|
||||
Settings::tenant()->update([
|
||||
'bank_iban' => 'DE02120300000000202051',
|
||||
@@ -64,7 +64,9 @@ protected function setUp(): void
|
||||
'process_defaults' => ['processing' => 'automatic', 'data_request_mode' => 'automatic'],
|
||||
]);
|
||||
Mailbox::query()->create(['tenant_id' => Settings::tenant()->id, 'host' => 'imap.example.org', 'username' => 'anfragen@example.org', 'password' => 'x', 'mode' => Mailbox::FULL, 'address' => 'anfragen@example.org', 'is_active' => true]);
|
||||
TenantService::query()->create(['tenant_id' => Settings::tenant()->id, 'service' => TenantServiceKey::AiGuestMail->value, 'is_enabled' => true]);
|
||||
// Bring your own key: the landlord's own access (here OpenRouter), no operator key.
|
||||
TenantService::query()->create(['tenant_id' => Settings::tenant()->id, 'service' => TenantServiceKey::AiGuestMail->value, 'is_enabled' => true, 'api_key' => 'sk-or-test',
|
||||
'settings' => ['provider' => 'openrouter', 'small_model' => 'vendor/small-model', 'review_model' => 'vendor/large-model']]);
|
||||
app(TenantFeatures::class)->forget();
|
||||
}
|
||||
|
||||
@@ -138,10 +140,10 @@ public function test_a_binding_portal_booking_stays_binding_and_is_only_complete
|
||||
*/
|
||||
private function fakeExtraction(array $facts): void
|
||||
{
|
||||
Http::fake(fn (Request $request) => Http::response([
|
||||
'id' => 'msg', 'type' => 'message', 'role' => 'assistant', 'model' => $request->data()['model'],
|
||||
'content' => [['type' => 'text', 'text' => json_encode(['facts' => $facts, 'change_requests' => [], 'intent' => 'answer', 'uncertainties' => []])]],
|
||||
'stop_reason' => 'end_turn', 'usage' => ['input_tokens' => 10, 'output_tokens' => 10],
|
||||
]));
|
||||
Http::fake(['https://openrouter.ai/api/v1/chat/completions' => fn (Request $request) => Http::response([
|
||||
'id' => 'gen', 'model' => $request->data()['model'],
|
||||
'choices' => [['finish_reason' => 'stop', 'message' => ['role' => 'assistant', 'content' => json_encode(['facts' => $facts, 'change_requests' => [], 'intent' => 'answer', 'uncertainties' => []])]]],
|
||||
'usage' => ['prompt_tokens' => 10, 'completion_tokens' => 10],
|
||||
])]);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user