diff --git a/www-api/app/Config/RoutesV1.php b/www-api/app/Config/RoutesV1.php index 12328a8e..5d916716 100644 --- a/www-api/app/Config/RoutesV1.php +++ b/www-api/app/Config/RoutesV1.php @@ -105,6 +105,7 @@ $routes->post('/en/wrench/api/v1/familywallet', 'WrenchWal //$routes->get('/en/wrench/api/v1/familywallet/redeem/options', 'WrenchWallet::apigate'); +$routes->post('/en/wrench/api/v1/generatives', 'WrenchResources::generatives'); $routes->post('/en/wrench/api/v1/familyresources', 'WrenchResources::familyresources'); $routes->post('/en/wrench/api/v1/commonmedia', 'WrenchResources::commonmedia'); diff --git a/www-api/app/Controllers/WrenchResources.php b/www-api/app/Controllers/WrenchResources.php index 383841b8..6aa1ef1e 100644 --- a/www-api/app/Controllers/WrenchResources.php +++ b/www-api/app/Controllers/WrenchResources.php @@ -3,12 +3,27 @@ namespace App\Controllers; //use CodeIgniter\API\ResponseTrait; +use CodeIgniter\API\ResponseTrait; use Exception; use Orhanerday\OpenAi\OpenAi; class WrenchResources extends BaseController { + use ResponseTrait; + public function generatives(){ + $raw_json = file_get_contents('php://input'); + $in = json_decode($raw_json, true); + $out = [ + "question" => 'This is the question', + "option" => ['aaaaa'=>'aaaaaaa', 'bbbbbb'=>'bbbbbbbbb', 'cccccc'=>'cccccccc'], + "answer" => 'bbbbbb', + "last" => false, + "points" => 10 + ]; + log_message('critical', "***** ***** WrenchResources::generatives Ret "); + return $this->respond( $this->summaryReturnData($in,$out), 200); + } public function blogTopics(){ $open_ai_key = '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';