Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusgreen committed May 20, 2024
1 parent bb02499 commit ea1fc16
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions classes/ai/ai.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit ea1fc16

Please sign in to comment.