feat: Enhance Support Reply Service with tone instructions and article details
- Added tone instruction retrieval to SupportReplyService. - Improved user feedback when no relevant article is found. - Included article URL and tone instruction in LLM prompt. - Updated response format to include source information. - Enhanced article management UI with search functionality and editing capabilities. - Introduced a new API endpoint for nearest articles based on vector search. - Added confidence badge component to display article confidence levels. - Implemented tests for article searching, editing, and nearest article API. - Removed obsolete .htaccess file.
This commit is contained in:
@@ -35,91 +35,142 @@
|
||||
</div>
|
||||
|
||||
<div class="bg-white rounded-xl p-4 shadow">
|
||||
<h2 class="font-semibold mb-3">Artikelen</h2>
|
||||
<div class="flex flex-col gap-3 mb-4 lg:flex-row lg:items-end lg:justify-between">
|
||||
<div>
|
||||
<h2 class="font-semibold">Artikelen</h2>
|
||||
<p class="text-sm text-slate-500">Zoek op titel, inhoud, bron of artikelnummer.</p>
|
||||
</div>
|
||||
<div class="w-full lg:w-96">
|
||||
<label for="article-search" class="block text-xs font-semibold text-slate-500 mb-1">Zoeken</label>
|
||||
<input id="article-search" wire:model.live.debounce.300ms="search" type="search"
|
||||
class="w-full border rounded p-2" placeholder="Bijvoorbeeld: DNS, e-mail, #42">
|
||||
</div>
|
||||
</div>
|
||||
<div class="space-y-3">
|
||||
@foreach ($articles as $article)
|
||||
<div class="border rounded p-3">
|
||||
<div class="flex items-start justify-between gap-3">
|
||||
<div>
|
||||
<div class="font-medium">#{{ $article->id }} {{ $article->title }}</div>
|
||||
@if (($article->status ?? 'published') === 'draft')
|
||||
<span
|
||||
class="inline-block mt-1 text-xs px-2 py-0.5 rounded bg-amber-100 text-amber-800">Concept
|
||||
(AI)</span>
|
||||
@endif
|
||||
</div>
|
||||
<div class="flex items-center gap-3">
|
||||
@if (($article->status ?? 'published') === 'draft')
|
||||
<button type="button" wire:click="approveDraft({{ $article->id }})"
|
||||
class="text-sm text-green-700 hover:underline">
|
||||
Valideren & publiceren
|
||||
</button>
|
||||
@endif
|
||||
<button type="button" wire:click="deleteArticle({{ $article->id }})"
|
||||
wire:confirm="Weet je zeker dat je dit artikel wilt verwijderen?"
|
||||
class="text-sm text-red-600 hover:underline">
|
||||
Verwijderen
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@if ($article->note)
|
||||
<div class="mt-2 text-xs rounded bg-slate-50 p-2 text-slate-600">
|
||||
<span class="font-semibold">LLM note:</span>
|
||||
{{ \Illuminate\Support\Str::limit($article->note, 180) }}
|
||||
</div>
|
||||
@endif
|
||||
@if (($article->allowed_actions ?? []) !== [])
|
||||
<div class="mt-2 flex flex-wrap gap-1">
|
||||
@foreach ($article->allowed_actions as $action)
|
||||
<span
|
||||
class="text-xs px-2 py-0.5 rounded bg-blue-100 text-blue-800">{{ $action }}</span>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
<div class="text-sm text-slate-600">{{ \Illuminate\Support\Str::limit($article->content, 140) }}
|
||||
</div>
|
||||
<div class="mt-3 rounded bg-slate-50 p-3 space-y-2">
|
||||
<label class="block text-xs font-semibold text-slate-500">LLM note</label>
|
||||
<textarea wire:model="articleNotes.{{ $article->id }}" class="w-full border rounded p-2 min-h-20 text-sm"
|
||||
placeholder="Interne aanwijzingen voor dit artikel"></textarea>
|
||||
@error("articleNotes.{$article->id}")
|
||||
<p class="text-red-600 text-sm">{{ $message }}</p>
|
||||
@enderror
|
||||
<label class="flex items-start gap-2 text-sm">
|
||||
<input wire:model="articleAllowedActions.{{ $article->id }}" type="checkbox"
|
||||
value="domain_inf" class="mt-1 rounded border-slate-300">
|
||||
<span>domain_inf toestaan</span>
|
||||
</label>
|
||||
@error("articleAllowedActions.{$article->id}.*")
|
||||
<p class="text-red-600 text-sm">{{ $message }}</p>
|
||||
@enderror
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-slate-500 mb-1">Gekoppelde
|
||||
snelantwoorden</label>
|
||||
@if ($quickReplyOptions->isEmpty())
|
||||
<p class="text-xs text-slate-500">Nog geen actieve snelantwoorden beschikbaar.</p>
|
||||
@else
|
||||
<div class="grid gap-1 sm:grid-cols-2">
|
||||
@foreach ($quickReplyOptions as $quickReply)
|
||||
<label class="flex items-center gap-2 text-sm">
|
||||
<input wire:model="articleQuickReplies.{{ $article->id }}" type="checkbox"
|
||||
value="{{ $quickReply->id }}" class="rounded border-slate-300">
|
||||
<span>{{ $quickReply->title }}</span>
|
||||
</label>
|
||||
@endforeach
|
||||
@forelse ($articles as $article)
|
||||
<div class="border rounded p-3" wire:key="article-{{ $article->id }}">
|
||||
@if ($editingArticleId === $article->id)
|
||||
<form wire:submit="saveEdit" class="space-y-3">
|
||||
<div class="flex items-start justify-between gap-3">
|
||||
<div>
|
||||
<div class="font-medium">Artikel #{{ $article->id }} bewerken</div>
|
||||
<p class="text-sm text-slate-500">Na opslaan wordt het artikel opnieuw geindexeerd.</p>
|
||||
</div>
|
||||
@endif
|
||||
@error("articleQuickReplies.{$article->id}.*")
|
||||
<button type="button" wire:click="cancelEdit"
|
||||
class="text-sm text-slate-600 hover:underline">
|
||||
Annuleren
|
||||
</button>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-slate-500 mb-1">Titel</label>
|
||||
<input wire:model="editTitle" type="text" class="w-full border rounded p-2">
|
||||
@error('editTitle')
|
||||
<p class="text-red-600 text-sm">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-slate-500 mb-1">Inhoud</label>
|
||||
<textarea wire:model="editContent" class="w-full border rounded p-2 min-h-64"></textarea>
|
||||
@error('editContent')
|
||||
<p class="text-red-600 text-sm">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
<button class="bg-slate-900 text-white px-4 py-2 rounded" type="submit">
|
||||
Wijzigingen opslaan
|
||||
</button>
|
||||
</form>
|
||||
@else
|
||||
<div class="flex items-start justify-between gap-3">
|
||||
<div>
|
||||
<div class="font-medium">#{{ $article->id }} {{ $article->title }}</div>
|
||||
@if (($article->status ?? 'published') === 'draft')
|
||||
<span
|
||||
class="inline-block mt-1 text-xs px-2 py-0.5 rounded bg-amber-100 text-amber-800">Concept
|
||||
(AI)</span>
|
||||
@endif
|
||||
</div>
|
||||
<div class="flex items-center gap-3">
|
||||
@if (($article->status ?? 'published') === 'draft')
|
||||
<button type="button" wire:click="approveDraft({{ $article->id }})"
|
||||
class="text-sm text-green-700 hover:underline">
|
||||
Valideren & publiceren
|
||||
</button>
|
||||
@endif
|
||||
<button type="button" wire:click="startEdit({{ $article->id }})"
|
||||
class="text-sm text-slate-700 hover:underline">
|
||||
Bewerken
|
||||
</button>
|
||||
<button type="button" wire:click="deleteArticle({{ $article->id }})"
|
||||
wire:confirm="Weet je zeker dat je dit artikel wilt verwijderen?"
|
||||
class="text-sm text-red-600 hover:underline">
|
||||
Verwijderen
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@if ($article->note)
|
||||
<div class="mt-2 text-xs rounded bg-slate-50 p-2 text-slate-600">
|
||||
<span class="font-semibold">LLM note:</span>
|
||||
{{ \Illuminate\Support\Str::limit($article->note, 180) }}
|
||||
</div>
|
||||
@endif
|
||||
@if (($article->allowed_actions ?? []) !== [])
|
||||
<div class="mt-2 flex flex-wrap gap-1">
|
||||
@foreach ($article->allowed_actions as $action)
|
||||
<span
|
||||
class="text-xs px-2 py-0.5 rounded bg-blue-100 text-blue-800">{{ $action }}</span>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
<div class="text-sm text-slate-600">{{ \Illuminate\Support\Str::limit($article->content, 140) }}
|
||||
</div>
|
||||
<div class="mt-3 rounded bg-slate-50 p-3 space-y-2">
|
||||
<label class="block text-xs font-semibold text-slate-500">LLM note</label>
|
||||
<textarea wire:model="articleNotes.{{ $article->id }}" class="w-full border rounded p-2 min-h-20 text-sm"
|
||||
placeholder="Interne aanwijzingen voor dit artikel"></textarea>
|
||||
@error("articleNotes.{$article->id}")
|
||||
<p class="text-red-600 text-sm">{{ $message }}</p>
|
||||
@enderror
|
||||
<label class="flex items-start gap-2 text-sm">
|
||||
<input wire:model="articleAllowedActions.{{ $article->id }}" type="checkbox"
|
||||
value="domain_inf" class="mt-1 rounded border-slate-300">
|
||||
<span>domain_inf toestaan</span>
|
||||
</label>
|
||||
@error("articleAllowedActions.{$article->id}.*")
|
||||
<p class="text-red-600 text-sm">{{ $message }}</p>
|
||||
@enderror
|
||||
<div>
|
||||
<label class="block text-xs font-semibold text-slate-500 mb-1">Gekoppelde
|
||||
snelantwoorden</label>
|
||||
@if ($quickReplyOptions->isEmpty())
|
||||
<p class="text-xs text-slate-500">Nog geen actieve snelantwoorden beschikbaar.</p>
|
||||
@else
|
||||
<div class="grid gap-1 sm:grid-cols-2">
|
||||
@foreach ($quickReplyOptions as $quickReply)
|
||||
<label class="flex items-center gap-2 text-sm">
|
||||
<input wire:model="articleQuickReplies.{{ $article->id }}"
|
||||
type="checkbox" value="{{ $quickReply->id }}"
|
||||
class="rounded border-slate-300">
|
||||
<span>{{ $quickReply->title }}</span>
|
||||
</label>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
@error("articleQuickReplies.{$article->id}.*")
|
||||
<p class="text-red-600 text-sm">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
<button type="button" wire:click="saveMetadata({{ $article->id }})"
|
||||
class="text-sm px-3 py-1 rounded bg-slate-900 text-white">
|
||||
Metadata opslaan
|
||||
</button>
|
||||
</div>
|
||||
<button type="button" wire:click="saveMetadata({{ $article->id }})"
|
||||
class="text-sm px-3 py-1 rounded bg-slate-900 text-white">
|
||||
Metadata opslaan
|
||||
</button>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@endforeach
|
||||
@empty
|
||||
<div class="border rounded p-4 text-sm text-slate-500">
|
||||
Geen artikelen gevonden.
|
||||
</div>
|
||||
@endforelse
|
||||
</div>
|
||||
<div class="mt-4">{{ $articles->links() }}</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user