mirror of
https://github.com/openai/codex.git
synced 2026-02-01 22:47:52 +00:00
Inline request_user_input history cell
This commit is contained in:
@@ -727,11 +727,11 @@ impl RequestUserInputOverlay {
|
||||
},
|
||||
}));
|
||||
self.app_event_tx.send(AppEvent::InsertHistoryCell(Box::new(
|
||||
history_cell::new_request_user_input_result(
|
||||
self.request.questions.clone(),
|
||||
history_answers,
|
||||
history_cell::RequestUserInputResultCell {
|
||||
questions: self.request.questions.clone(),
|
||||
answers: history_answers,
|
||||
interrupted,
|
||||
),
|
||||
},
|
||||
)));
|
||||
}
|
||||
|
||||
@@ -795,11 +795,11 @@ impl RequestUserInputOverlay {
|
||||
},
|
||||
}));
|
||||
self.app_event_tx.send(AppEvent::InsertHistoryCell(Box::new(
|
||||
history_cell::new_request_user_input_result(
|
||||
self.request.questions.clone(),
|
||||
history_answers,
|
||||
false,
|
||||
),
|
||||
history_cell::RequestUserInputResultCell {
|
||||
questions: self.request.questions.clone(),
|
||||
answers: history_answers,
|
||||
interrupted: false,
|
||||
},
|
||||
)));
|
||||
if let Some(next) = self.queue.pop_front() {
|
||||
self.request = next;
|
||||
@@ -1856,8 +1856,7 @@ mod tests {
|
||||
panic!("expected UserInputAnswer");
|
||||
};
|
||||
assert!(response.interrupted, "expected interrupted flag");
|
||||
let answer = response.answers.get("q1").expect("answer missing");
|
||||
assert_eq!(answer.answers, vec!["Option 1".to_string()]);
|
||||
assert!(response.answers.is_empty(), "expected no committed answers");
|
||||
|
||||
let event = rx.try_recv().expect("expected history cell");
|
||||
assert!(matches!(event, AppEvent::InsertHistoryCell(_)));
|
||||
|
||||
@@ -1761,25 +1761,12 @@ pub(crate) fn new_error_event(message: String) -> PlainHistoryCell {
|
||||
PlainHistoryCell { lines }
|
||||
}
|
||||
|
||||
/// Build a history cell that renders request_user_input questions and answers.
|
||||
pub(crate) fn new_request_user_input_result(
|
||||
questions: Vec<RequestUserInputQuestion>,
|
||||
answers: HashMap<String, RequestUserInputAnswer>,
|
||||
interrupted: bool,
|
||||
) -> RequestUserInputResultCell {
|
||||
RequestUserInputResultCell {
|
||||
questions,
|
||||
answers,
|
||||
interrupted,
|
||||
}
|
||||
}
|
||||
|
||||
/// Renders a completed (or interrupted) request_user_input exchange in history.
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct RequestUserInputResultCell {
|
||||
questions: Vec<RequestUserInputQuestion>,
|
||||
answers: HashMap<String, RequestUserInputAnswer>,
|
||||
interrupted: bool,
|
||||
pub(crate) questions: Vec<RequestUserInputQuestion>,
|
||||
pub(crate) answers: HashMap<String, RequestUserInputAnswer>,
|
||||
pub(crate) interrupted: bool,
|
||||
}
|
||||
|
||||
impl HistoryCell for RequestUserInputResultCell {
|
||||
|
||||
Reference in New Issue
Block a user