This commit is contained in:
Xes
2025-08-14 22:39:38 +02:00
parent 3641e93527
commit 5403f346e3
3370 changed files with 327179 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
<?php
/* For license terms, see /license.txt */
/**
Answer questions based on existing knowledge.
*/
require_once __DIR__.'/../../../main/inc/global.inc.php';
require_once __DIR__.'/../AiHelperPlugin.php';
$plugin = AiHelperPlugin::create();
try {
$nQ = (int) $_REQUEST['nro_questions'];
$lang = (string) $_REQUEST['language'];
$topic = (string) $_REQUEST['quiz_name'];
$questionType = $_REQUEST['question_type'] ?? 'multiple_choice';
$resultText = $plugin->generateQuestions($nQ, $lang, $topic, $questionType);
echo json_encode([
'success' => true,
'text' => trim($resultText),
]);
} catch (Exception $e) {
error_log("Error: ".$e->getMessage());
echo json_encode([
'success' => false,
'text' => $e->getMessage(),
]);
}