__('error_empty_message', 'Message is empty')]); return; } require_once __DIR__ . '/../../ai/LocalAIApi.php'; $langName = LanguageService::getLang() == 'id' ? 'Indonesian' : 'English'; $systemPrompt = "You are a helpful assistant for " . get_setting('site_name', 'ApkNusa') . ", an APK downloader and tech blog site. Provide concise and accurate information about Android apps, games, and technology. Be youthful and professional. IMPORTANT: Always respond in " . $langName . "."; $resp = \LocalAIApi::createResponse([ 'input' => [ ['role' => 'system', 'content' => $systemPrompt], ['role' => 'user', 'content' => $userMessage], ], ]); if (!empty($resp['success'])) { $text = \LocalAIApi::extractText($resp); echo json_encode(['reply' => $text]); } else { echo json_encode(['error' => __('error_ai', 'AI Assistant is currently unavailable.')]); } } }