mirror of
https://github.com/openai/codex.git
synced 2026-09-09 15:58:47 +00:00
Simplify realtime final answer filtering
This commit is contained in:
@@ -2936,14 +2936,10 @@ impl Session {
|
||||
}
|
||||
|
||||
async fn maybe_clear_realtime_handoff_for_event(&self, msg: &EventMsg) {
|
||||
let EventMsg::TurnComplete(event) = msg else {
|
||||
if !matches!(msg, EventMsg::TurnComplete(_)) {
|
||||
return;
|
||||
};
|
||||
if let Err(err) = self
|
||||
.conversation
|
||||
.handoff_complete(event.last_agent_message.clone())
|
||||
.await
|
||||
{
|
||||
}
|
||||
if let Err(err) = self.conversation.handoff_complete().await {
|
||||
debug!("failed to finalize realtime handoff output: {err}");
|
||||
}
|
||||
self.conversation.clear_active_handoff().await;
|
||||
|
||||
@@ -448,10 +448,7 @@ impl RealtimeConversationManager {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) async fn handoff_complete(
|
||||
&self,
|
||||
final_output_text: Option<String>,
|
||||
) -> CodexResult<()> {
|
||||
pub(crate) async fn handoff_complete(&self) -> CodexResult<()> {
|
||||
let handoff = {
|
||||
let guard = self.state.lock().await;
|
||||
guard.as_ref().map(|state| state.handoff.clone())
|
||||
@@ -467,19 +464,9 @@ impl RealtimeConversationManager {
|
||||
let Some(handoff_id) = handoff.active_handoff.lock().await.clone() else {
|
||||
return Ok(());
|
||||
};
|
||||
let output_text = match final_output_text {
|
||||
Some(output_text) => output_text,
|
||||
None => {
|
||||
let Some(output_text) = handoff.last_output_text.lock().await.clone() else {
|
||||
return Ok(());
|
||||
};
|
||||
output_text
|
||||
}
|
||||
};
|
||||
|
||||
if output_text.is_empty() {
|
||||
let Some(output_text) = handoff.last_output_text.lock().await.clone() else {
|
||||
return Ok(());
|
||||
}
|
||||
};
|
||||
|
||||
handoff
|
||||
.output_tx
|
||||
|
||||
Reference in New Issue
Block a user