mirror of
https://github.com/caty21/forex-dashboard.git
synced 2026-07-27 20:37:45 +00:00
fix: faux positif Discours BC ZeroHedge + timestamp devant le journal
- newsfeed.ts: pré-filtre macro obligatoire avant applyRules pour ZeroHedge
→ articles non-financiers (social, politique) rejetés même si un prénom de
gouverneur (ex: Bailey) apparaît dans le body
- NewsTab: timestamp (il y a Xh) déplacé en première position avant le nom du
journal sur la ligne de métadonnées; bouton Analyse reste avec le titre
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+9
-10
@@ -333,7 +333,9 @@ function NewsCard({ item, secondary = false }: { item: NewsItem; secondary?: boo
|
||||
return (
|
||||
<div className={`rounded-xl border ${borderCls} ${bgCls} overflow-hidden ${isPriority ? "ring-1 ring-offset-0 ring-amber-500/20" : ""}`}>
|
||||
<div className="p-3">
|
||||
{/* Heure · Source · Catégorie · Prioritaire */}
|
||||
<div className="flex items-center gap-2 mb-1.5 flex-wrap">
|
||||
<span className="text-[9px] text-white whitespace-nowrap shrink-0">{formatRelativeTime(item.publishedAt)}</span>
|
||||
<span className={`text-[9px] font-semibold px-2 py-0.5 rounded-full ${SOURCE_COLORS[item.source] ?? "bg-slate-700/40 text-slate-400"}`}>
|
||||
{item.source}
|
||||
</span>
|
||||
@@ -348,17 +350,14 @@ function NewsCard({ item, secondary = false }: { item: NewsItem; secondary?: boo
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Heure + Analyse + Titre */}
|
||||
{/* Analyse + Titre */}
|
||||
<div className="flex items-start gap-2 mb-1.5">
|
||||
<div className="flex items-center gap-1 shrink-0 mt-0.5">
|
||||
<span className="text-[9px] text-white whitespace-nowrap">{formatRelativeTime(item.publishedAt)}</span>
|
||||
{!secondary && (
|
||||
<button onClick={() => setExpanded(e => !e)}
|
||||
className="text-[9px] text-slate-400 hover:text-white px-1.5 py-0.5 rounded-full border border-slate-600/50 transition-colors whitespace-nowrap">
|
||||
{expanded ? "▲" : "▼ Analyse"}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
{!secondary && (
|
||||
<button onClick={() => setExpanded(e => !e)}
|
||||
className="text-[9px] text-slate-400 hover:text-white px-1.5 py-0.5 rounded-full border border-slate-600/50 transition-colors whitespace-nowrap shrink-0 mt-0.5">
|
||||
{expanded ? "▲" : "▼ Analyse"}
|
||||
</button>
|
||||
)}
|
||||
<a href={item.url} target="_blank" rel="noopener noreferrer"
|
||||
className="group flex items-start gap-1 flex-1 min-w-0">
|
||||
<span className={`text-[12px] leading-snug font-medium group-hover:text-white transition-colors ${secondary ? "text-slate-400" : "text-slate-200"}`}>
|
||||
|
||||
@@ -788,6 +788,12 @@ async function fetchZeroHedgeNews(): Promise<NewsItem[]> {
|
||||
const summary = plainText.slice(0, 300);
|
||||
const analysisText = plainText.slice(0, 800);
|
||||
|
||||
// Pré-filtre macro : ZeroHedge couvre de nombreux sujets non-financiers.
|
||||
// On exige qu'un mot-clé macro explicite soit présent AVANT d'appliquer les
|
||||
// règles de noms de gouverneurs (évite "Bailey" dans un article social UK).
|
||||
const MACRO_CONTEXT = /\b(rate|rates|dollar|euro|pound|yen|franc|currency|currencies|forex|fx\b|economy|economic|gdp|inflation|recession|central bank|fed\b|ecb\b|boe\b|boj\b|boc\b|rba\b|rbnz\b|snb\b|fomc|treasury|bond|yield|fiscal|monetary|tariff|trade war|deficit|debt|interest rate|rate cut|rate hike|basis point)\b/i;
|
||||
if (!MACRO_CONTEXT.test(`${title} ${analysisText}`)) continue;
|
||||
|
||||
// Filtre de pertinence forex : garder seulement si une règle matche
|
||||
const { impacts, categories } = applyRules(`${title} ${analysisText}`);
|
||||
if (impacts.length === 0 && categories.length === 0) continue;
|
||||
|
||||
Reference in New Issue
Block a user