Add admin views for quick replies, settings, and ticket details

- Created `quick-replies.blade.php` for managing quick replies.
- Added `settings.blade.php` for admin settings management.
- Implemented `ticket-show.blade.php` to display ticket details.
- Introduced `timeline-card.blade.php` component for displaying timeline information.

Enhance quick reply management functionality

- Developed `quick-reply-manager.blade.php` for creating and editing quick replies.
- Integrated Livewire for dynamic interaction and validation.

Implement settings page for AI configuration

- Created `settings-page.blade.php` for managing AI settings, including prompts and provider instances.
- Added functionality for managing models and embeddings.

Add ticket show functionality with real-time updates

- Implemented ticket details view with processing status and tool call logs.
- Added support for displaying article suggestions and error messages.

Create unit tests for AI classifier and domain info tool

- Added `AIClassifierServiceTest.php` to validate AI classifier functionality.
- Implemented `DomainInfoToolTest.php` for domain parameter validation.
- Created `OxxaClientTest.php` to test API interactions and password hashing.
This commit is contained in:
SitiWeb
2026-04-30 01:50:21 +02:00
parent 01aa115a49
commit f939133fe0
103 changed files with 4721 additions and 245 deletions

View File

@@ -0,0 +1,147 @@
<div wire:poll.5s class="space-y-6">
<div class="bg-white rounded-xl p-4 shadow">
<div class="flex items-center justify-between">
<h2 class="font-semibold">Ticket #{{ $ticket->id }}</h2>
<div class="flex items-center gap-3">
<button
type="button"
wire:click="reprocess"
wire:confirm="Weet je zeker dat je ticket #{{ $ticket->id }} opnieuw wilt verwerken?"
class="text-sm px-3 py-1 rounded bg-slate-900 text-white"
>
Herverwerk ticket
</button>
<span class="text-sm px-2 py-1 rounded bg-slate-100">Status: {{ $ticket->status }}</span>
</div>
</div>
@if (session('success'))
<div class="mt-3 rounded bg-green-100 text-green-700 p-2 text-sm">{{ session('success') }}</div>
@endif
@if($ticket->needs_article_draft)
<div class="mt-3 rounded bg-amber-50 border border-amber-300 p-3">
<div class="text-sm font-semibold text-amber-900 mb-1">Kennisbank-gat gedetecteerd</div>
<p class="text-sm text-amber-900">
Er is geen geschikt artikel in de kennisbank gevonden voor deze vraag.
</p>
@php($suggestion = $ticket->result_payload['draft_article_suggestion'] ?? null)
@if(is_array($suggestion))
<div class="mt-3">
<p class="text-sm font-semibold text-amber-900">Voorgestelde titel</p>
<p class="text-sm text-amber-900">{{ $suggestion['title'] ?? '-' }}</p>
</div>
<div class="mt-2">
<p class="text-sm font-semibold text-amber-900">Voorgestelde inhoud</p>
<pre class="text-sm whitespace-pre-wrap text-amber-900">{{ $suggestion['content'] ?? '-' }}</pre>
</div>
@endif
</div>
@endif
@if($ticket->support_reply && !$ticket->needs_article_draft)
<div class="mt-3 rounded bg-blue-50 border border-blue-200 p-3">
<div class="text-sm font-semibold text-blue-900 mb-1">Concept reactie voor klant</div>
@if(is_array($ticket->result_payload['quick_reply'] ?? null))
<div class="mb-2 inline-flex rounded bg-blue-100 px-2 py-1 text-xs text-blue-900">
Snelantwoord gebruikt: #{{ $ticket->result_payload['quick_reply']['id'] ?? '-' }} {{ $ticket->result_payload['quick_reply']['title'] ?? '' }}
</div>
@endif
<pre class="text-sm whitespace-pre-wrap text-blue-900">{{ $ticket->support_reply }}</pre>
</div>
@endif
<p class="mt-3 text-sm text-slate-800"><strong>Origineel:</strong> {{ $ticket->message }}</p>
@if($ticket->normalized_message)
<p class="mt-2 text-sm text-slate-800"><strong>Genormaliseerd:</strong> {{ $ticket->normalized_message }}</p>
@endif
@if($ticket->redaction_report)
<pre class="text-xs mt-2 bg-slate-50 p-2 rounded overflow-x-auto">{{ json_encode($ticket->redaction_report, JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE) }}</pre>
@endif
@if(is_array($ticket->api_credentials) && !empty($ticket->api_credentials['apiuser']))
<div class="mt-3 text-sm rounded bg-slate-100 text-slate-700 p-2">
API credentials aanwezig voor deze ticket-run. Waarden worden niet getoond.
</div>
@endif
@if($ticket->error_message)
<div class="mt-3 text-sm rounded bg-red-100 text-red-700 p-2">{{ $ticket->error_message }}</div>
@endif
@if($ticket->bestArticle)
<div class="mt-3 text-sm rounded bg-green-100 text-green-800 p-2">
Beste artikel: #{{ $ticket->bestArticle->id }} - {{ $ticket->bestArticle->title }}
@if($ticket->confidence !== null)
(confidence {{ number_format($ticket->confidence, 2) }})
@endif
</div>
@endif
</div>
<div class="bg-white rounded-xl p-4 shadow">
<h3 class="font-semibold mb-3">Toolcalls</h3>
@if($ticket->toolCalls->isEmpty())
<p class="text-sm text-slate-600">Geen toolcalls uitgevoerd of voorgesteld.</p>
@else
<div class="space-y-2">
@foreach($ticket->toolCalls as $toolCall)
<div class="border rounded p-3 text-sm">
<div class="flex items-center justify-between">
<div class="font-medium">
{{ $toolCall->action }} ({{ $toolCall->status }})
@if($toolCall->article)
<span class="text-slate-500">via artikel #{{ $toolCall->article->id }}</span>
@endif
</div>
<span class="text-xs text-slate-500">{{ $toolCall->executed_at ?? $toolCall->created_at }}</span>
</div>
@if($toolCall->parameters)
<div class="mt-2">
<div class="text-xs font-semibold text-slate-500">Parameters</div>
<pre class="text-xs bg-slate-50 p-2 rounded overflow-x-auto">{{ json_encode($toolCall->parameters, JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE) }}</pre>
</div>
@endif
@if($toolCall->response)
<div class="mt-2">
<div class="text-xs font-semibold text-slate-500">Response</div>
<pre class="text-xs bg-slate-50 p-2 rounded overflow-x-auto">{{ json_encode($toolCall->response, JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES) }}</pre>
</div>
@endif
@if($toolCall->error)
<div class="mt-2 rounded bg-amber-50 text-amber-900 p-2">{{ $toolCall->error }}</div>
@endif
</div>
@endforeach
</div>
@endif
</div>
<div class="bg-white rounded-xl p-4 shadow">
<h3 class="font-semibold mb-3">Verwerkingsstappen</h3>
@php($orderedLogs = $ticket->logs->sortBy([['created_at', 'desc'], ['id', 'desc']]))
@php($latestLog = $orderedLogs->first())
@if($ticket->status === 'processing' && $latestLog)
<div class="mb-3 rounded border border-blue-200 bg-blue-50 p-2 text-sm text-blue-900 flex items-center justify-between">
<span>Huidige stap: <strong>{{ $latestLog->step }}</strong></span>
<span class="inline-flex items-center gap-1">
<span class="inline-block h-2 w-2 rounded-full bg-blue-600 animate-pulse"></span>
Bezig
</span>
</div>
@endif
<div class="space-y-2">
@foreach($orderedLogs as $log)
<div class="border rounded p-3 text-sm">
<div class="flex items-center justify-between">
<span class="font-medium">{{ $log->step }} ({{ $log->status }})</span>
<span class="text-xs text-slate-500">{{ $log->created_at }}</span>
</div>
@if($log->message)
<div class="text-slate-700 mt-1">{{ $log->message }}</div>
@endif
@if($log->context)
<pre class="text-xs mt-2 bg-slate-50 p-2 rounded overflow-x-auto">{{ json_encode($log->context, JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE) }}</pre>
@endif
</div>
@endforeach
</div>
</div>
</div>