mirror of
https://github.com/openai/codex.git
synced 2026-11-21 22:50:37 +00:00
Merge remote-tracking branch 'origin/main' into guinness/realtime-terminal-output
This commit is contained in:
@@ -573,12 +573,14 @@ async fn prepare_realtime_start(
|
||||
if let Some(realtime_ws_base_url) = &config.experimental_realtime_ws_base_url {
|
||||
api_provider.base_url = realtime_ws_base_url.clone();
|
||||
}
|
||||
let version = config.realtime.version;
|
||||
let version = params.version.unwrap_or(config.realtime.version);
|
||||
let session_config = build_realtime_session_config(
|
||||
sess,
|
||||
params.model,
|
||||
params.prompt,
|
||||
params.realtime_session_id,
|
||||
params.output_modality,
|
||||
version,
|
||||
params.voice,
|
||||
)
|
||||
.await?;
|
||||
@@ -612,9 +614,11 @@ async fn prepare_realtime_start(
|
||||
|
||||
pub(crate) async fn build_realtime_session_config(
|
||||
sess: &Arc<Session>,
|
||||
model: Option<String>,
|
||||
prompt: Option<Option<String>>,
|
||||
realtime_session_id: Option<String>,
|
||||
output_modality: RealtimeOutputModality,
|
||||
version: RealtimeWsVersion,
|
||||
voice: Option<RealtimeVoice>,
|
||||
) -> CodexResult<RealtimeSessionConfig> {
|
||||
let config = sess.get_config().await;
|
||||
@@ -637,18 +641,15 @@ pub(crate) async fn build_realtime_session_config(
|
||||
(false, false) => format!("{prompt}\n\n{startup_context}"),
|
||||
};
|
||||
let model = Some(
|
||||
config
|
||||
.experimental_realtime_ws_model
|
||||
.clone()
|
||||
model
|
||||
.or_else(|| config.experimental_realtime_ws_model.clone())
|
||||
.unwrap_or_else(|| DEFAULT_REALTIME_MODEL.to_string()),
|
||||
);
|
||||
let event_parser = match config.realtime.version {
|
||||
let event_parser = match version {
|
||||
RealtimeWsVersion::V1 => RealtimeEventParser::V1,
|
||||
RealtimeWsVersion::V2 => RealtimeEventParser::RealtimeV2,
|
||||
};
|
||||
if config.realtime.version == RealtimeWsVersion::V1
|
||||
&& matches!(output_modality, RealtimeOutputModality::Text)
|
||||
{
|
||||
if version == RealtimeWsVersion::V1 && matches!(output_modality, RealtimeOutputModality::Text) {
|
||||
return Err(CodexErr::InvalidRequest(
|
||||
"text realtime output modality requires realtime v2".to_string(),
|
||||
));
|
||||
@@ -659,8 +660,8 @@ pub(crate) async fn build_realtime_session_config(
|
||||
};
|
||||
let voice = voice
|
||||
.or(config.realtime.voice)
|
||||
.unwrap_or_else(|| default_realtime_voice(config.realtime.version));
|
||||
validate_realtime_voice(config.realtime.version, voice)?;
|
||||
.unwrap_or_else(|| default_realtime_voice(version));
|
||||
validate_realtime_voice(version, voice)?;
|
||||
Ok(RealtimeSessionConfig {
|
||||
instructions: prompt,
|
||||
model,
|
||||
|
||||
Reference in New Issue
Block a user