diff --git a/classes/ai/ai.php b/classes/ai/ai.php index 2fe3472..1650ea9 100644 --- a/classes/ai/ai.php +++ b/classes/ai/ai.php @@ -64,7 +64,7 @@ class ai { * @param string $model */ public function __construct($model = null) { - $this->model = $model ?? trim(explode(',',get_config('tool_aiconnect','model'))[0]); + $this->model = $model ?? trim(explode(',', get_config('tool_aiconnect', 'model'))[0]); $this->openaiapikey = get_config('tool_aiconnect', 'apikey'); $this->temperature = get_config('tool_aiconnect', 'temperature'); $this->endpoint = trim(get_config('tool_aiconnect', 'endpoint')); @@ -100,11 +100,10 @@ private function make_request($data, $apikey, $multipart = null) { ]; $start = microtime(true); $jsonresponse = $curl->post($this->endpoint, json_encode($data), $options); - $response = json_decode($jsonresponse,true); + $response = json_decode($jsonresponse, true); if ($response == null) { return ['curl_error' => $curl->get_info()->http_code, 'execution_time' => $executiontime]; } - xdebug_break(); if(isset($response['error'])){ throw new moodle_exception('endpointerror', 'tool_aiconnect', '', null,