feat(ai-analysis): 在AI助手展示业务分析结果

This commit is contained in:
2026-07-08 22:22:19 +08:00
parent c724446bbd
commit 6d2999085e
7 changed files with 261 additions and 29 deletions

View File

@@ -0,0 +1,31 @@
import type { InsightCard as InsightCardData } from '@ftb/shared';
export function InsightCard({ insight }: { insight: InsightCardData }) {
return (
<section className="rounded-[28px] border border-white/60 bg-white/80 p-5 shadow-[0_18px_60px_rgba(15,23,42,0.08)] backdrop-blur-xl">
{insight.primaryValue && (
<div className="mb-3">
<div className="text-[44px] font-semibold leading-none tracking-normal text-[#0f172a]">
{insight.primaryValue.value}
{insight.primaryValue.unit ?? ''}
</div>
<div className="mt-2 text-[13px] text-[#64748b]">{insight.primaryValue.label}</div>
</div>
)}
<p className="text-[15px] leading-7 text-[#111827]">{insight.summary}</p>
{(insight.semanticConfidence !== 'high' || insight.dataConfidence !== 'sufficient') && (
<p className="mt-3 text-[12px] text-[#64748b]">
{confidenceLabel(insight.semanticConfidence)} · {dataLabel(insight.dataConfidence)}
</p>
)}
</section>
);
}
function confidenceLabel(value: InsightCardData['semanticConfidence']) {
return value === 'high' ? '高' : value === 'medium' ? '中' : '低';
}
function dataLabel(value: InsightCardData['dataConfidence']) {
return value === 'sufficient' ? '数据充分' : value === 'partial' ? '部分数据' : '数据不足';
}