runware.ai connection test funktioniert, drucken dialog implementiert

This commit is contained in:
2025-08-08 10:11:56 +02:00
parent ad893b48a7
commit cfceaed08f
12 changed files with 305 additions and 82 deletions

View File

@@ -103,17 +103,34 @@ class RunwareAi implements ApiPluginInterface
try {
$response = Http::withHeaders([
'Authorization' => 'Bearer ' . $token,
'Content-Type' => 'application/json',
'Accept' => 'application/json',
])->timeout(5)->post($apiUrl, [
[
'taskType' => 'ping',
'taskType' => 'authentication',
'apiKey' => $token,
]
]);
return $response->successful();
$responseData = $response->json();
if ($response->successful() && isset($responseData['data']) && !isset($responseData['error'])) {
$this->logInfo('RunwareAI connection test successful: Authentication successful.', [
'status' => $response->status(),
'response' => $responseData,
]);
return true;
} else {
$errorMessage = $responseData['error'] ?? 'Unknown error';
$this->logError('RunwareAI connection test failed: Authentication failed.', [
'status' => $response->status(),
'response' => $responseData,
'error_message' => $errorMessage,
]);
return false;
}
} catch (\Exception $e) {
$this->logError('RunwareAI connection test failed.', ['error' => $e->getMessage()]);
$this->logError('RunwareAI connection test failed: Exception caught.', ['error' => $e->getMessage()]);
return false;
}
}