mirror of
https://github.com/openai/codex.git
synced 2026-10-30 19:18:49 +00:00
Merge f4400df0f8 into sapling-pr-archive-bolinfest
This commit is contained in:
@@ -240,8 +240,7 @@ impl ChatWidget<'_> {
|
||||
self.request_redraw()?;
|
||||
}
|
||||
EventMsg::Error { message } => {
|
||||
self.conversation_history
|
||||
.add_background_event(format!("Error: {message}"));
|
||||
self.conversation_history.add_error(message);
|
||||
self.bottom_pane.set_task_running(false)?;
|
||||
}
|
||||
EventMsg::ExecApprovalRequest {
|
||||
|
||||
@@ -174,6 +174,10 @@ impl ConversationHistoryWidget {
|
||||
self.add_to_history(HistoryCell::new_background_event(message));
|
||||
}
|
||||
|
||||
pub fn add_error(&mut self, message: String) {
|
||||
self.add_to_history(HistoryCell::new_error_event(message));
|
||||
}
|
||||
|
||||
/// Add a pending patch entry (before user approval).
|
||||
pub fn add_patch_event(
|
||||
&mut self,
|
||||
|
||||
@@ -69,6 +69,9 @@ pub(crate) enum HistoryCell {
|
||||
/// Background event
|
||||
BackgroundEvent { lines: Vec<Line<'static>> },
|
||||
|
||||
/// Error event from the backend.
|
||||
ErrorEvent { lines: Vec<Line<'static>> },
|
||||
|
||||
/// Info describing the newly‑initialized session.
|
||||
SessionInfo { lines: Vec<Line<'static>> },
|
||||
|
||||
@@ -245,6 +248,12 @@ impl HistoryCell {
|
||||
HistoryCell::BackgroundEvent { lines }
|
||||
}
|
||||
|
||||
pub(crate) fn new_error_event(message: String) -> Self {
|
||||
let lines: Vec<Line<'static>> =
|
||||
vec![vec!["ERROR".red().bold(), message.into()].into(), "".into()];
|
||||
HistoryCell::ErrorEvent { lines }
|
||||
}
|
||||
|
||||
pub(crate) fn new_session_info(config: &Config, model: String) -> Self {
|
||||
let mut lines: Vec<Line<'static>> = Vec::new();
|
||||
|
||||
@@ -332,6 +341,7 @@ impl HistoryCell {
|
||||
HistoryCell::UserPrompt { lines, .. }
|
||||
| HistoryCell::AgentMessage { lines, .. }
|
||||
| HistoryCell::BackgroundEvent { lines, .. }
|
||||
| HistoryCell::ErrorEvent { lines, .. }
|
||||
| HistoryCell::SessionInfo { lines, .. }
|
||||
| HistoryCell::ActiveExecCommand { lines, .. }
|
||||
| HistoryCell::CompletedExecCommand { lines, .. }
|
||||
|
||||
Reference in New Issue
Block a user