冒烟示例在任务未完成时跳过下载并继续后续入口

轮询改用 throw_on_failure=false,失败终态交回示例按 status 判定而不是直接返回错误

非 Completed 的任务打印 status 与 failure 后 continue,避免一个入口失败中断其余入口的冒烟
This commit is contained in:
2026-09-19 13:12:23 +08:00
parent b631125a16
commit 6c209b115a
@@ -16,7 +16,7 @@ use std::{env, fs, time::Duration};
use platform_tripo::TripoProviderClient;
use shared_contracts::model3d::{
common::{Model3dModelVersion, Model3dTextureQuality},
common::{Model3dModelVersion, Model3dTaskStatus, Model3dTextureQuality},
image_to_model::Model3dImageToModelRequest,
multiview_to_model::{Model3dMultiviewInputs, Model3dMultiviewToModelRequest},
text_to_model::Model3dTextToModelRequest,
@@ -140,6 +140,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
&handle.task_id,
WaitOptions {
timeout: Some(Duration::from_secs(30 * 60)),
// Non-success terminal states are reported below by status
// so the remaining endpoints are still exercised.
throw_on_failure: false,
..WaitOptions::default()
},
)
@@ -151,6 +154,14 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
snapshot.status, snapshot.progress, snapshot.output
);
if snapshot.status != Model3dTaskStatus::Completed {
eprintln!(
"{name} skipped download: status={:?} failure={:?}",
snapshot.status, snapshot.failure
);
continue;
}
let downloaded = client.download_model(&snapshot).await?;
let filename = downloaded.filename(name);
fs::write(&filename, &downloaded.data)?;