{{ __('Admin') }} {{ __('Support Bot') }}
{{ __('Admin · Help desk') }}

{{ __('Client support') }} {{ __('bot') }}.

{{ __('One help-desk widget for every logged-in user. Answers from your docs first; escalates to AI only when docs are weak, then to the web only when the answer is not in the docs. Everything here is admin-set — users just ask.') }}

@if (session('error'))
{{ session('error') }}
@endif {{-- ============ Settings form ============ --}}
@csrf
{{-- Master + appearance --}}

{{ __('Widget') }}

{{ $cfg['enabled'] ? __('on') : __('off') }}
{{-- Escalation tiers --}}
{{-- AI tier --}}

{{ __('AI tier') }} ({{ __('rare — weak doc matches') }})

{{ __('Only used when docs alone are shaky. Answers are grounded in your docs.') }}

@if (!$anyKey)
{{ __('No AI keys are set yet.') }} {{ __('Add one in Admin → AI Keys') }} {{ __('and it will appear here automatically.') }}
@else

{{ __('Uses the key you set in Admin → AI Keys for this provider. No key needed here.') }}

@endif
{{-- Beyond-docs fallback — reuses the SAME AI provider/key above. --}}

{{ __('Answer beyond the docs') }} ({{ __('last resort') }})

{{ __('When the answer is not in your docs, let the AI answer from general/web knowledge (labelled as a general answer). Uses the SAME AI provider + key above — choose a web-grounded model like Perplexity if you want live web results.') }}

{{ __('Changes apply only after you save.') }}
{{-- ============ Knowledge sources ============ --}}

{{ __('Knowledge sources') }}

{{ __('Upload help docs (md, html, pdf, docx, txt, csv), add a page URL, or paste text.') }} · {{ trans_choice('{0}no chunks|{1}:count chunk|[2,*]:count chunks', $chunkCount, ['count' => $chunkCount]) }}

@csrf
@csrf
{{ __('Upload file or ZIP') }}
{{ __('md, html, pdf, docx, txt, csv — or a .zip of docs (each page imported as an article).') }}
@csrf
{{ __('Add URL') }}
@csrf
{{ __('Paste text') }}
@forelse ($sources as $s) @empty @endforelse
{{ __('Source') }}{{ __('Type') }}{{ __('Status') }}{{ __('Chunks') }}
{{ $s->label }} {{ $s->kind }} {{ $s->status }} @if ($s->status === 'error'){{ \Illuminate\Support\Str::limit($s->error, 60) }}@endif {{ $s->chunks_count ?? $s->chunks()->count() }}
@csrf @method('DELETE')
{{ __('No sources yet. Add help docs above.') }}
@if ($sources->hasPages() || $sources->total() > 0)
{{ __('Showing') }} {{ $sources->firstItem() ?? 0 }}–{{ $sources->lastItem() ?? 0 }} {{ __('of') }} {{ number_format($sources->total()) }} {{ __('sources') }}
{{ $sources->onEachSide(1)->links() }}
@endif
{{-- ============ Ask log ============ --}}

{{ __('Recent questions') }}

{{ __('What users are asking and which tier answered.') }} · {{ $unmatched }} {{ __('unanswered') }}

@forelse ($logs as $l) @empty @endforelse
{{ __('Question') }}{{ __('Tier') }}{{ __('Score') }}{{ __('When') }}
{{ \Illuminate\Support\Str::limit($l->question, 80) }} {{ $l->engine }} {{ $l->score }} {{ $l->created_at?->diffForHumans() }}
{{ __('No questions yet.') }}
@if ($logs->hasPages() || $logs->total() > 0)
{{ __('Showing') }} {{ $logs->firstItem() ?? 0 }}–{{ $logs->lastItem() ?? 0 }} {{ __('of') }} {{ number_format($logs->total()) }} {{ __('questions') }}
{{ $logs->onEachSide(1)->links() }}
@endif