import { Card, Tag, Typography, theme } from 'antd'; import { WarningOutlined, HeartOutlined, LineChartOutlined, ExperimentOutlined, UserOutlined, } from '@ant-design/icons'; import type { DisplayHint } from '../../api/ai/chat'; const { Text } = Typography; const SEVERITY_COLOR: Record = { high: 'red', medium: 'orange', low: 'green', }; const RISK_LEVEL_COLOR: Record = { critical: '#cf1322', high: 'red', medium: 'orange', low: 'green', }; export default function RichMessage({ hints }: { hints: DisplayHint[] }) { const { token } = theme.useToken(); return (
{hints.map((hint, i) => ( ))}
); } function RichHint({ hint, token }: { hint: DisplayHint; token: { colorBorderSecondary: string; colorTextSecondary: string; colorPrimary: string } }) { switch (hint.type) { case 'insight_card': return ( {hint.title} } styles={{ body: { padding: '6px 12px' } }} >
{hint.items.map((item, j) => ( {item} ))}
); case 'risk_alert': return (
{hint.message}
); case 'lab_report_card': return ( 化验报告 {hint.report_date} } styles={{ body: { padding: '6px 12px', fontSize: 12 } }} > {hint.abnormal_count > 0 ? ( {hint.abnormal_count} 项异常 ) : ( 正常 )} ); case 'trend_chart': return ( 趋势分析({hint.period}) } styles={{ body: { padding: '6px 12px', fontSize: 12 } }} >
{hint.metrics.map((m, j) => ( {m} ))}
{hint.summary}
); case 'patient_profile': return ( 患者档案 } styles={{ body: { padding: '6px 12px', fontSize: 12 } }} > {hint.chronic_conditions.length > 0 && (
{hint.chronic_conditions.map((c, j) => ( {c} ))}
)} {hint.medication_count > 0 && ( 当前用药 {hint.medication_count} 种 )}
); case 'vital_card': return ( 体征数据 } styles={{ body: { padding: '6px 12px', fontSize: 12 } }} >
{hint.values.slice(-5).map(([date, val], j) => ( {date.slice(5)}:{' '} {val} {hint.unit} ))}
); case 'action_confirm': return ( {hint.summary} ); case 'text': default: return null; } }