TestAiTask.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace App\Console\Commands;
  3. use Illuminate\Console\Command;
  4. use App\Http\Api\AiTaskPrepare;
  5. use App\Services\AiTranslateService;
  6. class TestAiTask extends Command
  7. {
  8. /**
  9. * The name and signature of the console command.
  10. * php artisan test:ai.task c77af42f-ffb5-48ae-af71-4c32e1c30dab
  11. * php artisan test:ai.task f42fa690-c590-400f-9de9-fbc81e838a5a
  12. * @var string
  13. */
  14. protected $signature = 'test:ai.task {id} {--test}';
  15. /**
  16. * The console command description.
  17. *
  18. * @var string
  19. */
  20. protected $description = 'test ai task';
  21. /**
  22. * Create a new command instance.
  23. *
  24. * @return void
  25. */
  26. public function __construct()
  27. {
  28. parent::__construct();
  29. }
  30. /**
  31. * Execute the console command.
  32. *
  33. * @return int
  34. */
  35. public function handle()
  36. {
  37. $taskId = $this->argument('id');
  38. $ai = app(AiTranslateService::class);
  39. $params = $ai->makeByTask($taskId, !$this->option('test'));
  40. var_dump($params);
  41. var_dump($this->option('test'));
  42. $this->info('total:' . count($params));
  43. return 0;
  44. }
  45. }