Add the ability to interrupt and provide feedback to the model (#2381)
This commit is contained in:
@@ -26,6 +26,7 @@ use codex_core::protocol::PatchApplyBeginEvent;
|
|||||||
use codex_core::protocol::StreamErrorEvent;
|
use codex_core::protocol::StreamErrorEvent;
|
||||||
use codex_core::protocol::TaskCompleteEvent;
|
use codex_core::protocol::TaskCompleteEvent;
|
||||||
use codex_core::protocol::TokenUsage;
|
use codex_core::protocol::TokenUsage;
|
||||||
|
use codex_core::protocol::TurnAbortReason;
|
||||||
use codex_core::protocol::TurnDiffEvent;
|
use codex_core::protocol::TurnDiffEvent;
|
||||||
use codex_protocol::parse_command::ParsedCommand;
|
use codex_protocol::parse_command::ParsedCommand;
|
||||||
use crossterm::event::KeyEvent;
|
use crossterm::event::KeyEvent;
|
||||||
@@ -820,7 +821,14 @@ impl ChatWidget {
|
|||||||
EventMsg::TaskComplete(TaskCompleteEvent { .. }) => self.on_task_complete(),
|
EventMsg::TaskComplete(TaskCompleteEvent { .. }) => self.on_task_complete(),
|
||||||
EventMsg::TokenCount(token_usage) => self.on_token_count(token_usage),
|
EventMsg::TokenCount(token_usage) => self.on_token_count(token_usage),
|
||||||
EventMsg::Error(ErrorEvent { message }) => self.on_error(message),
|
EventMsg::Error(ErrorEvent { message }) => self.on_error(message),
|
||||||
EventMsg::TurnAborted(_) => self.on_error("Turn interrupted".to_owned()),
|
EventMsg::TurnAborted(ev) => match ev.reason {
|
||||||
|
TurnAbortReason::Interrupted => {
|
||||||
|
self.on_error("Tell the model what to do differently".to_owned())
|
||||||
|
}
|
||||||
|
TurnAbortReason::Replaced => {
|
||||||
|
self.on_error("Turn aborted: replaced by a new task".to_owned())
|
||||||
|
}
|
||||||
|
},
|
||||||
EventMsg::PlanUpdate(update) => self.on_plan_update(update),
|
EventMsg::PlanUpdate(update) => self.on_plan_update(update),
|
||||||
EventMsg::ExecApprovalRequest(ev) => self.on_exec_approval_request(id, ev),
|
EventMsg::ExecApprovalRequest(ev) => self.on_exec_approval_request(id, ev),
|
||||||
EventMsg::ApplyPatchApprovalRequest(ev) => self.on_apply_patch_approval_request(id, ev),
|
EventMsg::ApplyPatchApprovalRequest(ev) => self.on_apply_patch_approval_request(id, ev),
|
||||||
|
|||||||
@@ -74,6 +74,17 @@ static COMMAND_SELECT_OPTIONS: LazyLock<Vec<SelectOption>> = LazyLock::new(|| {
|
|||||||
key: KeyCode::Char('n'),
|
key: KeyCode::Char('n'),
|
||||||
decision: ReviewDecision::Denied,
|
decision: ReviewDecision::Denied,
|
||||||
},
|
},
|
||||||
|
SelectOption {
|
||||||
|
label: Line::from(vec![
|
||||||
|
"No, ".into(),
|
||||||
|
"provide ".into(),
|
||||||
|
"f".underlined(),
|
||||||
|
"eedback".into(),
|
||||||
|
]),
|
||||||
|
description: "Do not run the command; provide feedback",
|
||||||
|
key: KeyCode::Char('f'),
|
||||||
|
decision: ReviewDecision::Abort,
|
||||||
|
},
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -91,6 +102,17 @@ static PATCH_SELECT_OPTIONS: LazyLock<Vec<SelectOption>> = LazyLock::new(|| {
|
|||||||
key: KeyCode::Char('n'),
|
key: KeyCode::Char('n'),
|
||||||
decision: ReviewDecision::Denied,
|
decision: ReviewDecision::Denied,
|
||||||
},
|
},
|
||||||
|
SelectOption {
|
||||||
|
label: Line::from(vec![
|
||||||
|
"No, ".into(),
|
||||||
|
"provide ".into(),
|
||||||
|
"f".underlined(),
|
||||||
|
"eedback".into(),
|
||||||
|
]),
|
||||||
|
description: "Do not apply the changes; provide feedback",
|
||||||
|
key: KeyCode::Char('f'),
|
||||||
|
decision: ReviewDecision::Abort,
|
||||||
|
},
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user