@php $a = $assistant; $meta = (array) ($a?->meta_json ?? []); // Hydration payload — never echo back BYOK key plaintext; the // backend only persists fresh values when the operator types // something new, so blank in the UI = "keep what's on file." $payload = [ 'id' => $a?->id, 'name' => $a?->name ?? '', 'persona' => (string) ($meta['persona'] ?? 'support'), 'languages' => (array) ($meta['languages'] ?? ['en']), 'greeting_variations' => (array) ($meta['greeting_variations'] ?? [ $a?->greeting_text ?? 'Hi! I\'m your AI assistant. How can I help you today?', ]), 'status' => $a?->status ?? 'draft', 'is_active' => $a?->is_active ?? true, 'ai_provider' => $a?->ai_provider ?? 'gemini', 'ai_model' => $a?->ai_model ?? 'gemini-2.5-flash-lite', 'ai_system_prompt' => $a?->ai_system_prompt ?? '', 'knowledge_base_url' => $a?->knowledge_base_url ?? '', 'natural_conciseness' => $a?->natural_conciseness ?? true, 'personality' => (array) ($meta['personality'] ?? ['warmth' => 60, 'formality' => 50, 'pace' => 50]), 'voice_provider' => $a?->voice_provider ?? 'elevenlabs', 'voice_id' => $a?->voice_id ?? '', 'stt_provider' => $a?->stt_provider ?? 'elevenlabs', 'noise_suppression' => (bool) ($meta['noise_suppression'] ?? true), 'record_agent' => $a?->record_agent ?? true, 'record_user' => $a?->record_user ?? true, 'auto_logging' => $a?->auto_logging ?? true, 'voicemail_behavior' => (string) ($meta['voicemail_behavior'] ?? 'leave_message'), 'human_handoff_team' => (string) ($meta['human_handoff_team'] ?? ''), 'exit_keywords' => (array) ($a?->exit_keywords_json ?? ['bye', 'goodbye']), 'last_greeting' => $a?->last_greeting ?? 'Thank you for calling. Goodbye!', 'has_ai_key' => !empty($a?->ai_api_key_encrypted), 'has_voice_key' => !empty($a?->voice_api_key_encrypted), 'tools' => $tools ->map( fn($t) => [ 'function_name' => $t->function_name, 'trigger_keywords' => $t->trigger_keywords_json ?? [], 'http_method' => $t->http_method, 'http_url' => $t->http_url, 'headers' => $t->headers_json ?? [], 'parameters' => $t->parameters_json ?? [], ], ) ->values(), ]; @endphp {{-- Sticky top bar — mirrors /wa-campaigns/create. --}}
Voice agents / {{ $mode === 'edit' ? 'Edit' : 'New' }}
{{ $mode === 'edit' ? 'Edit voice' : 'Build a voice' }} {{ __('agent') }}
{{ __('Draft / unsaved') }}
{{-- ── Main form card ───────────────────────────────────────── --}}
{{-- Stepper — wa-campaigns dot/label/bar pattern --}}
@foreach ([['n' => 1, 'lab' => 'Profile'], ['n' => 2, 'lab' => 'Brain'], ['n' => 3, 'lab' => 'Actions'], ['n' => 4, 'lab' => 'Speech'], ['n' => 5, 'lab' => 'Routing']] as $s)
{{ $s['n'] }} {{ $s['lab'] }} @if (!$loop->last) @endif
@endforeach
{{-- ── STEP 1 · Identity & Persona ───────────────────────── --}}
01 {{ __('Agent profile') }} {{ __('required') }}
{{ __('Shown in call logs and transcripts.') }}
@foreach ([['k' => 'support', 'l' => 'Support', 'd' => 'Patient, helpful, resolves issues calmly.', 'icon' => 'M8 1a3 3 0 0 0-3 3v4a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z'], ['k' => 'sales', 'l' => 'Sales', 'd' => 'Friendly, persuasive, qualifies before pitching.', 'icon' => 'M3 9l5-5 4 4 1-1v3l-3-0M3 13l5-5'], ['k' => 'scheduler', 'l' => 'Scheduler', 'd' => 'Crisp, calendar-aware, books slots end-to-end.', 'icon' => 'M3 4h10v9H3zM3 6h10M5 2v3M11 2v3'], ['k' => 'concierge', 'l' => 'Concierge', 'd' => 'Warm, contextual, remembers prior callers.', 'icon' => 'M3 13a5 5 0 0 1 10 0M8 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6z']] as $p) @endforeach
{{-- ── STEP 2 · AI Brain ─────────────────────────────────── --}} {{-- ── STEP 3 · Skills & Actions ──────────────────────────── --}} {{-- ── STEP 4 · Voice ─────────────────────────────────────── --}} {{-- ── STEP 5 · Routing & Recording ───────────────────────── --}}
{{-- ── Sidebar preview — mimics wa-campaigns' right rail ─── --}}