This commit is contained in:
Thommy Bucaille 2023-12-29 05:23:52 +01:00
parent 3871b0cef7
commit 2eb327d3b0
1 changed files with 3 additions and 3 deletions

View File

@ -625,7 +625,7 @@ class ChatController extends BaseController
]);
$data = json_decode($response->getBody()->getContents(), true);
return $this->handleResponse((object)$data);
return $this->handleResponse($data);
} catch (\Throwable $th) {
// If Rate limit reached
if ($th->getCode() == 429) {
@ -637,10 +637,10 @@ class ChatController extends BaseController
}
}
private function handleResponse(object $response)
private function handleResponse(array $response)
{
$message = $response->choices[0]->text;
$message = $response['choices'][0]['text'];
return [
(object)[
"choices" => [