Add bnfexpress signed admin client and AI Agent Filament UI
- Modules\Shared\Bnfexpress\BnfexpressAdminClient: HMAC-signed HTTP client for bnfexpress's admin API (EV FAQs, agent instructions, chat history), with a bnfexpress:smoke-test command and full unit coverage. - New ai-agent module: Filament pages to manage EV FAQs, publish/roll back agent instruction versions, and browse EV chat history + transcripts. - New manage_ai_agent permission (super_admin/admin). - Recorded .ai/rules for the client's auth scheme and non-Resource Filament page/table testing gotchas.
This commit is contained in:
+13
@@ -0,0 +1,13 @@
|
||||
<x-filament-panels::page>
|
||||
<x-filament::section heading="Active Instruction">
|
||||
@if ($active)
|
||||
<pre class="whitespace-pre-wrap text-sm">{{ $active['content'] ?? '' }}</pre>
|
||||
@elseif ($activeError)
|
||||
<p class="text-sm text-danger-600">Could not load the active instruction: {{ $activeError }}</p>
|
||||
@else
|
||||
<p class="text-sm text-gray-500">No active instruction.</p>
|
||||
@endif
|
||||
</x-filament::section>
|
||||
|
||||
{{ $this->table }}
|
||||
</x-filament-panels::page>
|
||||
@@ -0,0 +1,3 @@
|
||||
<x-filament-panels::page>
|
||||
{{ $this->table }}
|
||||
</x-filament-panels::page>
|
||||
+1
@@ -0,0 +1 @@
|
||||
<p class="text-sm text-danger-600">Could not load this transcript: {{ $message }}</p>
|
||||
@@ -0,0 +1,34 @@
|
||||
@php
|
||||
$labels = [
|
||||
'user' => 'User',
|
||||
'bnfexpress_ev_agent' => 'Assistant',
|
||||
];
|
||||
@endphp
|
||||
|
||||
<div class="max-h-[32rem] space-y-3 overflow-y-auto">
|
||||
@forelse (($transcript['messages'] ?? []) as $message)
|
||||
@php
|
||||
$author = $message['author'] ?? 'unknown';
|
||||
$isUser = $author === 'user';
|
||||
@endphp
|
||||
<div @class([
|
||||
'max-w-[85%] rounded-lg border p-3',
|
||||
'ms-auto border-primary-200 bg-primary-50 dark:border-primary-800 dark:bg-primary-950' => $isUser,
|
||||
'border-gray-200 bg-gray-50 dark:border-gray-700 dark:bg-gray-800' => ! $isUser,
|
||||
])>
|
||||
<div class="mb-1 flex items-center justify-between gap-3">
|
||||
<span class="text-xs font-medium uppercase text-gray-500 dark:text-gray-400">
|
||||
{{ $labels[$author] ?? $author }}
|
||||
</span>
|
||||
@if (isset($message['timestamp']))
|
||||
<span class="text-xs text-gray-400 dark:text-gray-500">
|
||||
{{ \Illuminate\Support\Carbon::createFromTimestamp($message['timestamp'])->format('M j, Y g:i A') }}
|
||||
</span>
|
||||
@endif
|
||||
</div>
|
||||
<p class="whitespace-pre-wrap text-sm">{{ $message['text'] ?? '' }}</p>
|
||||
</div>
|
||||
@empty
|
||||
<p class="text-sm text-gray-500">No messages in this session.</p>
|
||||
@endforelse
|
||||
</div>
|
||||
@@ -0,0 +1,3 @@
|
||||
<x-filament-panels::page>
|
||||
{{ $this->table }}
|
||||
</x-filament-panels::page>
|
||||
Reference in New Issue
Block a user