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
parent
89cb058e83
commit
b88093ed46
|
|
@ -195,8 +195,15 @@ class AgentChatController extends Controller
|
|||
$credits = $this->calculateCredits($usage, $aiConfig, $type);
|
||||
}
|
||||
} else {
|
||||
// Chat: immer 5 Credits pauschal
|
||||
$credits = 5;
|
||||
// Chat: 5 Credits — außer bei Abschlussnachrichten (0 Credits)
|
||||
$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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue