import { useSmoothedProgress } from "../../hooks/useSmoothedProgress";
type MessageStatus = "thinking" | "completed" | "failed" | string;
interface SmoothedProgressBarProps {
progress: number;
status: MessageStatus;
label?: string;
}
function mapMessageStatus(status: MessageStatus) {
if (status === "thinking") return "running" as const;
if (status === "completed") return "completed" as const;
if (status === "failed") return "failed" as const;
return "running" as const;
}
export function SmoothedProgressBar({ progress, status, label }: SmoothedProgressBarProps) {
const smoothed = useSmoothedProgress(progress, mapMessageStatus(status));
return (
<>
{label || "超分处理中..."}
{smoothed}%
>
);
}