use model context_length for token badge instead of hardcoded 1M

Parse context_length from /api/v1/models response (KaizenModel)
and look up the active model's value for the token counter badge.
Falls back to 1M only if the model has no context_length field.
This commit is contained in:
Bruno Deanoz 2026-06-22 00:28:16 +02:00
parent 3ca1d2c18e
commit fb90577884
2 changed files with 3 additions and 1 deletions

View file

@ -639,8 +639,9 @@ fun ChatScreen(
modifier = Modifier.weight(1f, fill = false),
)
if (usedTokens > 0 || messages.isNotEmpty()) {
val ctxLen = models.find { it.id == session.config?.model }?.context_length ?: 1_000_000
Spacer(Modifier.width(8.dp))
TokenBadge(used = usedTokens, contextLength = 1_000_000)
TokenBadge(used = usedTokens, contextLength = ctxLen)
}
}
}

View file

@ -47,6 +47,7 @@ data class KaizenModel(
val id: String,
val name: String? = null,
val provider: String? = null,
val context_length: Int? = null,
)
@Serializable private data class ModelsResponse(val models: List<KaizenModel> = emptyList())