use reqwest::Client;
pub struct ResearchTool {
client: Client,
}
impl ResearchTool {
pub fn new() -> Self {
Self {
client: Client::new(),
}
}
pub async fn web_search(&self, query: &str) -> Result<String, String> {
println!("Researching UX patterns/products for: {}", query);
Ok(format!("Results for '{}':\n- Result 1\n- Result 2", query))
}
pub async fn read_browser(&self, url: &str) -> Result<String, String> {
let res = self.client.get(url)
.send()
.await
.map_err(|e| e.to_string())?;
let text = res.text().await.map_err(|e| e.to_string())?;
Ok(text.chars().take(500).collect::<String>())
}
}