Detail bar shows real percent + tone once progress > 0
With milestone-backed progress the number is truthful, so replace the indeterminate 'working' bar with a determinate one labeled 'Summarizing <tone>… N%' (indeterminate spinner only while waiting for the first token).
This commit is contained in:
parent
61f2124b1c
commit
f258470a6a
1 changed files with 34 additions and 13 deletions
|
|
@ -777,11 +777,15 @@ fun DetailScreen(state: DesktopState) {
|
|||
}
|
||||
val sJob = detail.jobs.firstOrNull { it.jobType == "summarize" }
|
||||
sJob?.takeIf { it.status == "running" || it.status == "queued" }?.let {
|
||||
// Honest milestone progress: the engine counts completed
|
||||
// contract units (JSON keys/items finished), so the number
|
||||
// means real work done — a determinate bar is truthful now.
|
||||
val toneWord = sJob.tone?.lowercase()?.replace(",", "")
|
||||
?.takeIf { it.isNotBlank() && it != "neutral" }
|
||||
val label = when {
|
||||
// Streaming summarize shows elapsed time, not the backend
|
||||
// number: it pins at 99% the moment tokens start.
|
||||
it.status == "running" && it.progress != null ->
|
||||
"Summarizing… working" +
|
||||
it.status == "running" && it.progress != null && it.progress > 0 ->
|
||||
"Summarizing" + (toneWord?.let { t -> " $t" } ?: "") +
|
||||
"… ${it.progress}%" +
|
||||
DesktopState.waitSuffix(it.startedAt, System.currentTimeMillis())
|
||||
it.status == "running" -> "Summarizing… 0% waiting for model" +
|
||||
DesktopState.waitSuffix(it.startedAt, System.currentTimeMillis())
|
||||
|
|
@ -792,11 +796,18 @@ fun DetailScreen(state: DesktopState) {
|
|||
color = MaterialTheme.colorScheme.primary)
|
||||
if (it.status == "running") {
|
||||
Spacer(Modifier.height(4.dp))
|
||||
if (it.progress != null && it.progress > 0) {
|
||||
LinearProgressIndicator(
|
||||
progress = { it.progress / 100f },
|
||||
modifier = Modifier.fillMaxWidth().height(4.dp),
|
||||
)
|
||||
} else {
|
||||
LinearProgressIndicator(
|
||||
modifier = Modifier.fillMaxWidth().height(4.dp),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
// Rescue-swap note: the engine succeeded but had to switch
|
||||
// summarizers mid-job. Tell the user in plain words, not the raw
|
||||
// provider ids.
|
||||
|
|
@ -989,23 +1000,33 @@ fun DetailScreen(state: DesktopState) {
|
|||
val sStatus = sJob?.status
|
||||
val sProg = sJob?.progress
|
||||
val sAttempt = sJob?.attempt ?: 0
|
||||
// Bar stays indeterminate while running: backend summarize
|
||||
// progress pins at 99 as soon as tokens start, so a
|
||||
// determinate bar would freeze near-full for minutes.
|
||||
// Determinate bar once real units complete: the engine
|
||||
// counts finished JSON contract units, so the percent
|
||||
// means work done, not vibes. Indeterminate only while
|
||||
// queued or pre-first-token.
|
||||
if (sProg != null && sProg > 0) {
|
||||
LinearProgressIndicator(progress = { sProg / 100f },
|
||||
modifier = Modifier.fillMaxWidth())
|
||||
} else {
|
||||
LinearProgressIndicator(modifier = Modifier.fillMaxWidth())
|
||||
}
|
||||
Text(buildString {
|
||||
append(when {
|
||||
sStatus == "queued" -> "Queued…" +
|
||||
DesktopState.waitSuffix(sJob?.createdAt,
|
||||
System.currentTimeMillis())
|
||||
sProg != null && sProg > 0 -> "Summarizing… working" +
|
||||
sProg != null && sProg > 0 ->
|
||||
"Summarizing" + (sJob?.tone?.lowercase()
|
||||
?.replace(",", "")
|
||||
?.takeIf { it.isNotBlank() && it != "neutral" }
|
||||
?.let { " $it" } ?: "") +
|
||||
"… $sProg%" +
|
||||
DesktopState.waitSuffix(sJob?.startedAt,
|
||||
System.currentTimeMillis())
|
||||
else -> "Summarizing… 0% waiting for model" +
|
||||
DesktopState.waitSuffix(sJob?.startedAt,
|
||||
System.currentTimeMillis())
|
||||
})
|
||||
sumTone?.let { append(" · $it") }
|
||||
if (sAttempt > 0)
|
||||
append(" (attempt $sAttempt/${sJob?.maxAttempts})")
|
||||
}, style = MaterialTheme.typography.bodySmall,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue