From 206b4830a194c3e8360419ecb0cb7cf9a6181fff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Sat, 12 Sep 2026 13:19:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=8D=E7=94=A8=E5=8E=9F=E5=9B=BE=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E9=94=99=E8=AF=AF=E6=91=98=E8=A6=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 解析失败分支只计算一次截断响应并同时用于审计与错误返回 --- .../crates/platform-image/src/vector_engine/raw_edit.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server-rs/crates/platform-image/src/vector_engine/raw_edit.rs b/server-rs/crates/platform-image/src/vector_engine/raw_edit.rs index 1bb1d2e25..5d722ffa8 100644 --- a/server-rs/crates/platform-image/src/vector_engine/raw_edit.rs +++ b/server-rs/crates/platform-image/src/vector_engine/raw_edit.rs @@ -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), }); }