@ -386,6 +386,7 @@ pub async fn run_generation_inner(
url , title : "" , source_type : "personalized_source" ,
source_url : Some ( source_url ) , category : None , synthesis_id : None ,
status : "filtered_history" , scraped_ok : false ,
published_date : None ,
} ) ) ;
}
}
@ -429,6 +430,7 @@ pub async fn run_generation_inner(
url : & url , title : "" , source_type : "personalized_source" ,
source_url : Some ( & source_url ) , category : None , synthesis_id : None ,
status : "filtered_diversity" , scraped_ok : false ,
published_date : None ,
} ) ) ;
continue ;
}
@ -463,6 +465,7 @@ pub async fn run_generation_inner(
url : & final_url , title : & page_title , source_type : "personalized_source" ,
source_url : Some ( & source_url ) , category : None , synthesis_id : None ,
status : reason , scraped_ok : false ,
published_date : None ,
} ) ) ;
} else {
scraped_articles . push ( ( final_url , source_url , body_text , page_title ) ) ;
@ -534,6 +537,7 @@ pub async fn run_generation_inner(
url : & final_url , title : & page_title , source_type : "personalized_source" ,
source_url : Some ( & source_url ) , category : None , synthesis_id : None ,
status : "filtered_too_old" , scraped_ok : true ,
published_date : Some ( date_str ) ,
} ) ) ;
continue ;
}
@ -548,10 +552,12 @@ pub async fn run_generation_inner(
continue ;
} ;
let llm_date = class_response . get ( "date" ) . and_then ( | d | d . as_str ( ) ) . filter ( | s | ! s . is_empty ( ) ) . map ( | s | s . to_string ( ) ) ;
article_scraped . entry ( final_cat_key ) . or_default ( ) . push ( NewsItem {
title : llm_title ,
url : final_url . clone ( ) ,
summary : llm_summary ,
date : llm_date ,
} ) ;
* filled_counts . entry ( final_cat_name ) . or_insert ( 0 ) + = 1 ;
@ -607,6 +613,7 @@ pub async fn run_generation_inner(
url : & result . url , title : & result . title , source_type : "brave_search" ,
source_url : None , category : None , synthesis_id : None ,
status : reason , scraped_ok : false ,
published_date : None ,
} ) ) ;
continue ;
}
@ -663,6 +670,7 @@ pub async fn run_generation_inner(
url : & final_url , title : & page_title , source_type : "brave_search" ,
source_url : None , category : None , synthesis_id : None ,
status : reason , scraped_ok : false ,
published_date : None ,
} ) ) ;
} else {
scraped_articles . push ( ( final_url , body_text , page_title ) ) ;
@ -732,6 +740,7 @@ pub async fn run_generation_inner(
url : & final_url , title : & page_title , source_type : "brave_search" ,
source_url : None , category : None , synthesis_id : None ,
status : "filtered_too_old" , scraped_ok : true ,
published_date : Some ( date_str ) ,
} ) ) ;
continue ;
}
@ -746,10 +755,12 @@ pub async fn run_generation_inner(
continue ;
} ;
let llm_date = class_response . get ( "date" ) . and_then ( | d | d . as_str ( ) ) . filter ( | s | ! s . is_empty ( ) ) . map ( | s | s . to_string ( ) ) ;
article_scraped . entry ( final_cat_key ) . or_default ( ) . push ( NewsItem {
title : llm_title ,
url : final_url . clone ( ) ,
summary : llm_summary ,
date : llm_date ,
} ) ;
* filled_counts . entry ( final_cat_name ) . or_insert ( 0 ) + = 1 ;
@ -803,6 +814,7 @@ pub async fn run_generation_inner(
url : & item . url , title : & item . title , source_type : "web_search" ,
source_url : None , category : None , synthesis_id : None ,
status : reason , scraped_ok : false ,
published_date : None ,
} ) ) ;
continue ;
}
@ -828,6 +840,7 @@ pub async fn run_generation_inner(
url : & final_url , title : & item . title , source_type : "web_search" ,
source_url : None , category : None , synthesis_id : None ,
status : reason , scraped_ok : false ,
published_date : None ,
} ) ) ;
continue ;
}
@ -836,6 +849,7 @@ pub async fn run_generation_inner(
title : item . title ,
url : final_url ,
summary : item . summary ,
date : None ,
} ) ;
if let Some ( domain ) = extract_domain ( & item . url ) {
@ -891,6 +905,7 @@ pub async fn run_generation_inner(
source_url : if source_type = = "personalized_source" { url_source . get ( & item . url ) . map ( | s | s . as_str ( ) ) } else { None } ,
category : Some ( & section . title ) , synthesis_id : Some ( synthesis . id ) ,
status : "used" , scraped_ok : true ,
published_date : item . date . as_deref ( ) ,
} ) ) ;
}
}
@ -948,6 +963,7 @@ struct ArticleTrace<'a> {
synthesis_id : Option < Uuid > ,
status : & ' a str ,
scraped_ok : bool ,
published_date : Option < & ' a str > ,
}
/// Build an article history entry from trace parameters (no DB call).
@ -968,6 +984,7 @@ fn build_trace_entry(
status : trace . status . to_string ( ) ,
scraped_ok : trace . scraped_ok ,
job_id ,
published_date : trace . published_date . map ( | s | s . to_string ( ) ) ,
}
}