Detail: upload+transcribe now polls the WHOLE pipeline (transcribe AND summarize) before leaving the live-update loop — breaking on transcribe alone left 'Summarizing… 0%' on screen after the summary actually finished (seen live on 'Ali Tall buildings': engine succeeded at 13:38:52, screen kept the stale job snapshot until reopen). Also clears the busy label when no job is active instead of leaving the last one.

This commit is contained in:
avi 2026-09-18 09:10:45 -05:00
commit 54e1f90c22

View file

@ -1542,13 +1542,16 @@ class DesktopState(private val appDir: File = defaultAppDir()) {
d.busy = "Transcribing…" d.busy = "Transcribing…"
d.uploadProgress = null d.uploadProgress = null
_detail.value = d.copy() _detail.value = d.copy()
// Poll jobs until the transcribe step reaches a terminal state. // Poll jobs until the WHOLE pipeline is terminal. Breaking on
// transcribe alone froze the screen: the last d.jobs snapshot
// still showed summarize running at 0%, and nothing refreshed
// it (or the finished summary) until the file was reopened.
while (true) { while (true) {
delay(2000) delay(2000)
val jobs = runCatching { parseJobs(provider.fetchJobs(ref.key)) }.getOrNull() val jobs = runCatching { parseJobs(provider.fetchJobs(ref.key)) }.getOrNull()
.orEmpty() .orEmpty()
d.jobs = jobs d.jobs = jobs
jobLabel(jobs)?.let { d.busy = it } jobLabel(jobs)?.let { d.busy = it } ?: run { d.busy = null }
// Mirror live progress onto the library row (same as the // Mirror live progress onto the library row (same as the
// pump + reprocess paths) so leaving the detail screen // pump + reprocess paths) so leaving the detail screen
// doesn't make the job look dead. // doesn't make the job look dead.
@ -1556,7 +1559,8 @@ class DesktopState(private val appDir: File = defaultAppDir()) {
rescanStatuses() rescanStatuses()
_detail.value = d.copy() _detail.value = d.copy()
val t = jobs.firstOrNull { it.jobType == "transcribe" }?.status val t = jobs.firstOrNull { it.jobType == "transcribe" }?.status
if (t == null || t in TERMINAL) break val s = jobs.firstOrNull { it.jobType == "summarize" }?.status
if ((t == null || t in TERMINAL) && (s == null || s in TERMINAL)) break
} }
setLive(d.file.name, null) setLive(d.file.name, null)
rescanStatuses() rescanStatuses()