Verfügbarkeitstest für API Provider ergänzt.

This commit is contained in:
2025-12-02 21:51:06 +01:00
parent 908b1dcdff
commit 3ec8e471bc
14 changed files with 565 additions and 26 deletions

View File

@@ -255,6 +255,60 @@ class ComfyUi implements ApiPluginInterface
}
}
public function checkAvailability(): array
{
$this->logInfo('Checking ComfyUI availability.');
if (!$this->apiProvider->enabled) {
$this->logDebug('ComfyUI provider is disabled.');
return [
'available' => false,
'reason' => 'Provider is disabled',
'provider_id' => $this->apiProvider->id,
'provider_name' => $this->apiProvider->name
];
}
if (empty($this->apiProvider->api_url)) {
$this->logDebug('ComfyUI API URL is not configured.');
return [
'available' => false,
'reason' => 'API URL not configured',
'provider_id' => $this->apiProvider->id,
'provider_name' => $this->apiProvider->name
];
}
try {
$response = Http::timeout(5)->get(rtrim($this->apiProvider->api_url, '/') . '/queue');
if ($response->successful()) {
$this->logInfo('ComfyUI is available.');
return [
'available' => true,
'reason' => 'Connection successful',
'provider_id' => $this->apiProvider->id,
'provider_name' => $this->apiProvider->name
];
} else {
$this->logError('ComfyUI connection failed.', ['status' => $response->status()]);
return [
'available' => false,
'reason' => 'Connection failed: ' . $response->status(),
'provider_id' => $this->apiProvider->id,
'provider_name' => $this->apiProvider->name
];
}
} catch (\Exception $e) {
$this->logError('ComfyUI availability check failed.', ['error' => $e->getMessage()]);
return [
'available' => false,
'reason' => 'Connection error: ' . $e->getMessage(),
'provider_id' => $this->apiProvider->id,
'provider_name' => $this->apiProvider->name
];
}
}
public function searchModels(string $searchTerm): array
{
$this->logInfo('ComfyUI does not support model search. Returning empty list.', ['searchTerm' => $searchTerm]);