style updates
This commit is contained in:
@@ -1,9 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\AI\Console;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Modules\AI\Models\AIExecution;
|
||||
|
||||
final class PruneAIExecutions extends Command
|
||||
{
|
||||
protected $signature='ai:prune {--days=}'; protected $description='Remove old AI execution records.';
|
||||
public function handle(): int { $days=(int)($this->option('days')?:config('ai.retain_executions_days',90)); $count=AIExecution::where('created_at','<',now()->subDays($days))->delete(); $this->info("Deleted {$count} AI executions."); return self::SUCCESS; }
|
||||
protected $signature = 'ai:prune {--days=}';
|
||||
|
||||
protected $description = 'Remove old AI execution records.';
|
||||
|
||||
public function handle(): int
|
||||
{
|
||||
$days = (int) ($this->option('days') ?: config('ai.retain_executions_days', 90));
|
||||
$count = AIExecution::where('created_at', '<', now()->subDays($days))->delete();
|
||||
$this->info("Deleted {$count} AI executions.");
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,21 @@
|
||||
<?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; }
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user