use serde::{ Serialize, Deserialize };
use core::time::Duration;
#[ derive( Debug, Clone, Serialize, Deserialize ) ]
pub struct WebBrowsingConfig
{
pub user_agent : String,
pub max_page_size : usize,
pub follow_redirects : bool,
pub javascript_enabled : bool,
pub screenshot_enabled : bool,
pub timeout : Duration,
}
impl Default for WebBrowsingConfig
{
#[ inline ]
fn default() -> Self
{
Self
{
user_agent : "Mozilla/5.0 (compatible; OpenAI-Client/1.0)".to_string(),
max_page_size : 10 * 1024 * 1024, follow_redirects : true,
javascript_enabled : false, screenshot_enabled : false,
timeout : Duration::from_secs( 30 ),
}
}
}
#[ derive( Debug, Clone, Serialize, Deserialize ) ]
pub struct BrowsingResult
{
pub url : String,
pub title : String,
pub content : String,
pub links : Vec< String >,
pub images : Vec< String >,
#[ serde( skip_serializing_if = "Option::is_none" ) ]
pub screenshot : Option< Vec< u8 > >,
pub metadata : BrowsingMetadata,
}
#[ derive( Debug, Clone, Serialize, Deserialize ) ]
pub struct BrowsingMetadata
{
pub status_code : u16,
pub content_type : String,
pub content_length : usize,
pub load_time_ms : u64,
pub redirect_count : usize,
}