@if(session('success'))
{{ session('success') }}
@endif

{{ __('Knowledge Base') }}

{{ __('Train your AI with documents, websites, and Q&A pairs') }}

{{-- Stats --}}

{{ $stats['documents'] }}

{{ __('Documents') }}

{{ $stats['qa_pairs'] }}

{{ __('Q&A Pairs') }}

{{ $stats['websites'] }}

{{ __('URLs') }}

{{ number_format($stats['total_chunks']) }}

{{ __('Indexed Sections') }}

{{-- Tabs --}}
{{-- DOCUMENTS TAB --}} @if($activeTab === 'documents')

{{ __('PDF, DOCX, TXT, CSV, XLSX (Max 25MB)') }}

{{ __('Uploading...') }}
@error('uploadFile')

{{ $message }}

@enderror @if($documents->count() > 0) {{-- overflow-visible so the action-menu dropdown (teleported to body below, but the stacking context still matters for focus) isn't clipped --}}
@foreach($documents as $doc) @endforeach
{{ __('Name') }} {{ __('Status') }}
@php $tc = match($doc->file_type) { 'pdf' => 'bg-danger/15 text-danger', 'docx' => 'bg-info/15 text-blue-600', 'xlsx' => 'bg-success/15 text-success', default => 'bg-surface text-muted ' }; @endphp {{ strtoupper($doc->file_type ?? 'DOC') }} {{ $doc->title }}
@php $sc = match($doc->status) { 'ready' => 'bg-success/15 text-success', 'failed' => 'bg-danger/15 text-danger', default => 'bg-warning/15 text-warning' }; @endphp @if(in_array($doc->status, ['uploading','extracting','chunking','embedding'])) @elseif($doc->status==='ready') @endif {{ ucfirst($doc->status) }} @if($doc->error_message)

{{ $doc->error_message }}

@endif
{{-- Teleported dropdown: same pattern as workflow-list. Menu renders at so it can never be clipped by the table's overflow rules or rounded corners. --}}
@else @endif
@endif {{-- WEBSITES TAB --}} @if($activeTab === 'websites')

{{ __('Add Website URL') }}

@error('scrapeUrl')

{{ $message }}

@enderror
@forelse($websites as $site)

{{ $site->source_url ?? $site->title }}

{{ $site->chunks_count ?? 0 }} chunks · {{ $site->created_at->diffForHumans() }}

@php $sc = match($site->status) { 'ready' => 'bg-success/15 text-success', 'failed' => 'bg-danger/15 text-danger', default => 'bg-warning/15 text-warning' }; @endphp {{ ucfirst($site->status) }}
@empty @endforelse
@endif {{-- Q&A PAIRS TAB --}} @if($activeTab === 'qa')

{{ __('Add Q&A Pair') }}

@error('qaQuestion')

{{ $message }}

@enderror
@error('qaAnswer')

{{ $message }}

@enderror
@forelse($qaPairs as $qa)
@if($editingQaId === $qa->id)
@error('editQuestion')

{{ $message }}

@enderror
@error('editAnswer')

{{ $message }}

@enderror
@else
Q

{{ $qa->question }}

A

{{ $qa->answer }}

@endif
@empty @endforelse
@endif