StoreAgentEventRequest.php 795 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace App\Http\Requests\V3;
  3. use App\Models\AgentEvent;
  4. use App\Models\AgentThread;
  5. use Illuminate\Foundation\Http\FormRequest;
  6. use Illuminate\Validation\Rule;
  7. /**
  8. * `POST /v3/agent-events` 的入参:AI 回答上的一条隐式信号。
  9. */
  10. class StoreAgentEventRequest extends FormRequest
  11. {
  12. public function authorize(): bool
  13. {
  14. return true;
  15. }
  16. /**
  17. * @return array<string, array<int, mixed>>
  18. */
  19. public function rules(): array
  20. {
  21. return [
  22. 'message_id' => ['required', 'string', 'max:64', 'regex:/^[A-Za-z0-9_\-]+$/'],
  23. 'kind' => ['required', Rule::in(AgentEvent::KINDS)],
  24. 'device_id' => ['nullable', 'uuid'],
  25. 'client' => ['nullable', Rule::in(AgentThread::CLIENTS)],
  26. ];
  27. }
  28. }