Desktop: batch card shows overall % plus current file's stage and %
This commit is contained in:
parent
36a1d2374b
commit
751428cf3e
1 changed files with 33 additions and 15 deletions
|
|
@ -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())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue