StoreAiModelRequest.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace App\Http\Requests;
  3. use Illuminate\Foundation\Http\FormRequest;
  4. class StoreAiModelRequest extends FormRequest
  5. {
  6. /**
  7. * Determine if the user is authorized to make this request.
  8. *
  9. * @return bool
  10. */
  11. public function authorize()
  12. {
  13. // 真正的鉴权在 AiModelController::store():需要先把 studio_name 解成 studio uid
  14. return true;
  15. }
  16. /**
  17. * Get the validation rules that apply to the request.
  18. *
  19. * 长度上限对齐 ai_models 表的列定义。
  20. *
  21. * @return array
  22. */
  23. public function rules()
  24. {
  25. return [
  26. 'name' => ['required', 'string', 'max:64'],
  27. 'studio_name' => ['required', 'string'],
  28. 'description' => ['nullable', 'string'],
  29. 'system_prompt' => ['nullable', 'string'],
  30. 'url' => ['nullable', 'string', 'max:1024'],
  31. 'model' => ['nullable', 'string', 'max:1024'],
  32. 'key' => ['nullable', 'string', 'max:1024'],
  33. 'privacy' => ['nullable', 'string', 'in:private,public,disable'],
  34. ];
  35. }
  36. }