runware.ai connection test funktioniert, drucken dialog implementiert
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user