Function: getVideoJobStatus()
function getVideoJobStatus<TAdapter>(options): Promise<VideoJobStatusResult>;
정의 위치: packages/ai/src/activities/generateVideo/index.ts:911
Experimental
비디오 작업 상태를 가져옵니다. 현재 상태, 진행률 및 사용 가능한 경우 URL을 반환합니다.
이 함수는 상태 확인과 URL 조회를 결합합니다. 작업이 완료되면 비디오 URL을 자동으로 가져와 포함합니다.
또한 비스트리밍 generateVideo() 실행이 종료되는 지점입니다. 동일한
middleware와 threadId를 전달하면, 작업의 터미널 상태를 처음 확인한 폴링이
실행을 완료하거나(결과와 아티팩트를 기록함) 실패 처리합니다. 실행은 제출 시 도출한
것과 정확히 같은 adapter + jobId로 식별되므로 두 호출 사이에 전달할 다른 값은 없습니다.
비디오 생성은 실험적 기능이며 변경될 수 있습니다.
타입 매개변수
TAdapter
TAdapter extends VideoAdapter<string, any, any, any, any, any>
매개변수
options
VideoJobStatusOptions<TAdapter>
반환값
Promise<VideoJobStatusResult>
예제
작업 상태 확인
import { getVideoJobStatus } from '@tanstack/ai'
import { openaiVideo } from '@tanstack/ai-openai'
const result = await getVideoJobStatus({
adapter: openaiVideo('sora-2'),
jobId: 'job-123'
})
console.log('Status:', result.status)
console.log('Progress:', result.progress)
if (result.url) {
console.log('Video URL:', result.url)
}
영속화된 실행 하나를 제출하고 폴링
import { generateVideo, getVideoJobStatus } from '@tanstack/ai'
import { withGenerationPersistence } from '@tanstack/ai-persistence'
import { openaiVideo } from '@tanstack/ai-openai'
const adapter = openaiVideo('sora-2')
const middleware = [withGenerationPersistence(persistence)]
// Opens the run (status `running`, jobId recorded). Its run id is derived
// from the provider job, so nothing has to be stored to resume it.
const { jobId } = await generateVideo({
adapter,
prompt: 'A cat chasing a dog in a sunny park',
threadId,
middleware,
})
// Completes the SAME run once the job settles — this is what writes the
// video, its artifacts, and the terminal status. Works from a different
// request or process: the jobId is the only correlation.
const status = await getVideoJobStatus({
adapter,
jobId,
threadId,
middleware,
})