fix error banner sticky, token badge always visible
- loadError auto-clears after 4s for unlock failures - loadError reset on every conversation switch (was sticky) - Token badge always shown (was hidden when usedTokens == 0, making it invisible for all loaded chats) Note: locked chat "Authentifizierungsfehler" happens because POST /api/v1/auth/unlock is not deployed yet on the server. After git pull + docker build on prod, biometric unlock works.
This commit is contained in:
parent
77976ea974
commit
e697dd7e76
1 changed files with 5 additions and 4 deletions
|
|
@ -228,9 +228,11 @@ fun ChatScreen(
|
|||
fun unlockAndOpen(summary: ConversationSummary) {
|
||||
val cfg = session.config ?: return
|
||||
scope.launch {
|
||||
loadError = null
|
||||
val unlockToken = KaizenApi.requestUnlock(cfg.baseUrl, cfg.token)
|
||||
if (unlockToken == null) {
|
||||
loadError = context.getString(R.string.biometric_failed)
|
||||
scope.launch { kotlinx.coroutines.delay(4000); if (loadError == context.getString(R.string.biometric_failed)) loadError = null }
|
||||
return@launch
|
||||
}
|
||||
val stored = KaizenApi.fetchLockedMessages(cfg.baseUrl, cfg.token, summary.id, unlockToken)
|
||||
|
|
@ -288,6 +290,7 @@ fun ChatScreen(
|
|||
}
|
||||
viewingLockedChat = false
|
||||
usedTokens = 0
|
||||
loadError = null
|
||||
scope.launch {
|
||||
messages.clear()
|
||||
val cachedList = chat.messageRepo.getCached(summary.id)
|
||||
|
|
@ -673,10 +676,8 @@ fun ChatScreen(
|
|||
onClick = { haptics.tick(); showModelSheet = true },
|
||||
)
|
||||
Spacer(Modifier.weight(1f))
|
||||
if (usedTokens > 0) {
|
||||
val ctxLen = models.find { it.id == session.config?.model }?.context_length ?: 1_000_000
|
||||
TokenBadge(used = usedTokens, contextLength = ctxLen)
|
||||
}
|
||||
val ctxLen = models.find { it.id == session.config?.model }?.context_length ?: 1_000_000
|
||||
TokenBadge(used = usedTokens, contextLength = ctxLen)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue