mirror of
https://github.com/openai/codex.git
synced 2026-11-01 19:33:35 +00:00
revive
This commit is contained in:
@@ -1005,6 +1005,7 @@ async fn run_task(sess: Arc<Session>, sub_id: String, input: Vec<InputItem>) {
|
||||
id,
|
||||
summary,
|
||||
encrypted_content,
|
||||
content,
|
||||
},
|
||||
None,
|
||||
) => {
|
||||
@@ -1012,6 +1013,7 @@ async fn run_task(sess: Arc<Session>, sub_id: String, input: Vec<InputItem>) {
|
||||
id: id.clone(),
|
||||
summary: summary.clone(),
|
||||
encrypted_content: encrypted_content.clone(),
|
||||
content: content.clone(),
|
||||
});
|
||||
}
|
||||
_ => {
|
||||
@@ -1272,12 +1274,12 @@ async fn handle_response_item(
|
||||
id: _,
|
||||
summary,
|
||||
content,
|
||||
encrypted_content: _,
|
||||
} => {
|
||||
for item in summary {
|
||||
let text = match item {
|
||||
ReasoningItemReasoningSummary::SummaryText { text } => text,
|
||||
};
|
||||
info!("Agent reasoning: {text}");
|
||||
let event = Event {
|
||||
id: sub_id.to_string(),
|
||||
msg: EventMsg::AgentReasoning(AgentReasoningEvent { text }),
|
||||
@@ -1288,7 +1290,6 @@ async fn handle_response_item(
|
||||
let text = match item {
|
||||
ReasoningItemContent::ReasoningText { text } => text,
|
||||
};
|
||||
info!("Agent reasoning content: {text}");
|
||||
let event = Event {
|
||||
id: sub_id.to_string(),
|
||||
msg: EventMsg::AgentReasoningContent(AgentReasoningContentEvent { text }),
|
||||
|
||||
@@ -308,7 +308,7 @@ pub enum EventMsg {
|
||||
|
||||
/// Agent reasoning delta event from agent.
|
||||
AgentReasoningDelta(AgentReasoningDeltaEvent),
|
||||
|
||||
|
||||
/// Raw chain-of-thought from agent.
|
||||
AgentReasoningContent(AgentReasoningContentEvent),
|
||||
|
||||
@@ -417,6 +417,7 @@ pub struct AgentReasoningContentEvent {
|
||||
pub text: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
pub struct AgentReasoningDeltaEvent {
|
||||
pub delta: String,
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ use codex_core::config::Config;
|
||||
use codex_core::plan_tool::UpdatePlanArgs;
|
||||
use codex_core::protocol::AgentMessageDeltaEvent;
|
||||
use codex_core::protocol::AgentMessageEvent;
|
||||
use codex_core::protocol::AgentReasoningContentEvent;
|
||||
use codex_core::protocol::AgentReasoningDeltaEvent;
|
||||
use codex_core::protocol::BackgroundEventEvent;
|
||||
use codex_core::protocol::ErrorEvent;
|
||||
@@ -204,6 +205,11 @@ impl EventProcessor for EventProcessorWithHumanOutput {
|
||||
#[allow(clippy::expect_used)]
|
||||
std::io::stdout().flush().expect("could not flush stdout");
|
||||
}
|
||||
EventMsg::AgentReasoningContent(AgentReasoningContentEvent { text }) => {
|
||||
print!("{text}");
|
||||
#[allow(clippy::expect_used)]
|
||||
std::io::stdout().flush().expect("could not flush stdout");
|
||||
}
|
||||
EventMsg::AgentMessage(AgentMessageEvent { message }) => {
|
||||
// if answer_started is false, this means we haven't received any
|
||||
// delta. Thus, we need to print the message as a new answer.
|
||||
|
||||
@@ -275,12 +275,8 @@ impl ChatWidget<'_> {
|
||||
self.request_redraw();
|
||||
}
|
||||
EventMsg::AgentReasoningContent(AgentReasoningContentEvent { text }) => {
|
||||
if !self.config.hide_agent_reasoning && self.config.show_reasoning_content {
|
||||
let text = format!("Full Reasoning Content: {text}");
|
||||
self.conversation_history
|
||||
.add_agent_reasoning(&self.config, text);
|
||||
self.request_redraw();
|
||||
}
|
||||
self.add_to_history(HistoryCell::new_agent_reasoning(&self.config, text));
|
||||
self.request_redraw();
|
||||
}
|
||||
EventMsg::TaskStarted => {
|
||||
self.bottom_pane.clear_ctrl_c_quit_hint();
|
||||
|
||||
Reference in New Issue
Block a user