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:
parent
3ca1d2c18e
commit
fb90577884
2 changed files with 3 additions and 1 deletions
|
|
@ -639,8 +639,9 @@ fun ChatScreen(
|
||||||
modifier = Modifier.weight(1f, fill = false),
|
modifier = Modifier.weight(1f, fill = false),
|
||||||
)
|
)
|
||||||
if (usedTokens > 0 || messages.isNotEmpty()) {
|
if (usedTokens > 0 || messages.isNotEmpty()) {
|
||||||
|
val ctxLen = models.find { it.id == session.config?.model }?.context_length ?: 1_000_000
|
||||||
Spacer(Modifier.width(8.dp))
|
Spacer(Modifier.width(8.dp))
|
||||||
TokenBadge(used = usedTokens, contextLength = 1_000_000)
|
TokenBadge(used = usedTokens, contextLength = ctxLen)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@ data class KaizenModel(
|
||||||
val id: String,
|
val id: String,
|
||||||
val name: String? = null,
|
val name: String? = null,
|
||||||
val provider: String? = null,
|
val provider: String? = null,
|
||||||
|
val context_length: Int? = null,
|
||||||
)
|
)
|
||||||
|
|
||||||
@Serializable private data class ModelsResponse(val models: List<KaizenModel> = emptyList())
|
@Serializable private data class ModelsResponse(val models: List<KaizenModel> = emptyList())
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue