Xenodia Docs
指南

异步媒体工作流

为 Xenodia image 和 video task 构建可靠 polling、timeout 和 recovery 行为。

Image and video generation can take time. Image and video generation endpoints return a task envelope; clients should store task_id and call Task Retrieval.

Flow

  1. 提交 image 或 video generation request。
  2. 如果 response 是 202,保存 task_idpoll_url
  3. recommended_poll_interval_ms 或指数退避 polling。
  4. statesuccess 时读取 result
  5. statefail 时读取 error,并向用户展示可恢复的 message。

Client behavior

  • 不要无限 polling;给用户等待场景设置 timeout。
  • 用户离开页面时保存 task ID。
  • 对 task retrieval 使用认证请求。
  • 403 表示 task 不属于当前 account。
  • 404 表示 task ID 不存在或已不可用。

Result handling

生成资产 URL 可能是临时的。拿到 result.data[].url 后,尽快下载、转存或交给你的 media pipeline。

本页内容