diff --git a/src/components/AIVideoGenerator.tsx b/src/components/AIVideoGenerator.tsx index 45390a3..f955196 100644 --- a/src/components/AIVideoGenerator.tsx +++ b/src/components/AIVideoGenerator.tsx @@ -44,6 +44,7 @@ const AIVideoGenerator: React.FC = ({ className = '' }) = const generateSingleVideo = useAIVideoStore(state => state.generateSingleVideo) const batchGenerateVideos = useAIVideoStore(state => state.batchGenerateVideos) const clearCompletedJobs = useAIVideoStore(state => state.clearCompletedJobs) + const removeJob = useAIVideoStore(state => state.removeJob) // Initialize settings React.useEffect(() => { @@ -72,8 +73,21 @@ const AIVideoGenerator: React.FC = ({ className = '' }) = // Delete job function const deleteJob = (jobId: string) => { - console.log('Delete job:', jobId) - // This would be implemented in the store + removeJob(jobId) + } + + // Retry job function + const handleRetryJob = async (job: any) => { + try { + if (job.type === 'single') { + await generateSingleVideo(job.request) + } else if (job.type === 'batch') { + await batchGenerateVideos(job.request) + } + } catch (error) { + console.error('Retry failed:', error) + alert(`重试失败: ${error instanceof Error ? error.message : '未知错误'}`) + } } // Handle generation @@ -189,6 +203,7 @@ const AIVideoGenerator: React.FC = ({ className = '' }) = jobs={jobs} onPreview={openPreview} onDelete={deleteJob} + onRetry={handleRetryJob} /> diff --git a/src/components/ai-video/VideoJobList.tsx b/src/components/ai-video/VideoJobList.tsx index 02597ed..56d85ce 100644 --- a/src/components/ai-video/VideoJobList.tsx +++ b/src/components/ai-video/VideoJobList.tsx @@ -1,5 +1,5 @@ import React, { useState } from 'react' -import { Play, Trash2, Copy, Check } from 'lucide-react' +import { Play, Trash2, Copy, Check, RotateCcw } from 'lucide-react' interface VideoJob { id: string @@ -19,9 +19,10 @@ interface VideoJobListProps { jobs: VideoJob[] onPreview: (job: VideoJob) => void onDelete: (jobId: string) => void + onRetry: (job: VideoJob) => void } -const VideoJobList: React.FC = ({ jobs, onPreview, onDelete }) => { +const VideoJobList: React.FC = ({ jobs, onPreview, onDelete, onRetry }) => { const [copiedJobId, setCopiedJobId] = useState(null) const formatTime = (timestamp: number): string => { @@ -163,23 +164,33 @@ const VideoJobList: React.FC = ({ jobs, onPreview, onDelete }
❌ 生成失败
- +
+ + +
错误信息: {job.error}