mirror of
https://github.com/openai/codex.git
synced 2026-11-13 14:46:14 +00:00
Preserve image transparency metadata in app-server items (#37178)
## What changed - Add `transparentBackground` to image-generation items and legacy completion events. - Map Images API backgrounds to `true` for transparent, `false` for opaque, and `null` for automatic or unavailable values. - Preserve the metadata in live notifications and persisted or resumed thread history while continuing to deserialize older items that omit it. ## Testing - Cover transparent, opaque, and automatic backgrounds, including image edits and thread read/resume flows. - Verify the stable JSON shape and optional TypeScript field. GitOrigin-RevId: 08527f37f23431df45fab1ed34eb82b2139b49d7
This commit is contained in:
1 parent
a3ebd19fa4
commit
928bda82cf
35 files changed
+407
-9
No files matched your search
@@ -862,6 +862,7 @@ impl ThreadHistoryBuilder {
|
||||
status: String::new(),
|
||||
revised_prompt: None,
|
||||
result: String::new(),
|
||||
transparent_background: None,
|
||||
saved_path: None,
|
||||
});
|
||||
self.upsert_item_in_current_turn(item);
|
||||
@@ -873,6 +874,7 @@ impl ThreadHistoryBuilder {
|
||||
status: payload.status.clone(),
|
||||
revised_prompt: payload.revised_prompt.clone(),
|
||||
result: payload.result.clone(),
|
||||
transparent_background: payload.transparent_background,
|
||||
saved_path: payload.saved_path.clone(),
|
||||
});
|
||||
self.upsert_item_in_current_turn(item);
|
||||
@@ -2076,6 +2078,7 @@ mod tests {
|
||||
status: "completed".to_string(),
|
||||
revised_prompt: Some("A blue square".to_string()),
|
||||
result: "cG5n".to_string(),
|
||||
transparent_background: Some(true),
|
||||
saved_path: Some(saved_path.clone()),
|
||||
},
|
||||
)),
|
||||
@@ -2106,6 +2109,7 @@ mod tests {
|
||||
status: "completed".to_string(),
|
||||
revised_prompt: Some("A blue square".to_string()),
|
||||
result: "cG5n".to_string(),
|
||||
transparent_background: Some(true),
|
||||
saved_path: Some(saved_path),
|
||||
})]
|
||||
);
|
||||
@@ -2368,6 +2372,7 @@ mod tests {
|
||||
status: "completed".into(),
|
||||
revised_prompt: Some("final prompt".into()),
|
||||
result: "Zm9v".into(),
|
||||
transparent_background: Some(true),
|
||||
saved_path: Some(test_path_buf("/tmp/ig_123.png").abs()),
|
||||
})),
|
||||
RolloutItem::EventMsg(EventMsg::TurnComplete(TurnCompleteEvent {
|
||||
@@ -2407,6 +2412,7 @@ mod tests {
|
||||
status: "completed".into(),
|
||||
revised_prompt: Some("final prompt".into()),
|
||||
result: "Zm9v".into(),
|
||||
transparent_background: Some(true),
|
||||
saved_path: Some(test_path_buf("/tmp/ig_123.png").abs()),
|
||||
}),
|
||||
],
|
||||
|
||||
@@ -928,6 +928,7 @@ impl From<CoreTurnItem> for ThreadItem {
|
||||
status: image.status,
|
||||
revised_prompt: image.revised_prompt,
|
||||
result: image.result,
|
||||
transparent_background: None,
|
||||
saved_path: image.saved_path,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user