video.go 4.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package dto
  2. type VideoRequest struct {
  3. Model string `json:"model,omitempty" example:"kling-v1"` // Model/style ID
  4. Prompt string `json:"prompt,omitempty" example:"宇航员站起身走了"` // Text prompt
  5. Image string `json:"image,omitempty" example:"https://h2.inkwai.com/bs2/upload-ylab-stunt/se/ai_portal_queue_mmu_image_upscale_aiweb/3214b798-e1b4-4b00-b7af-72b5b0417420_raw_image_0.jpg"` // Image input (URL/Base64)
  6. Duration float64 `json:"duration" example:"5.0"` // Video duration (seconds)
  7. Width int `json:"width" example:"512"` // Video width
  8. Height int `json:"height" example:"512"` // Video height
  9. Fps int `json:"fps,omitempty" example:"30"` // Video frame rate
  10. Seed int `json:"seed,omitempty" example:"20231234"` // Random seed
  11. N int `json:"n,omitempty" example:"1"` // Number of videos to generate
  12. ResponseFormat string `json:"response_format,omitempty" example:"url"` // Response format
  13. User string `json:"user,omitempty" example:"user-1234"` // User identifier
  14. Metadata map[string]any `json:"metadata,omitempty"` // Vendor-specific/custom params (e.g. negative_prompt, style, quality_level, etc.)
  15. }
  16. // VideoResponse 视频生成提交任务后的响应
  17. type VideoResponse struct {
  18. TaskId string `json:"task_id"`
  19. Status string `json:"status"`
  20. }
  21. // VideoTaskResponse 查询视频生成任务状态的响应
  22. type VideoTaskResponse struct {
  23. TaskId string `json:"task_id" example:"abcd1234efgh"` // 任务ID
  24. Status string `json:"status" example:"succeeded"` // 任务状态
  25. Url string `json:"url,omitempty"` // 视频资源URL(成功时)
  26. Format string `json:"format,omitempty" example:"mp4"` // 视频格式
  27. Metadata *VideoTaskMetadata `json:"metadata,omitempty"` // 结果元数据
  28. Error *VideoTaskError `json:"error,omitempty"` // 错误信息(失败时)
  29. }
  30. // VideoTaskMetadata 视频任务元数据
  31. type VideoTaskMetadata struct {
  32. Duration float64 `json:"duration" example:"5.0"` // 实际生成的视频时长
  33. Fps int `json:"fps" example:"30"` // 实际帧率
  34. Width int `json:"width" example:"512"` // 实际宽度
  35. Height int `json:"height" example:"512"` // 实际高度
  36. Seed int `json:"seed" example:"20231234"` // 使用的随机种子
  37. }
  38. // VideoTaskError 视频任务错误信息
  39. type VideoTaskError struct {
  40. Code int `json:"code"`
  41. Message string `json:"message"`
  42. }