mirror of
https://github.com/openai/codex.git
synced 2026-04-24 22:54:54 +00:00
progress
This commit is contained in:
@@ -129,10 +129,21 @@ pub(crate) async fn stream_chat_completions(
|
||||
"content": output,
|
||||
}));
|
||||
}
|
||||
ResponseItem::Reasoning { .. }
|
||||
| ResponseItem::WebSearchCall { .. }
|
||||
| ResponseItem::Other => {
|
||||
// Omit these items from the conversation history.
|
||||
ResponseItem::Reasoning {
|
||||
id,
|
||||
summary,
|
||||
content,
|
||||
encrypted_content,
|
||||
} => {
|
||||
tracing::info!("reasoning item: {:?}", item);
|
||||
messages.push(json!({
|
||||
"role": "assistant",
|
||||
"content": null,
|
||||
"reasoning": content,
|
||||
}));
|
||||
}
|
||||
ResponseItem::WebSearchCall { .. } | ResponseItem::Other => {
|
||||
tracing::info!("omitting item from chat completions: {:?}", item);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -350,6 +361,8 @@ async fn process_chat_sse<S>(
|
||||
}
|
||||
|
||||
if let Some(reasoning) = maybe_text {
|
||||
// Accumulate so we can emit a terminal Reasoning item at end-of-turn.
|
||||
reasoning_text.push_str(&reasoning);
|
||||
let _ = tx_event
|
||||
.send(Ok(ResponseEvent::ReasoningContentDelta(reasoning)))
|
||||
.await;
|
||||
|
||||
@@ -883,6 +883,10 @@ impl Session {
|
||||
/// Build the full turn input by concatenating the current conversation
|
||||
/// history with additional items for this turn.
|
||||
pub fn turn_input_with_history(&self, extra: Vec<ResponseItem>) -> Vec<ResponseItem> {
|
||||
tracing::info!(
|
||||
"history: {:?}",
|
||||
self.state.lock_unchecked().history.contents()
|
||||
);
|
||||
[self.state.lock_unchecked().history.contents(), extra].concat()
|
||||
}
|
||||
|
||||
@@ -1409,6 +1413,7 @@ async fn run_task(
|
||||
sub_id: String,
|
||||
input: Vec<InputItem>,
|
||||
) {
|
||||
tracing::info!("running task with input: {:?}", input);
|
||||
if input.is_empty() {
|
||||
return;
|
||||
}
|
||||
@@ -1549,6 +1554,7 @@ async fn run_task(
|
||||
},
|
||||
None,
|
||||
) => {
|
||||
tracing::info!("reasoning item: {:?}", item);
|
||||
items_to_record_in_conversation_history.push(ResponseItem::Reasoning {
|
||||
id: id.clone(),
|
||||
summary: summary.clone(),
|
||||
|
||||
Reference in New Issue
Block a user