import React from 'react'; import { Modal, Spin, Button } from 'antd'; import { LoadingOutlined, StopOutlined } from '@ant-design/icons'; interface SSEProgressModalProps { visible: boolean; progress: number; message: string; title?: string; showPercentage?: boolean; showIcon?: boolean; onCancel?: () => void; cancelButtonText?: string; } /** * 统一的SSE进度显示Modal组件 * 用于在Modal中显示AI生成进度,样式与SSELoadingOverlay保持一致 */ export const SSEProgressModal: React.FC = ({ visible, progress, message, title = 'AI生成中...', showPercentage = true, showIcon = true, onCancel, cancelButtonText = '取消任务', }) => { if (!visible) return null; return (
{/* 标题和图标 */} {showIcon && (
} />
{title}
)} {/* 进度条 */}
0 ? '0 0 10px rgba(24, 144, 255, 0.3)' : 'none' }} />
{/* 进度百分比 */} {showPercentage && (
{progress}%
)}
{/* 状态消息 */}
{message || '准备生成...'}
{/* 提示文字 */}
请勿关闭页面,生成过程需要一定时间
{/* 取消按钮 */} {onCancel && (
)}
); }; export default SSEProgressModal;