style: apply rustfmt after master merge

This commit is contained in:
2026-05-14 19:17:40 +08:00
parent 502811a103
commit e55c12b68b
2 changed files with 22 additions and 18 deletions

View File

@@ -3614,9 +3614,8 @@ async fn ensure_match3d_background_music_asset(
)); ));
}; };
let title = require_match3d_background_music_title(plan).map_err(|error| { let title = require_match3d_background_music_title(plan)
match3d_error_response(request_context, MATCH3D_AGENT_PROVIDER, error) .map_err(|error| match3d_error_response(request_context, MATCH3D_AGENT_PROVIDER, error))?;
})?;
let style = normalize_match3d_audio_style(plan.style.as_str()); let style = normalize_match3d_audio_style(plan.style.as_str());
match generate_match3d_background_music_asset(state, owner_user_id, profile_id, &title, &style) match generate_match3d_background_music_asset(state, owner_user_id, profile_id, &title, &style)
.await .await
@@ -6556,12 +6555,13 @@ mod tests {
#[test] #[test]
fn match3d_background_music_title_is_required_for_auto_draft() { fn match3d_background_music_title_is_required_for_auto_draft() {
let missing = require_match3d_background_music_title(&Match3DGeneratedBackgroundMusicPlan { let missing =
title: " ,。 ".to_string(), require_match3d_background_music_title(&Match3DGeneratedBackgroundMusicPlan {
style: "轻快, 休闲".to_string(), title: " ,。 ".to_string(),
prompt: String::new(), style: "轻快, 休闲".to_string(),
}) prompt: String::new(),
.expect_err("自动草稿背景音乐必须有可提交给 Suno 的曲名"); })
.expect_err("自动草稿背景音乐必须有可提交给 Suno 的曲名");
assert!(missing.body_text().contains("背景音乐")); assert!(missing.body_text().contains("背景音乐"));

View File

@@ -3444,10 +3444,12 @@ async fn generate_puzzle_background_music_required(
) -> Result<CreationAudioAsset, AppError> { ) -> Result<CreationAudioAsset, AppError> {
let normalized_title = title.trim(); let normalized_title = title.trim();
if normalized_title.is_empty() { if normalized_title.is_empty() {
return Err(AppError::from_status(StatusCode::BAD_GATEWAY).with_details(json!({ return Err(
"provider": PUZZLE_AGENT_API_BASE_PROVIDER, AppError::from_status(StatusCode::BAD_GATEWAY).with_details(json!({
"message": "拼图草稿背景音乐名称为空,无法完成背景音乐生成", "provider": PUZZLE_AGENT_API_BASE_PROVIDER,
}))); "message": "拼图草稿背景音乐名称为空,无法完成背景音乐生成",
})),
);
} }
generate_background_music_asset_for_creation( generate_background_music_asset_for_creation(
state, state,
@@ -3517,11 +3519,13 @@ fn ensure_puzzle_initial_level_assets_ready(
missing.push("UI背景图"); missing.push("UI背景图");
} }
Err(AppError::from_status(StatusCode::BAD_GATEWAY).with_details(json!({ Err(
"provider": PUZZLE_AGENT_API_BASE_PROVIDER, AppError::from_status(StatusCode::BAD_GATEWAY).with_details(json!({
"message": format!("拼图草稿资源生成未完成:缺少{}", missing.join("")), "provider": PUZZLE_AGENT_API_BASE_PROVIDER,
"missingAssets": missing, "message": format!("拼图草稿资源生成未完成:缺少{}", missing.join("")),
}))) "missingAssets": missing,
})),
)
} }
fn find_puzzle_level_for_initial_asset_check<'a>( fn find_puzzle_level_for_initial_asset_check<'a>(