fix
This commit is contained in:
parent
988b4d10c8
commit
398c853b80
|
|
@ -44,6 +44,7 @@ const AIVideoGenerator: React.FC<AIVideoGeneratorProps> = ({ 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<AIVideoGeneratorProps> = ({ 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<AIVideoGeneratorProps> = ({ className = '' }) =
|
|||
jobs={jobs}
|
||||
onPreview={openPreview}
|
||||
onDelete={deleteJob}
|
||||
onRetry={handleRetryJob}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -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<VideoJobListProps> = ({ jobs, onPreview, onDelete }) => {
|
||||
const VideoJobList: React.FC<VideoJobListProps> = ({ jobs, onPreview, onDelete, onRetry }) => {
|
||||
const [copiedJobId, setCopiedJobId] = useState<string | null>(null)
|
||||
|
||||
const formatTime = (timestamp: number): string => {
|
||||
|
|
@ -163,23 +164,33 @@ const VideoJobList: React.FC<VideoJobListProps> = ({ jobs, onPreview, onDelete }
|
|||
<div className="text-sm text-red-600 bg-red-50 p-3 rounded">
|
||||
<div className="flex items-center justify-between mb-2">
|
||||
<div className="font-medium">❌ 生成失败</div>
|
||||
<button
|
||||
onClick={() => copyErrorToClipboard(job)}
|
||||
className="flex items-center gap-1 px-2 py-1 bg-red-600 text-white text-xs rounded hover:bg-red-700 transition-colors"
|
||||
title="复制错误信息"
|
||||
>
|
||||
{copiedJobId === job.id ? (
|
||||
<>
|
||||
<Check size={12} />
|
||||
已复制
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Copy size={12} />
|
||||
复制
|
||||
</>
|
||||
)}
|
||||
</button>
|
||||
<div className="flex items-center gap-2">
|
||||
<button
|
||||
onClick={() => onRetry(job)}
|
||||
className="flex items-center gap-1 px-2 py-1 bg-blue-600 text-white text-xs rounded hover:bg-blue-700 transition-colors"
|
||||
title="重试任务"
|
||||
>
|
||||
<RotateCcw size={12} />
|
||||
重试
|
||||
</button>
|
||||
<button
|
||||
onClick={() => copyErrorToClipboard(job)}
|
||||
className="flex items-center gap-1 px-2 py-1 bg-red-600 text-white text-xs rounded hover:bg-red-700 transition-colors"
|
||||
title="复制错误信息"
|
||||
>
|
||||
{copiedJobId === job.id ? (
|
||||
<>
|
||||
<Check size={12} />
|
||||
已复制
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Copy size={12} />
|
||||
复制
|
||||
</>
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div className="text-xs text-red-700 mb-2">
|
||||
错误信息: {job.error}
|
||||
|
|
|
|||
Loading…
Reference in New Issue