Add HistoryContext and integrate it into relevant components for improved job management
This commit is contained in:
@@ -15,6 +15,7 @@ import { IconLabel } from '@/components/IconLabel'
|
||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip'
|
||||
import { ttsApi, jobApi } from '@/lib/api'
|
||||
import { useJobPolling } from '@/hooks/useJobPolling'
|
||||
import { useHistoryContext } from '@/contexts/HistoryContext'
|
||||
import { LoadingState } from '@/components/LoadingState'
|
||||
import { AudioPlayer } from '@/components/AudioPlayer'
|
||||
import { AudioInputSelector } from '@/components/AudioInputSelector'
|
||||
@@ -48,6 +49,7 @@ function VoiceCloneForm() {
|
||||
})
|
||||
|
||||
const { currentJob, isPolling, isCompleted, startPolling, elapsedTime } = useJobPolling()
|
||||
const { refresh } = useHistoryContext()
|
||||
|
||||
const {
|
||||
register,
|
||||
@@ -93,6 +95,9 @@ function VoiceCloneForm() {
|
||||
})
|
||||
toast.success('任务已创建')
|
||||
startPolling(result.job_id)
|
||||
try {
|
||||
await refresh()
|
||||
} catch {}
|
||||
} catch (error) {
|
||||
toast.error('创建任务失败')
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user