// DNI Toolkits: AI Teacher Secure AJAX Handler add_action('wp_ajax_dni_secure_ai_teacher', 'dni_secure_ai_teacher_handler'); add_action('wp_ajax_nopriv_dni_secure_ai_teacher', 'dni_secure_ai_teacher_handler'); function dni_secure_ai_teacher_handler() { // सुरक्षा जांच (Security Check) if (!isset($_POST['query'])) { wp_send_json_error(array('message' => 'सवाल खाली है!')); } $user_query = sanitize_text_field($_POST['query']); $language = sanitize_text_field($_POST['lang']); // wp-config.php से सुरक्षित Key उठाना if (!defined('GEMINI_API_KEY')) { wp_send_json_error(array('message' => 'API Key कॉन्फ़िगरेशन में समस्या है।')); } $api_key = GEMINI_API_KEY; $api_url = "https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=" . $api_key; // ग्रामीण छात्रों के लिए प्रोम्प्ट आर्किटेक्चर $system_prompt = "You are a helpful AI Teacher named 'DNI Guruji' mentoring rural students from Uttar Pradesh. Explain concepts using simple daily-life examples (like farming, local markets, kitchen, village culture) in a highly encouraging tone."; if ($language === 'hindi') { $system_prompt .= " Respond strictly in pure, easy-to-understand Hindi."; } else { $system_prompt .= " Respond in friendly Hinglish."; } // API Request Body $body = array( 'contents' => array( array( 'parts' => array( array('text' => $system_prompt . "\n\nUser Question: " . $user_query) ) ) ) ); // WordPress HTTP API के जरिए सुरक्षित कॉल $response = wp_remote_post($api_url, array( 'headers' => array('Content-Type' => 'application/json'), 'body' => json_encode($body), 'timeout' => 30, )); if (is_wp_error($response)) { wp_send_json_error(array('message' => 'सर्वर से संपर्क नहीं हो पाया।')); } $response_body = wp_remote_retrieve_body($response); $data = json_decode($response_body, true); if (isset($data['candidates'][0]['content']['parts'][0]['text'])) { $ai_response = $data['candidates'][0]['content']['parts'][0]['text']; // Markdown को सरल HTML ब्रेक्स में बदलना $ai_response = nl2br(esc_html($ai_response)); wp_send_json_success(array('reply' => $ai_response)); } else { wp_send_json_error(array('message' => 'गुरुजी इस समय व्यस्त हैं, कृपया पुनः प्रयास करें।')); } } DNI Toolkits – "हर जमीनी समस्या का सटीक डिजिटल तोड़।"

A commitment to innovation and sustainability

Études is a pioneering firm that seamlessly merges creativity and functionality to redefine architectural excellence.

Building exterior in Toronto, Canada

A passion for creating spaces

Our comprehensive suite of professional services caters to a diverse clientele, ranging from homeowners to commercial developers.

Renovation and restoration

Experience the fusion of imagination and expertise with Études Architectural Solutions.

Continuous Support

Experience the fusion of imagination and expertise with Études Architectural Solutions.

App Access

Experience the fusion of imagination and expertise with Études Architectural Solutions.

Consulting

Experience the fusion of imagination and expertise with Études Architectural Solutions.

Project Management

Experience the fusion of imagination and expertise with Études Architectural Solutions.

Architectural Solutions

Experience the fusion of imagination and expertise with Études Architectural Solutions.

An array of resources

Our comprehensive suite of professional services caters to a diverse clientele, ranging from homeowners to commercial developers.

Études Architect App

  • Collaborate with fellow architects.
  • Showcase your projects.
  • Experience the world of architecture.
Tourist taking photo of a building
Windows of a building in Nuremberg, Germany

Études Newsletter

  • A world of thought-provoking articles.
  • Case studies that celebrate architecture.
  • Exclusive access to design insights.

“Études has saved us thousands of hours of work and has unlocked insights we never thought possible.”

Annie Steiner

CEO, Greenprint

Watch, Read, Listen

Join 900+ subscribers

Stay in the loop with everything you need to know.