mirror of
https://github.com/openai/codex.git
synced 2026-11-25 15:24:26 +00:00
fix: handle all web_search actions and in progress invocations (#9960)
### Summary - Parse all `web_search` tool actions (`search`, `find_in_page`, `open_page`). - Previously we only parsed + displayed `search`, which made the TUI appear to pause when the other actions were being used. - Show in progress `web_search` calls as `Searching the web` - Previously we only showed completed tool calls <img width="308" height="149" alt="image" src="https://github.com/user-attachments/assets/90a4e8ff-b06a-48ff-a282-b57b31121845" /> ### Tests Added + updated tests, tested locally ### Follow ups Update VSCode extension to display these as well
This commit is contained in:
1 parent
998e88b12a
commit
86adf53235
18 files changed
+462
-62
No files matched your search
@@ -162,6 +162,7 @@ use crate::history_cell::AgentMessageCell;
|
||||
use crate::history_cell::HistoryCell;
|
||||
use crate::history_cell::McpToolCallCell;
|
||||
use crate::history_cell::PlainHistoryCell;
|
||||
use crate::history_cell::WebSearchCell;
|
||||
use crate::key_hint;
|
||||
use crate::key_hint::KeyBinding;
|
||||
use crate::markdown::append_markdown;
|
||||
@@ -1490,13 +1491,43 @@ impl ChatWidget {
|
||||
self.defer_or_handle(|q| q.push_mcp_end(ev), |s| s.handle_mcp_end_now(ev2));
|
||||
}
|
||||
|
||||
fn on_web_search_begin(&mut self, _ev: WebSearchBeginEvent) {
|
||||
fn on_web_search_begin(&mut self, ev: WebSearchBeginEvent) {
|
||||
self.flush_answer_stream_with_separator();
|
||||
self.flush_active_cell();
|
||||
self.active_cell = Some(Box::new(history_cell::new_active_web_search_call(
|
||||
ev.call_id,
|
||||
String::new(),
|
||||
self.config.animations,
|
||||
)));
|
||||
self.bump_active_cell_revision();
|
||||
self.request_redraw();
|
||||
}
|
||||
|
||||
fn on_web_search_end(&mut self, ev: WebSearchEndEvent) {
|
||||
self.flush_answer_stream_with_separator();
|
||||
self.add_to_history(history_cell::new_web_search_call(ev.query));
|
||||
let WebSearchEndEvent {
|
||||
call_id,
|
||||
query,
|
||||
action,
|
||||
} = ev;
|
||||
let mut handled = false;
|
||||
if let Some(cell) = self
|
||||
.active_cell
|
||||
.as_mut()
|
||||
.and_then(|cell| cell.as_any_mut().downcast_mut::<WebSearchCell>())
|
||||
&& cell.call_id() == call_id
|
||||
{
|
||||
cell.update(action.clone(), query.clone());
|
||||
cell.complete();
|
||||
self.bump_active_cell_revision();
|
||||
self.flush_active_cell();
|
||||
handled = true;
|
||||
}
|
||||
|
||||
if !handled {
|
||||
self.add_to_history(history_cell::new_web_search_call(call_id, query, action));
|
||||
}
|
||||
self.had_work_activity = true;
|
||||
}
|
||||
|
||||
fn on_collab_event(&mut self, cell: PlainHistoryCell) {
|
||||
|
||||
Reference in new issue
Block a user