mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Support image references by file ID in inputs and tool outputs (#45794)
## What changed - Accept `fileId` alongside the existing `url` form for app-server image inputs, and forward file references to the Responses API as `file_id`. Update generated schemas and client types. - Preserve file references, image detail hints, and mixed inline/file image ordering through user-message events, thread history, and rollout migration. Retain file images when truncating tool output. - Pass file references through image preparation without resolving them, while keeping resize-notice numbering correct. Omit them from unsupported TUI display and Guardian image context. - Reject image-edit requests whose recent-image window includes a file reference, preventing selection of an older inline image instead. ## Testing Add coverage for serialization, request and rollout preservation, mixed-image history ordering, incomplete ordering metadata, tool-output truncation, and rejection of unsupported image-edit selections. GitOrigin-RevId: 6ca20a8577155cc934b720803c3b7b3bffdf972a
This commit is contained in:
1 parent
c51cb968e4
commit
7b8b17b97a
95 files changed
+2434
-324
No files matched your search
@@ -210,20 +210,27 @@ impl CollectedContext {
|
||||
let items = evidence
|
||||
.items
|
||||
.into_iter()
|
||||
.map(|item| match item {
|
||||
.filter_map(|item| match item {
|
||||
UserInput::Text { text, .. } => {
|
||||
Ok(Budgeted::required(ContentItem::InputText { text }))
|
||||
Some(Ok(Budgeted::required(ContentItem::InputText { text })))
|
||||
}
|
||||
UserInput::Image { image_url, detail } => Ok(Budgeted::optional(
|
||||
UserInput::Image {
|
||||
image: ImageReference::Inline { image_url },
|
||||
detail,
|
||||
} => Some(Ok(Budgeted::optional(
|
||||
ContentItem::InputImage {
|
||||
image: ImageReference::Inline { image_url },
|
||||
detail,
|
||||
},
|
||||
BudgetPriority::Image,
|
||||
)),
|
||||
_ => Err(SectionError::UnsupportedDelivery {
|
||||
))),
|
||||
UserInput::Image {
|
||||
image: ImageReference::File { .. },
|
||||
..
|
||||
} => None,
|
||||
_ => Some(Err(SectionError::UnsupportedDelivery {
|
||||
section: "node_repl_evidence",
|
||||
}),
|
||||
})),
|
||||
})
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
(
|
||||
@@ -288,7 +295,14 @@ impl ComposedContext {
|
||||
ContentItem::InputImage {
|
||||
image: ImageReference::Inline { image_url },
|
||||
detail,
|
||||
} => UserInput::Image { image_url, detail },
|
||||
} => UserInput::Image {
|
||||
image: ImageReference::Inline { image_url },
|
||||
detail,
|
||||
},
|
||||
ContentItem::InputImage {
|
||||
image: ImageReference::File { .. },
|
||||
..
|
||||
} => continue,
|
||||
ContentItem::InputAudio { .. } | ContentItem::OutputText { .. } => {
|
||||
return Err(SectionError::UnsupportedDelivery {
|
||||
section: section.id,
|
||||
@@ -316,6 +330,10 @@ impl ComposedContext {
|
||||
}
|
||||
}));
|
||||
}
|
||||
ContentItem::InputImage {
|
||||
image: ImageReference::File { .. },
|
||||
..
|
||||
} => {}
|
||||
content => user_content.push(content),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user