22 lines
544 B
PHP
22 lines
544 B
PHP
<?php
|
|
|
|
namespace Modules\AI\Console;
|
|
|
|
use Illuminate\Console\Command;
|
|
use Modules\AI\Contracts\AIManager;
|
|
|
|
final class TestAIProvider extends Command
|
|
{
|
|
protected $signature = 'ai:test {provider}';
|
|
|
|
protected $description = 'Test an AI provider connection.';
|
|
|
|
public function handle(AIManager $manager): int
|
|
{
|
|
$result = $manager->testProvider((int) $this->argument('provider'));
|
|
$this->{$result['ok'] ? 'info' : 'error'}($result['message']);
|
|
|
|
return $result['ok'] ? self::SUCCESS : self::FAILURE;
|
|
}
|
|
}
|