mirror of
https://github.com/openai/codex.git
synced 2026-04-30 09:26:44 +00:00
### 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
25 lines
914 B
Rust
25 lines
914 B
Rust
use codex_protocol::models::WebSearchAction;
|
|
|
|
pub fn web_search_action_detail(action: &WebSearchAction) -> String {
|
|
match action {
|
|
WebSearchAction::Search { query } => query.clone().unwrap_or_default(),
|
|
WebSearchAction::OpenPage { url } => url.clone().unwrap_or_default(),
|
|
WebSearchAction::FindInPage { url, pattern } => match (pattern, url) {
|
|
(Some(pattern), Some(url)) => format!("'{pattern}' in {url}"),
|
|
(Some(pattern), None) => format!("'{pattern}'"),
|
|
(None, Some(url)) => url.clone(),
|
|
(None, None) => String::new(),
|
|
},
|
|
WebSearchAction::Other => String::new(),
|
|
}
|
|
}
|
|
|
|
pub fn web_search_detail(action: Option<&WebSearchAction>, query: &str) -> String {
|
|
let detail = action.map(web_search_action_detail).unwrap_or_default();
|
|
if detail.is_empty() {
|
|
query.to_string()
|
|
} else {
|
|
detail
|
|
}
|
|
}
|