ConnectionTest im Backend funktioniert jetzt
This commit is contained in:
@@ -91,6 +91,33 @@ class RunwareAi implements ApiPluginInterface
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function testConnection(array $data): bool
|
||||
{
|
||||
$apiUrl = rtrim($data['api_url'], '/');
|
||||
$token = $data['token'] ?? null;
|
||||
|
||||
if (!$apiUrl || !$token) {
|
||||
$this->logError('RunwareAI connection test failed: API URL or Token missing.');
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
$response = Http::withHeaders([
|
||||
'Authorization' => 'Bearer ' . $token,
|
||||
'Accept' => 'application/json',
|
||||
])->timeout(5)->post($apiUrl, [
|
||||
[
|
||||
'taskType' => 'ping',
|
||||
]
|
||||
]);
|
||||
|
||||
return $response->successful();
|
||||
} catch (\Exception $e) {
|
||||
$this->logError('RunwareAI connection test failed.', ['error' => $e->getMessage()]);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private function upload(string $imagePath): array
|
||||
{
|
||||
$this->logInfo('Attempting to upload image to RunwareAI.', ['image_path' => $imagePath]);
|
||||
|
||||
Reference in New Issue
Block a user