Improve music activity reporting and preserve Comfy host fixes
This commit is contained in:
@@ -31,6 +31,7 @@ export interface JobEvent {
|
||||
}
|
||||
|
||||
export interface Job {
|
||||
musicActivity?: { checkedAt: number; running: boolean }
|
||||
id: string
|
||||
kind?: 'video' | 'edit' | 'music'
|
||||
promptId?: string
|
||||
@@ -192,6 +193,8 @@ export function jobSnapshot(job: Job) {
|
||||
return {
|
||||
jobId: job.id,
|
||||
kind: job.kind || 'video',
|
||||
engine: job.library?.engine,
|
||||
musicActivity: job.musicActivity,
|
||||
type: 'snapshot' as const,
|
||||
status: job.status,
|
||||
message: job.message,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createJob, emitJob, type Job } from '~/server/utils/jobs'
|
||||
import { extractAudio, fetchHistory, fetchHistoryAll, findHistoryAudio, freeComfyVram, purgeComfyArtifacts, queuePrompt } from '~/server/utils/comfy'
|
||||
import { comfyWsUrl } from '~/server/utils/comfy'
|
||||
import { comfyWsUrl, comfyFetch } from '~/server/utils/comfy'
|
||||
import { ensureComfyReady } from '~/server/utils/comfyLifecycle'
|
||||
import { downloadComfyAudio, saveTrack } from '~/server/utils/library'
|
||||
import { buildMusicWorkflow, musicFilenamePrefix, assertMusicEngineNodes } from '~/server/utils/musicWorkflow'
|
||||
@@ -231,6 +231,19 @@ function watchMusicJob(job: Job): Promise<void> {
|
||||
}
|
||||
|
||||
const pollHistory = async () => {
|
||||
if (settled || finishing) return
|
||||
if (job.promptId) {
|
||||
try {
|
||||
const response = await comfyFetch('/queue', { signal: AbortSignal.timeout(2500) })
|
||||
if (response.ok) {
|
||||
const queue = await response.json() as { queue_running?: unknown[][] }
|
||||
job.musicActivity = {
|
||||
checkedAt: Date.now(),
|
||||
running: Boolean(queue.queue_running?.some(row => row[1] === job.promptId))
|
||||
}
|
||||
}
|
||||
} catch { /* Keep the last confirmation timestamp so the UI can show stale checks. */ }
|
||||
}
|
||||
if (settled || finishing) return
|
||||
try {
|
||||
const history = await fetchHistoryAll()
|
||||
|
||||
@@ -43,7 +43,7 @@ export function inspectStudioJob(job: StudioJob) {
|
||||
createdAt: job.createdAt,
|
||||
updatedAt: job.updatedAt,
|
||||
status: job.status,
|
||||
kind: job.kind === 'edit' ? 'edit' as const : 'video' as const,
|
||||
kind: job.kind === 'music' ? 'music' as const : job.kind === 'edit' ? 'edit' as const : 'video' as const,
|
||||
name: job.name,
|
||||
prompt: job.prompt,
|
||||
shotCount: job.shotCount,
|
||||
|
||||
Reference in New Issue
Block a user