"use client"; import { cn } from "@/lib/utils"; interface ConfidenceBadgeProps { confidence: number; showLabel?: boolean; className?: string; } export function ConfidenceBadge({ confidence, showLabel = true, className, }: ConfidenceBadgeProps) { const getLevel = (value: number) => { if (value > 0.9) return "high"; if (value >= 0.7) return "medium"; return "low"; }; const getLabel = (value: number) => { if (value > 0.9) return "高"; if (value >= 0.7) return "中"; return "低"; }; const level = getLevel(confidence); const label = getLabel(confidence); return ( {showLabel ? label : `${(confidence * 100).toFixed(0)}%`} ); } export default ConfidenceBadge;