复用原图编辑错误摘要

解析失败分支只计算一次截断响应并同时用于审计与错误返回
This commit is contained in:
2026-09-12 13:19:10 +08:00
parent 4b8e268816
commit 206b4830a1
@@ -262,6 +262,7 @@ pub async fn create_vector_engine_raw_image_edit(
Ok(payload) => payload,
Err(error) => {
let message = format!("{failure_context}:上游响应不是 JSON{error}");
let raw_excerpt = truncate_raw(body.as_str());
let audit = build_failure_audit(
url.as_str(),
failure_context,
@@ -272,7 +273,7 @@ pub async fn create_vector_engine_raw_image_edit(
false,
message.as_str(),
Some(error.to_string()),
Some(truncate_raw(body.as_str())),
Some(raw_excerpt.clone()),
Some(started_at.elapsed().as_millis() as u64),
prompt_chars,
reference_image_count,
@@ -281,7 +282,7 @@ pub async fn create_vector_engine_raw_image_edit(
return Err(PlatformImageError::ResponseParse {
provider: VECTOR_ENGINE_PROVIDER,
message,
raw_excerpt: truncate_raw(body.as_str()),
raw_excerpt,
audit: Some(audit),
});
}