Fix: 0 credits for farewell chat messages

Abschlussnachrichten (danke, ok, tschüss, passt, ...) kosten 0 statt 5
Credits — keine Leistung erbracht, keine Verrechnung.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
main
boban 2026-04-19 08:30:10 +02:00
parent 89cb058e83
commit b88093ed46
1 changed files with 9 additions and 2 deletions

View File

@ -195,8 +195,15 @@ class AgentChatController extends Controller
$credits = $this->calculateCredits($usage, $aiConfig, $type); $credits = $this->calculateCredits($usage, $aiConfig, $type);
} }
} else { } else {
// Chat: immer 5 Credits pauschal // Chat: 5 Credits — außer bei Abschlussnachrichten (0 Credits)
$credits = 5; $farewells = ['danke', 'tschüss', 'tschuss', 'bye', 'ciao',
'ok', 'okay', 'alles klar', 'super', 'perfekt',
'das war', 'nein', 'nix', 'nichts', 'passt'];
$msgLower = mb_strtolower($request->message);
$isFarewell = collect($farewells)
->contains(fn($w) => str_contains($msgLower, $w));
$credits = $isFarewell ? 0 : 5;
} }
if ($shouldLog) { if ($shouldLog) {