AgentFeedbackResource.php 748 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace App\Http\Resources\V3;
  3. use App\Models\AgentFeedback;
  4. use Illuminate\Http\Request;
  5. /**
  6. * 我对一条 AI 回答的评价。
  7. *
  8. * @mixin AgentFeedback
  9. */
  10. class AgentFeedbackResource extends BaseResource
  11. {
  12. /**
  13. * @param Request $request
  14. * @return array{message_id: string, rating: int, tags: array<int, string>, comment: string|null, asked: bool, updated_at: string}
  15. */
  16. public function toArray($request): array
  17. {
  18. return [
  19. 'message_id' => $this->message_id,
  20. 'rating' => $this->rating,
  21. 'tags' => $this->tags ?? [],
  22. 'comment' => $this->comment,
  23. 'asked' => $this->asked,
  24. 'updated_at' => $this->updated_at,
  25. ];
  26. }
  27. }