Runware/ComfyUI fixes, dashboard links, import action, Leonardo plugin, widget, added status field and test connection button
This commit is contained in:
@@ -17,10 +17,16 @@ class ApiProvider extends Model
|
||||
'token',
|
||||
'plugin',
|
||||
'enabled',
|
||||
'last_checked_at',
|
||||
'last_status',
|
||||
'last_response_time_ms',
|
||||
'last_error',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'enabled' => 'boolean',
|
||||
'last_checked_at' => 'datetime',
|
||||
'last_response_time_ms' => 'integer',
|
||||
];
|
||||
|
||||
public function disableWithDependencies()
|
||||
@@ -52,4 +58,32 @@ class ApiProvider extends Model
|
||||
{
|
||||
return $this->hasMany(AiModel::class, 'api_provider_id');
|
||||
}
|
||||
}
|
||||
|
||||
public function getDashboardUrl(): ?string
|
||||
{
|
||||
return match ($this->plugin) {
|
||||
'runwareai' => 'https://my.runware.ai/home',
|
||||
'leonardoai' => 'https://app.leonardo.ai/settings/profile',
|
||||
'comfyui' => $this->comfyDashboardUrl(),
|
||||
default => null,
|
||||
};
|
||||
}
|
||||
|
||||
private function comfyDashboardUrl(): ?string
|
||||
{
|
||||
if (! $this->api_url) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$parts = parse_url($this->api_url);
|
||||
$scheme = $parts['scheme'] ?? 'http';
|
||||
$host = $parts['host'] ?? null;
|
||||
$port = isset($parts['port']) ? ':'.$parts['port'] : '';
|
||||
|
||||
if (! $host) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $scheme.'://'.$host.$port.'/';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user