From fb086a706f97b57f03ffa07ea686b941593b2985 Mon Sep 17 00:00:00 2001 From: oabrivard Date: Thu, 26 Mar 2026 18:58:39 +0100 Subject: [PATCH] feat: rename fallback category "Autre" to "Divers" Co-Authored-By: Claude Opus 4.6 (1M context) --- backend/src/services/llm/mock.rs | 2 +- backend/src/services/prompts.rs | 6 +++--- backend/src/services/synthesis.rs | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/backend/src/services/llm/mock.rs b/backend/src/services/llm/mock.rs index 1f03ae6..2906691 100644 --- a/backend/src/services/llm/mock.rs +++ b/backend/src/services/llm/mock.rs @@ -15,7 +15,7 @@ pub struct MockLlmProvider { impl MockLlmProvider { pub fn new() -> Self { Self { - default_category: "Autre".to_string(), + default_category: "Divers".to_string(), search_urls: Vec::new(), } } diff --git a/backend/src/services/prompts.rs b/backend/src/services/prompts.rs index a3e3ea8..930ebca 100644 --- a/backend/src/services/prompts.rs +++ b/backend/src/services/prompts.rs @@ -349,18 +349,18 @@ mod tests { let (sys, user) = build_article_classify_prompt( "GPT-5 Released", "OpenAI released GPT-5 today", - &["AI News".into(), "Autre".into()], + &["AI News".into(), "Divers".into()], 3, ); assert!(user.contains("GPT-5 Released")); assert!(user.contains("AI News")); - assert!(user.contains("Autre")); + assert!(user.contains("Divers")); assert!(sys.contains("classer")); } #[test] fn article_classify_prompt_handles_empty_title() { - let (_, user) = build_article_classify_prompt("", "Some content", &["Tech".into(), "Autre".into()], 3); + let (_, user) = build_article_classify_prompt("", "Some content", &["Tech".into(), "Divers".into()], 3); assert!(user.contains("(pas de titre)")); } diff --git a/backend/src/services/synthesis.rs b/backend/src/services/synthesis.rs index b09aa65..b001ad3 100644 --- a/backend/src/services/synthesis.rs +++ b/backend/src/services/synthesis.rs @@ -250,7 +250,7 @@ pub async fn run_generation_inner( settings.categories.clone() }; let mut classification_categories = user_categories.clone(); - classification_categories.push("Autre".to_string()); + classification_categories.push("Divers".to_string()); emit_progress(tx, "sources", "Chargement des sources...", 10); let sources = db::sources::list_for_user(&state.pool, user_id).await?; @@ -882,7 +882,7 @@ pub async fn run_generation_inner( } if let Some(autre_items) = article_scraped.get("category_autre") { if !autre_items.is_empty() { - final_sections.push(NewsSection { title: "Autre".to_string(), items: autre_items.clone() }); + final_sections.push(NewsSection { title: "Divers".to_string(), items: autre_items.clone() }); } } @@ -1108,10 +1108,10 @@ fn assign_category( ) -> Option<(String, String, String, String)> { let llm_title = llm_response.get("title").and_then(|t| t.as_str()).unwrap_or(page_title).to_string(); let llm_summary = llm_response.get("summary").and_then(|s| s.as_str()).unwrap_or("").to_string(); - let mut llm_category = llm_response.get("category").and_then(|c| c.as_str()).unwrap_or("Autre").to_string(); + let mut llm_category = llm_response.get("category").and_then(|c| c.as_str()).unwrap_or("Divers").to_string(); if !classification_categories.iter().any(|c| c.to_lowercase() == llm_category.to_lowercase()) { - llm_category = "Autre".to_string(); + llm_category = "Divers".to_string(); } let cat_key = if llm_category.to_lowercase() == "autre" { @@ -1124,11 +1124,11 @@ fn assign_category( let cat_filled = filled_counts.get(&llm_category).copied().unwrap_or(0); if cat_filled >= max_items_per_category && llm_category.to_lowercase() != "autre" { - let autre_filled = filled_counts.get("Autre").copied().unwrap_or(0); + let autre_filled = filled_counts.get("Divers").copied().unwrap_or(0); if autre_filled >= max_items_per_category { return None; } - Some(("category_autre".to_string(), "Autre".to_string(), llm_title, llm_summary)) + Some(("category_autre".to_string(), "Divers".to_string(), llm_title, llm_summary)) } else { Some((cat_key, llm_category, llm_title, llm_summary)) }