ConnectionTest im Backend funktioniert jetzt

This commit is contained in:
2025-08-07 14:34:00 +02:00
parent 573661825b
commit ad893b48a7
21 changed files with 580 additions and 109 deletions

View File

@@ -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]);