From 6bfa38d7aebab22a107fff3bf36d6d7031b60251 Mon Sep 17 00:00:00 2001 From: ilhooq Date: Tue, 1 Apr 2025 21:26:09 +0200 Subject: [PATCH] =?UTF-8?q?Correction=20bug=20lorsque=20body=20json=20dans?= =?UTF-8?q?=20requ=C3=AAte=20GET?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cela fait planter l'autentification litellm --- .../site/controllers/AssistantController.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/modules/site/controllers/AssistantController.php b/modules/site/controllers/AssistantController.php index d62fb65..7275330 100644 --- a/modules/site/controllers/AssistantController.php +++ b/modules/site/controllers/AssistantController.php @@ -67,16 +67,19 @@ class AssistantController extends \Piko\Controller $apiKey = getenv('PROXY_MASTER_KEY'); - $headers = [ - 'Authorization' => 'Bearer ' . $apiKey, - 'Content-Type' => 'application/json', + $requestParams = [ + 'headers' => [ + 'Authorization' => 'Bearer ' . $apiKey, + 'Content-Type' => 'application/json', + ] ]; + if (!empty($params)) { + $requestParams['json'] = $params; + } + try { - $response = $client->request($method, $endPoint, [ - 'headers' => $headers, - 'json' => $params - ]); + $response = $client->request($method, $endPoint, $requestParams); } catch (RequestException $e) { $response = $e->getResponse(); $responseBody = (string) $response->getBody();