Refactor various services and models for improved type handling and configuration management

This commit is contained in:
SitiWeb
2026-04-30 01:54:49 +02:00
parent f939133fe0
commit 39bdba2dfb
11 changed files with 40 additions and 33 deletions

View File

@@ -67,7 +67,7 @@ class LmStudioClient implements LlmClientInterface
->throw()
->json();
} catch (RequestException $e) {
$body = (string) ($e->response?->body() ?? '');
$body = (string) $e->response->body();
$isResponseFormatError = str_contains($body, 'response_format.type')
|| str_contains($body, 'json_schema');
@@ -131,7 +131,7 @@ class LmStudioClient implements LlmClientInterface
private function mapException(Throwable $e, string $operation): OllamaUnavailableException
{
if ($e instanceof RequestException) {
$body = $e->response?->body();
$body = $e->response->body();
$snippet = $body ? mb_substr($body, 0, 280) : null;
return new OllamaUnavailableException('lmstudio', $operation, $e->getMessage(), $e, $snippet);

View File

@@ -97,7 +97,7 @@ class OllamaClient implements LlmClientInterface
private function mapException(Throwable $e, string $operation): OllamaUnavailableException
{
if ($e instanceof RequestException) {
$body = $e->response?->body();
$body = $e->response->body();
$snippet = $body ? mb_substr($body, 0, 280) : null;
return new OllamaUnavailableException('ollama', $operation, $e->getMessage(), $e, $snippet);