Files
compras/app/Console/Commands/SgcAiRehearsal.php
T
nala c6373365bf
tests / ci (push) Canceled after 0s
commit9
2026-10-30 20:02:30 +02:00

30 lines
1.0 KiB
PHP

<?php
namespace App\Console\Commands;
use App\Services\SyntheticAiRehearsal;
use Illuminate\Console\Command;
use Throwable;
class SgcAiRehearsal extends Command
{
protected $signature = 'sgc:ai-rehearsal {--live : Executar uma chamada paga, apenas com o cenário fictício incorporado}';
protected $description = 'Pré-visualizar o ensaio de síntese IA; sem rede por defeito e sem acesso a processos reais';
public function handle(SyntheticAiRehearsal $rehearsal): int
{
try {
$result = $this->option('live') ? $rehearsal->run() : $rehearsal->preview();
$this->line(json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR));
return self::SUCCESS;
} catch (Throwable) {
// Never render request bodies, provider errors or credentials in console logs.
$this->error('Ensaio não concluído. Confira activação/credencial e o resultado dos testes; nenhuma decisão do SGC foi alterada.');
return self::FAILURE;
}
}
}