mirror of
https://github.com/openai/codex.git
synced 2026-04-29 02:41:12 +03:00
Add final message prefix to realtime handoff output (#15077)
- prefix realtime handoff output with the agent final message label for both realtime v1 and v2 - update realtime websocket and core expectations to match
This commit is contained in:
@@ -1173,7 +1173,10 @@ mod tests {
|
||||
let fourth_json: Value = serde_json::from_str(&fourth).expect("json");
|
||||
assert_eq!(fourth_json["type"], "conversation.handoff.append");
|
||||
assert_eq!(fourth_json["handoff_id"], "handoff_1");
|
||||
assert_eq!(fourth_json["output_text"], "hello from codex");
|
||||
assert_eq!(
|
||||
fourth_json["output_text"],
|
||||
"\"Agent Final Message\":\n\nhello from codex"
|
||||
);
|
||||
|
||||
ws.send(Message::Text(
|
||||
json!({
|
||||
@@ -1504,7 +1507,7 @@ mod tests {
|
||||
);
|
||||
assert_eq!(
|
||||
third_json["item"]["output"],
|
||||
Value::String("delegated result".to_string())
|
||||
Value::String("\"Agent Final Message\":\n\ndelegated result".to_string())
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ use crate::endpoint::realtime_websocket::protocol::RealtimeSessionMode;
|
||||
use crate::endpoint::realtime_websocket::protocol::SessionUpdateSession;
|
||||
|
||||
pub(super) const REALTIME_AUDIO_SAMPLE_RATE: u32 = 24_000;
|
||||
const AGENT_FINAL_MESSAGE_PREFIX: &str = "\"Agent Final Message\":\n\n";
|
||||
|
||||
pub(super) fn normalized_session_mode(
|
||||
event_parser: RealtimeEventParser,
|
||||
@@ -38,6 +39,7 @@ pub(super) fn conversation_handoff_append_message(
|
||||
handoff_id: String,
|
||||
output_text: String,
|
||||
) -> RealtimeOutboundMessage {
|
||||
let output_text = format!("{AGENT_FINAL_MESSAGE_PREFIX}{output_text}");
|
||||
match event_parser {
|
||||
RealtimeEventParser::V1 => v1_conversation_handoff_append_message(handoff_id, output_text),
|
||||
RealtimeEventParser::RealtimeV2 => {
|
||||
|
||||
Reference in New Issue
Block a user