diff --git a/app/src/main/kotlin/com/shonar/desktop/Screens.kt b/app/src/main/kotlin/com/shonar/desktop/Screens.kt index b4884d7..4b3e402 100644 --- a/app/src/main/kotlin/com/shonar/desktop/Screens.kt +++ b/app/src/main/kotlin/com/shonar/desktop/Screens.kt @@ -249,23 +249,41 @@ fun LibraryScreen(state: DesktopState) { Card(Modifier.fillMaxWidth()) { Column(Modifier.padding(10.dp), verticalArrangement = Arrangement.spacedBy(4.dp)) { - Text("Transcribing batch: ${batch.done + 1} of ${batch.total}" + - (running?.let { " — ${it.file.name}" } ?: ""), - style = MaterialTheme.typography.bodySmall) val fileFrac = running?.progress - if (fileFrac != null) { - // Overall = settled files + current file's fraction. - LinearProgressIndicator( - progress = { - ((batch.done + fileFrac) / batch.total) - .coerceIn(0f, 1f) - }, - modifier = Modifier.fillMaxWidth()) - } else { - LinearProgressIndicator( - progress = { (batch.done.toFloat() / batch.total) }, - modifier = Modifier.fillMaxWidth()) + // Overall % = settled files + current file's fraction. + val overall = if (fileFrac != null) + ((batch.done + fileFrac) / batch.total) else + (batch.done.toFloat() / batch.total) + Row(Modifier.fillMaxWidth(), + verticalAlignment = Alignment.CenterVertically) { + Text("Transcribing batch: ${batch.done + 1} of ${batch.total}", + style = MaterialTheme.typography.bodySmall, + modifier = Modifier.weight(1f)) + Text("${(overall * 100).toInt()}%", + style = MaterialTheme.typography.bodySmall, + color = MaterialTheme.colorScheme.primary) } + if (running != null) { + // Which file + which stage + its own percent, so + // movement is visible even between whole files. + val stage = running.statusNote?.lowercase() + val stageName = when { + stage?.startsWith("uploading") == true -> "uploading" + stage?.contains("loading") == true -> "loading model" + stage?.contains("transcribing") == true -> "transcribing" + stage?.contains("summarizing") == true -> "summarizing" + else -> "working" + } + val filePct = fileFrac?.let { " ${(it * 100).toInt()}%" } ?: "" + Text("${running.file.nameWithoutExtension} — $stageName$filePct", + style = MaterialTheme.typography.bodySmall, + color = MaterialTheme.colorScheme.onSurfaceVariant, + maxLines = 1, + overflow = TextOverflow.Ellipsis) + } + LinearProgressIndicator( + progress = { overall.coerceIn(0f, 1f) }, + modifier = Modifier.fillMaxWidth()) } } }