mirror of
https://github.com/openai/codex.git
synced 2026-10-30 19:18:49 +00:00
Drop output
This commit is contained in:
@@ -110,6 +110,7 @@ pub(crate) struct UnifiedExecSessionManager {
|
||||
#[derive(Clone, Debug)]
|
||||
pub(crate) struct StdinEvent {
|
||||
pub input: String,
|
||||
#[allow(dead_code)]
|
||||
pub output: String,
|
||||
}
|
||||
|
||||
|
||||
@@ -54,12 +54,11 @@ fn escape_stdin_for_log(input: &str) -> String {
|
||||
}
|
||||
|
||||
fn render_stdin_events(events: &[StdinEvent]) -> String {
|
||||
let mut lines = Vec::new();
|
||||
for event in events {
|
||||
lines.push(event.input.clone());
|
||||
lines.push(format!("> {}", event.output));
|
||||
}
|
||||
lines.join("\n")
|
||||
events
|
||||
.iter()
|
||||
.map(|event| event.input.clone())
|
||||
.collect::<Vec<String>>()
|
||||
.join("\n")
|
||||
}
|
||||
|
||||
impl UnifiedExecSessionManager {
|
||||
@@ -507,7 +506,7 @@ mod tests {
|
||||
];
|
||||
|
||||
let rendered = render_stdin_events(&events);
|
||||
assert_eq!(rendered, "first\n> [no output]\nsecond\n> out");
|
||||
assert_eq!(rendered, "first\nsecond");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -516,8 +515,8 @@ mod tests {
|
||||
input: "abcde".to_string(),
|
||||
output: "output".to_string(),
|
||||
}]);
|
||||
let expected_prefix: String = rendered.chars().take(6).collect();
|
||||
let (truncated, original_len) = truncate_output_to_tokens(&rendered, 6);
|
||||
let expected_prefix: String = rendered.chars().take(5).collect();
|
||||
let (truncated, original_len) = truncate_output_to_tokens(&rendered, 5);
|
||||
|
||||
assert_eq!(truncated, expected_prefix);
|
||||
assert_eq!(original_len, Some(rendered.chars().count()));
|
||||
|
||||
Reference in New Issue
Block a user