TestAIArticleTranslate.php 969 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace App\Console\Commands;
  3. use Illuminate\Console\Command;
  4. use App\Services\AIAssistant\ArticleTranslateService;
  5. class TestAIArticleTranslate extends Command
  6. {
  7. /**
  8. * The name and signature of the console command.
  9. * php artisan test:ai.article.translate
  10. * @var string
  11. */
  12. protected $signature = 'test:ai.article.translate';
  13. /**
  14. * The console command description.
  15. *
  16. * @var string
  17. */
  18. protected $description = 'Command description';
  19. /**
  20. * Execute the console command.
  21. */
  22. public function handle()
  23. {
  24. //
  25. // ===== 创建 Service =====
  26. $service = app(ArticleTranslateService::class);
  27. // ===== 执行 =====
  28. $result = $service->setModel('dd81ce6c-e9ff-46b2-b1af-947728ba996e')
  29. ->translate('2deaf8dd-65b3-4a76-86c4-deec7afabc38')
  30. ->get();
  31. // ===== 调试输出(建议保留)=====
  32. dump($result);
  33. }
  34. }