mirror of
https://github.com/openai/codex.git
synced 2026-10-25 18:28:38 +00:00
Gate remote image materialization
This commit is contained in:
@@ -506,6 +506,7 @@ chatgpt_base_url = "{server_uri}"
|
||||
|
||||
[features]
|
||||
imagegenext = true
|
||||
materialize_remote_images = true
|
||||
{code_mode_only}
|
||||
|
||||
[model_providers.openai-custom]
|
||||
|
||||
@@ -872,7 +872,7 @@ async fn turn_start_tracks_turn_event_analytics() -> Result<()> {
|
||||
thread_id: thread.id.clone(),
|
||||
client_user_message_id: None,
|
||||
input: vec![V2UserInput::Image {
|
||||
url: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGNgYAAAAAMAASsJTYQAAAAASUVORK5CYII=".to_string(),
|
||||
url: "https://example.com/a.png".to_string(),
|
||||
detail: None,
|
||||
}],
|
||||
responsesapi_client_metadata: Some(HashMap::from([(
|
||||
|
||||
@@ -512,6 +512,9 @@
|
||||
"local_thread_store_compression": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"materialize_remote_images": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"memories": {
|
||||
"type": "boolean"
|
||||
},
|
||||
@@ -4638,6 +4641,9 @@
|
||||
"local_thread_store_compression": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"materialize_remote_images": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"memories": {
|
||||
"type": "boolean"
|
||||
},
|
||||
@@ -5224,4 +5230,4 @@
|
||||
},
|
||||
"title": "ConfigToml",
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
use std::borrow::Cow;
|
||||
use std::collections::BTreeMap;
|
||||
use std::collections::HashMap;
|
||||
use std::collections::HashSet;
|
||||
@@ -2588,8 +2589,14 @@ impl Session {
|
||||
turn_context: &TurnContext,
|
||||
items: &[ResponseItem],
|
||||
) {
|
||||
let items =
|
||||
crate::image_url_materializer::materialize_conversation_item_images(items).await;
|
||||
let items = if turn_context
|
||||
.features
|
||||
.enabled(Feature::MaterializeRemoteImages)
|
||||
{
|
||||
crate::image_url_materializer::materialize_conversation_item_images(items).await
|
||||
} else {
|
||||
Cow::Borrowed(items)
|
||||
};
|
||||
let items = items.as_ref();
|
||||
{
|
||||
let mut state = self.state.lock().await;
|
||||
|
||||
@@ -2508,7 +2508,10 @@ image("data:image/png;base64,AAA");
|
||||
"#
|
||||
);
|
||||
let (_test, second_mock) =
|
||||
run_code_mode_turn(&server, "use exec to return images", &code).await?;
|
||||
run_code_mode_turn_with_config(&server, "use exec to return images", &code, |config| {
|
||||
let _ = config.features.enable(Feature::MaterializeRemoteImages);
|
||||
})
|
||||
.await?;
|
||||
|
||||
let req = second_mock.single_request();
|
||||
let items = custom_tool_output_items(&req, "call-1");
|
||||
|
||||
@@ -183,6 +183,8 @@ pub enum Feature {
|
||||
ImageGeneration,
|
||||
/// Replace hosted image generation with the standalone image-generation extension.
|
||||
ImageGenExt,
|
||||
/// Download remote images before recording them in conversation history.
|
||||
MaterializeRemoteImages,
|
||||
/// Allow prompting and installing missing MCP dependencies.
|
||||
SkillMcpDependencyInstall,
|
||||
/// Removed compatibility flag for deleted skill env var dependency prompting.
|
||||
@@ -1090,6 +1092,12 @@ pub const FEATURES: &[FeatureSpec] = &[
|
||||
stage: Stage::UnderDevelopment,
|
||||
default_enabled: false,
|
||||
},
|
||||
FeatureSpec {
|
||||
id: Feature::MaterializeRemoteImages,
|
||||
key: "materialize_remote_images",
|
||||
stage: Stage::UnderDevelopment,
|
||||
default_enabled: false,
|
||||
},
|
||||
FeatureSpec {
|
||||
id: Feature::SkillMcpDependencyInstall,
|
||||
key: "skill_mcp_dependency_install",
|
||||
|
||||
Reference in New Issue
Block a user