'How can I help you?']); } require_once dirname(__DIR__, 2) . '/ai/LocalAIApi.php'; $languageNames = ['en' => 'English', 'fr' => 'French', 'ar' => 'Arabic']; $targetLang = $languageNames[$lang] ?? 'English'; $systemPrompt = "You are Coco, the AI assistant for 'Coco Beauty Bar' in Casablanca. Services: Manicure, Pedicure, Hair Styling, Facials, Massage. Tone: Elegant, Professional. RESPONSE RULES: 1. Be EXTREMELY CONCISE and BRIEF. 2. Use short, direct sentences. 3. Use bullet points for lists or recommendations. 4. No redundancy or lengthy explanations. 5. Respond ONLY in {$targetLang}. Call to Action: Suggest booking on 'Contact' page or calling +212 5XX-XXXXXX."; $resp = LocalAIApi::createResponse([ 'input' => [ ['role' => 'system', 'content' => $systemPrompt], ['role' => 'user', 'content' => $message], ], ]); if (!empty($resp['success'])) { $reply = LocalAIApi::extractText($resp); } else { $reply = "I'm sorry, I'm a bit overwhelmed right now. Please call us at +212 5XX-XXXXXX for assistance!"; } wp_send_json(['reply' => $reply]); }