mirror of
https://github.com/openai/codex.git
synced 2026-04-24 06:35:50 +00:00
Add realtime transport config (#17097)
Adds realtime.transport config with websocket as the default and webrtc wired through the effective config. Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
@@ -445,6 +445,15 @@ pub enum RealtimeWsMode {
|
||||
Transcription,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Copy, Default, PartialEq, Eq, JsonSchema)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum RealtimeTransport {
|
||||
#[serde(rename = "webrtc")]
|
||||
WebRtc,
|
||||
#[default]
|
||||
Websocket,
|
||||
}
|
||||
|
||||
pub use codex_protocol::protocol::RealtimeConversationVersion as RealtimeWsVersion;
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Default, PartialEq, Eq, JsonSchema)]
|
||||
@@ -453,6 +462,7 @@ pub struct RealtimeConfig {
|
||||
pub version: RealtimeWsVersion,
|
||||
#[serde(rename = "type")]
|
||||
pub session_type: RealtimeWsMode,
|
||||
pub transport: RealtimeTransport,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Default, PartialEq, Eq, JsonSchema)]
|
||||
@@ -461,6 +471,7 @@ pub struct RealtimeToml {
|
||||
pub version: Option<RealtimeWsVersion>,
|
||||
#[serde(rename = "type")]
|
||||
pub session_type: Option<RealtimeWsMode>,
|
||||
pub transport: Option<RealtimeTransport>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Default, PartialEq, Eq, JsonSchema)]
|
||||
|
||||
@@ -1497,6 +1497,9 @@
|
||||
"RealtimeToml": {
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"transport": {
|
||||
"$ref": "#/definitions/RealtimeTransport"
|
||||
},
|
||||
"type": {
|
||||
"$ref": "#/definitions/RealtimeWsMode"
|
||||
},
|
||||
@@ -1506,6 +1509,13 @@
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"RealtimeTransport": {
|
||||
"enum": [
|
||||
"webrtc",
|
||||
"websocket"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"RealtimeWsMode": {
|
||||
"enum": [
|
||||
"conversational",
|
||||
|
||||
@@ -12,6 +12,7 @@ use codex_config::config_toml::ProjectConfig;
|
||||
use codex_config::config_toml::RealtimeAudioConfig;
|
||||
use codex_config::config_toml::RealtimeConfig;
|
||||
use codex_config::config_toml::RealtimeToml;
|
||||
use codex_config::config_toml::RealtimeTransport;
|
||||
use codex_config::config_toml::RealtimeWsMode;
|
||||
use codex_config::config_toml::RealtimeWsVersion;
|
||||
use codex_config::config_toml::ToolsToml;
|
||||
@@ -6487,6 +6488,7 @@ fn realtime_loads_from_config_toml() -> std::io::Result<()> {
|
||||
[realtime]
|
||||
version = "v2"
|
||||
type = "transcription"
|
||||
transport = "webrtc"
|
||||
"#,
|
||||
)
|
||||
.expect("TOML deserialization should succeed");
|
||||
@@ -6496,6 +6498,7 @@ type = "transcription"
|
||||
Some(RealtimeToml {
|
||||
version: Some(RealtimeWsVersion::V2),
|
||||
session_type: Some(RealtimeWsMode::Transcription),
|
||||
transport: Some(RealtimeTransport::WebRtc),
|
||||
})
|
||||
);
|
||||
|
||||
@@ -6511,6 +6514,7 @@ type = "transcription"
|
||||
RealtimeConfig {
|
||||
version: RealtimeWsVersion::V2,
|
||||
session_type: RealtimeWsMode::Transcription,
|
||||
transport: RealtimeTransport::WebRtc,
|
||||
}
|
||||
);
|
||||
Ok(())
|
||||
|
||||
@@ -2095,6 +2095,7 @@ impl Config {
|
||||
.map_or_else(RealtimeConfig::default, |realtime| RealtimeConfig {
|
||||
version: realtime.version.unwrap_or_default(),
|
||||
session_type: realtime.session_type.unwrap_or_default(),
|
||||
transport: realtime.transport.unwrap_or_default(),
|
||||
}),
|
||||
experimental_realtime_ws_backend_prompt: cfg.experimental_realtime_ws_backend_prompt,
|
||||
experimental_realtime_ws_startup_context: cfg.experimental_realtime_ws_startup_context,
|
||||
|
||||
Reference in New Issue
Block a user