// =========================================================
// FBIF 资讯订阅 · Reader pane (渲染层 / 阅读层)
// Renders the full article body (RSS content:encoded), plus
// AI summary, quality-score breakdown, translate toggle,
// and source attribution / 阅读原文.
// =========================================================
// score-breakdown popover content (AI multi-dim judgment, 仿 PRD §6)
const ScoreBreakdown = ({ entry }) => {
const b = entry.breakdown;
const meta = window.FBIF_DATA.TIER_META[entry.source_tier];
return (
信源等级
{meta.label.split('·')[1].trim()}
模型置信度
{Math.round(entry.confidence * 100)}%
模型只输出维度分,最终分与是否精选由确定性代码决定。MVP 阶段为 mock 数据。
);
};
const Popover = ({ open, onClose, children, anchorStyle }) => {
if (!open) return null;
return (
<>
{children}
>
);
};
const ActionBtn = ({ icon, label, active, activeColor = '#1456F0', onClick, title }) => {
const [hover, setHover] = React.useState(false);
return (
);
};
const AISummary = ({ entry }) => {
const [open, setOpen] = React.useState(true);
// derive 3 fake key points from summary + breakdown framing
const points = [
entry.summary,
entry.source_tier === 'T1' ? '来自品牌/机构官方一手发布,可直接引用。' : '权威行业媒体原创,建议结合一手源交叉验证。',
'建议跟进方向:' + (entry.tags[0] ? (window.FBIF_DATA.TAGS.find(t => t.id === entry.tags[0])?.name || '行业趋势') : '行业趋势') + ' 的后续动态。',
];
return (
setOpen(o => !o)} style={{
display: 'flex', alignItems: 'center', gap: 8, padding: '10px 14px', cursor: 'pointer',
background: '#F7F8FA', borderBottom: open ? '1px solid #EDEFF2' : 'none',
}}>
AI 摘要 · 关键要点
Beta
{open && (
{points.map((p, i) => (
-
{p}
))}
)}
);
};
const ReaderEmpty = () => {
useLucide();
return (
选择一条资讯开始阅读
从左侧时间线点击任意卡片,正文将在此渲染。精选流默认只展示高质量分内容。
);
};
const Reader = ({ entry, onOpenOriginal, onClose, embedded = false }) => {
useLucide();
const [showScore, setShowScore] = React.useState(false);
const [translated, setTranslated] = React.useState(false);
const scrollRef = React.useRef(null);
React.useEffect(() => { if (scrollRef.current) scrollRef.current.scrollTop = 0; setTranslated(false); }, [entry && entry.id]);
if (!entry) return
;
const meta = window.FBIF_DATA.TIER_META[entry.source_tier];
const hasScore = entry.quality_score != null && entry.breakdown;
const isCompiled = /^\[编译\]/.test(entry.title);
return (
{/* toolbar */}
{onClose && }
{entry.source_name.replace(/\s*Newsroom/, '')}
{!embedded && }
{!embedded && }
{!embedded &&
setTranslated(t => !t)} title="中英翻译(演示)" />}
{!embedded && }
{/* scroll body */}
{/* meta chips */}
{entry.is_featured && 精选}
{entry.tags.map(tid => {
const t = window.FBIF_DATA.TAGS.find(x => x.id === tid);
return t ? (
{t.name}
) : null;
})}
{translated && 已翻译为简体中文}
{/* title */}
{entry.title.replace(/^\[编译\]\s*/, '')}
{/* byline + score */}
{entry.source_name}
{fmtTime(entry.published_at)}
·
{timeAgo(entry.minsAgo)}
{hasScore &&
setShowScore(false)}>
}
{/* 推荐理由 */}
{entry.reason && (
)}
{/* AI summary */}
{entry.ai_ready !== false &&
}
{isCompiled && (
本文为英文报道的中文编译,关键数据请以原文为准。
)}
{/* body — rendered RSS content */}
{/* source footer */}
{entry.source_name}
{meta.desc}
);
};
Object.assign(window, { Reader, ScoreBreakdown, AISummary, Popover });