mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-11 04:16:55 +00:00
all job tokens
This commit is contained in:
1 parent
0d0595e557
commit
03734a2961
2 files changed
+10
-6
No files matched your search
+5
@@ -59,5 +59,10 @@ pub enum Seedance2p0BatchCount {
|
||||
#[derive(Serialize, Deserialize, ToSchema)]
|
||||
pub struct Seedance2p0MultiFunctionVideoGenResponse {
|
||||
pub success: bool,
|
||||
|
||||
/// The first inference job token (always present).
|
||||
pub inference_job_token: InferenceJobToken,
|
||||
|
||||
/// All inference job tokens for the batch (includes `inference_job_token` as the first entry).
|
||||
pub all_inference_job_tokens: Vec<InferenceJobToken>,
|
||||
}
|
||||
+5
-6
@@ -332,7 +332,7 @@ pub async fn seedance_2p0_multi_function_video_gen_handler(
|
||||
_ => vec![gen_response.order_id],
|
||||
};
|
||||
|
||||
let mut first_job_token: Option<InferenceJobToken> = None;
|
||||
let mut all_job_tokens: Vec<InferenceJobToken> = Vec::with_capacity(order_ids.len());
|
||||
|
||||
for (i, order_id) in order_ids.iter().enumerate() {
|
||||
let job_token = if i == 0 {
|
||||
@@ -366,9 +366,7 @@ pub async fn seedance_2p0_multi_function_video_gen_handler(
|
||||
|
||||
match db_result {
|
||||
Ok(token) => {
|
||||
if first_job_token.is_none() {
|
||||
first_job_token = Some(token);
|
||||
}
|
||||
all_job_tokens.push(token);
|
||||
}
|
||||
Err(err) => {
|
||||
warn!("Error inserting seedance2pro inference job (order_id={}): {:?}", order_id, err);
|
||||
@@ -379,7 +377,7 @@ pub async fn seedance_2p0_multi_function_video_gen_handler(
|
||||
}
|
||||
}
|
||||
|
||||
let job_token = first_job_token.ok_or_else(|| {
|
||||
let first_job_token = all_job_tokens.first().cloned().ok_or_else(|| {
|
||||
error!("No inference job token was created");
|
||||
CommonWebError::ServerError
|
||||
})?;
|
||||
@@ -394,6 +392,7 @@ pub async fn seedance_2p0_multi_function_video_gen_handler(
|
||||
|
||||
Ok(Json(Seedance2p0MultiFunctionVideoGenResponse {
|
||||
success: true,
|
||||
inference_job_token: job_token,
|
||||
inference_job_token: first_job_token,
|
||||
all_inference_job_tokens: all_job_tokens,
|
||||
}))
|
||||
}
|
||||
Reference in new issue
Block a user