This commit is contained in:
2026-05-09 18:24:08 +08:00
parent a0ed128bde
commit bc704d0c22
38 changed files with 481 additions and 378 deletions

View File

@@ -583,7 +583,7 @@ pub async fn generate_custom_world_scene_image(
.map(downloaded_openai_to_custom_world_image)
.ok_or_else(|| {
AppError::from_status(StatusCode::BAD_GATEWAY).with_details(json!({
"provider": "apimart",
"provider": "vector-engine",
"message": "场景图片生成成功但未返回图片。",
}))
})?;
@@ -687,7 +687,7 @@ pub(crate) async fn generate_custom_world_scene_image_for_profile(
.map(downloaded_openai_to_custom_world_image)
.ok_or_else(|| {
AppError::from_status(StatusCode::BAD_GATEWAY).with_details(json!({
"provider": "apimart",
"provider": "vector-engine",
"message": "场景图片生成成功但未返回图片。",
}))
})?;
@@ -1200,7 +1200,7 @@ async fn generate_opening_cg_storyboard(
.map(downloaded_openai_to_custom_world_image)
.ok_or_else(|| {
AppError::from_status(StatusCode::BAD_GATEWAY).with_details(json!({
"provider": "apimart",
"provider": "vector-engine",
"message": "开局 CG 故事板生成成功但未返回图片。",
}))
})?;
@@ -3274,9 +3274,10 @@ mod tests {
serde_json::from_slice(&body).expect("body should be valid json")
}
fn build_state_without_apimart_key() -> AppState {
fn build_state_without_vector_engine_key() -> AppState {
let mut config = AppConfig::default();
config.apimart_api_key = None;
config.vector_engine_base_url = "https://api.vectorengine.test".to_string();
config.vector_engine_api_key = None;
AppState::new(config).expect("state should build")
}
@@ -3287,8 +3288,8 @@ mod tests {
}
#[tokio::test]
async fn scene_image_returns_service_unavailable_when_apimart_missing() {
let state = build_state_without_apimart_key();
async fn scene_image_returns_service_unavailable_when_vector_engine_missing() {
let state = build_state_without_vector_engine_key();
let request_context = build_request_context("POST /api/runtime/custom-world/scene-image");
let authenticated = build_authenticated(&state);
@@ -3311,7 +3312,7 @@ mod tests {
})),
)
.await
.expect_err("missing apimart should fail");
.expect_err("missing vector engine should fail");
let payload = read_error_response(response).await;
assert_eq!(
@@ -3320,7 +3321,7 @@ mod tests {
);
assert_eq!(
payload["error"]["details"]["provider"],
Value::String("apimart".to_string())
Value::String("vector-engine".to_string())
);
}