收紧 Raw 成功响应字段类型

要求 data 与 b64_json 必填并移除无用 provider id

prompt 上限调整为 4 KiB 原始字节并同步文档
This commit is contained in:
2026-09-09 12:03:03 +08:00
parent acfcf0c158
commit c049d68b8e
4 changed files with 14 additions and 15 deletions
+3 -4
View File
@@ -59,7 +59,7 @@ pub(crate) struct RawImageEditResponse {
pub(crate) data: Vec<RawImageEditItem>,
}
const RAW_IMAGE_MAX_PROMPT_BYTES: usize = 16 * 1024;
const RAW_IMAGE_MAX_PROMPT_BYTES: usize = 4 * 1024;
pub(crate) async fn edit_raw_image(
State(state): State<AppState>,
@@ -109,7 +109,6 @@ pub(crate) async fn edit_raw_image(
return Err(map_platform_image_error(error));
}
};
let task_id = generated.task_id.clone();
let data: Vec<RawImageEditItem> = generated
.b64_images
.into_iter()
@@ -125,7 +124,7 @@ pub(crate) async fn edit_raw_image(
started_at_micros,
true,
None,
Some(task_id),
Some("raw-image-edit".to_string()),
Some(json!({ "imageCount": data.len() })),
)
.await;
@@ -452,6 +451,6 @@ mod tests {
Err(error) => error,
};
assert!(format!("{error:?}").contains("prompt 不能超过 16384 字节"));
assert!(format!("{error:?}").contains("prompt 不能超过 4096 字节"));
}
}