fix(ui): don't show misleading 0% AI bar on off-topic Trump posts

Most Trump posts aren't crypto-related, so the entry filter / AI marks them
relevant=false with ai_confidence=0 and no reasoning (never AI-scored). The
post card still rendered 'AI confidence 0%' with an empty progress bar, which
reads as 'AI looked and was 0% confident' rather than the truth: 'skipped as
not crypto-relevant'.

Added an aiScored guard (ai_confidence > 0 || ai_reasoning present):
- collapsed row: shows AI '—' instead of '0%' for unscored posts
- expanded detail: shows 'Not crypto-relevant — skipped AI scoring' instead
  of an empty 0% confidence bar

Scored posts (the ~80 with confidence>0 in test data, and all real signals
once live) are unchanged — full bar + reasoning shown.

tsc + build clean.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
k
2026-05-30 03:16:35 +08:00
parent aa6ede051e
commit fe88acb5a0
+28 -9
View File
@@ -102,6 +102,15 @@ const PostRow = memo(function PostRow({ post, selected, onClick }: PostRowProps)
onClick?.()
}
// Did this post actually get an AI score, or was it filtered as off-topic
// noise before any AI call? Trump posts mostly aren't crypto-related, so the
// entry filter / AI marks them relevant=false with confidence 0 and no
// reasoning. Showing "AI confidence 0%" + an empty bar for those is
// misleading — it reads as "AI looked and had zero confidence" when really
// "this was skipped as not crypto-relevant". Treat a post as AI-scored only
// when it has a real confidence or reasoning.
const aiScored = post.ai_confidence > 0 || !!post.ai_reasoning
return (
<div
className={`post-row ${selected ? 'selected' : ''}`}
@@ -157,7 +166,9 @@ const PostRow = memo(function PostRow({ post, selected, onClick }: PostRowProps)
</div>
<div className="row gap-s" style={{ fontSize: 11, color: 'var(--ink-3)' }}>
<span>AI</span>
<span className="mono" style={{ color: 'var(--ink-2)', fontWeight: 500 }}>{post.ai_confidence}%</span>
<span className="mono" style={{ color: 'var(--ink-2)', fontWeight: 500 }}>
{aiScored ? `${post.ai_confidence}%` : '—'}
</span>
</div>
</div>
</div>
@@ -168,16 +179,24 @@ const PostRow = memo(function PostRow({ post, selected, onClick }: PostRowProps)
className="post-row-detail"
onClick={e => e.stopPropagation()}
>
{/* AI confidence bar */}
<div>
<div className="ai-metric-head">
<span>AI confidence</span>
<strong>{post.ai_confidence}%</strong>
{/* AI confidence bar — only when the post was actually AI-scored.
Off-topic/noise posts (relevant=false, conf 0, no reasoning) show
a neutral note instead of a misleading empty 0% bar. */}
{aiScored ? (
<div>
<div className="ai-metric-head">
<span>AI confidence</span>
<strong>{post.ai_confidence}%</strong>
</div>
<div className="confidence-bar">
<div style={{ width: post.ai_confidence + '%' }} />
</div>
</div>
<div className="confidence-bar">
<div style={{ width: post.ai_confidence + '%' }} />
) : (
<div style={{ fontSize: 12, color: 'var(--ink-3)', padding: '4px 0' }}>
Not crypto-relevant skipped AI scoring.
</div>
</div>
)}
{/* Trade routing — target asset + expected move */}
{post.target_asset && (post.signal === 'buy' || post.signal === 'short') && (