diff --git a/app/src/main/java/com/m57/hermescontrol/ui/chat/components/ContextDetailSheet.kt b/app/src/main/java/com/m57/hermescontrol/ui/chat/components/ContextDetailSheet.kt
index 50403b63..ca9d6140 100644
--- a/app/src/main/java/com/m57/hermescontrol/ui/chat/components/ContextDetailSheet.kt
+++ b/app/src/main/java/com/m57/hermescontrol/ui/chat/components/ContextDetailSheet.kt
@@ -51,12 +51,12 @@ fun ContextDetailSheet(
sheetState = sheetState,
) {
val full = fullTokens ?: 0L
- val used = usedTokens ?: breakdown.inputTokens
- val fraction = if (full > 0L) min(1f, used.toFloat() / full.toFloat()) else 0f
+ val fraction = if (full > 0L && usedTokens != null) min(1f, usedTokens.toFloat() / full.toFloat()) else 0f
val pct = (fraction * 100).toInt()
val statusColors = LocalHermesStatusColors.current
val barColor =
when {
+ usedTokens == null -> MaterialTheme.colorScheme.primary
pct >= 90 -> statusColors.error
pct >= 70 -> statusColors.warning
else -> MaterialTheme.colorScheme.primary
@@ -83,7 +83,7 @@ fun ContextDetailSheet(
verticalAlignment = Alignment.Bottom,
) {
Text(
- text = formatTokens(used),
+ text = if (usedTokens != null) formatTokens(usedTokens) else "—",
style = MaterialTheme.typography.headlineSmall,
fontWeight = FontWeight.Bold,
color = barColor,
@@ -115,7 +115,12 @@ fun ContextDetailSheet(
)
}
Text(
- text = "$pct% of context window used",
+ text =
+ if (usedTokens != null) {
+ "$pct% of context window used"
+ } else {
+ stringResource(R.string.context_window_usage_unavailable)
+ },
style = MaterialTheme.typography.labelMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
diff --git a/app/src/main/java/com/m57/hermescontrol/ui/chat/components/ContextUsageChip.kt b/app/src/main/java/com/m57/hermescontrol/ui/chat/components/ContextUsageChip.kt
index b9360a12..29039903 100644
--- a/app/src/main/java/com/m57/hermescontrol/ui/chat/components/ContextUsageChip.kt
+++ b/app/src/main/java/com/m57/hermescontrol/ui/chat/components/ContextUsageChip.kt
@@ -56,12 +56,12 @@ fun ContextUsageChip(
val full = fullTokens
if (full == null || full <= 0L) return
- val used = usedTokens ?: 0L
- val fraction = min(1f, used.toFloat() / full.toFloat())
+ val fraction = if (usedTokens != null) min(1f, usedTokens.toFloat() / full.toFloat()) else 0f
val pct = (fraction * 100).toInt()
val statusColors = LocalHermesStatusColors.current
val barColor =
when {
+ usedTokens == null -> MaterialTheme.colorScheme.primary
pct >= 90 -> statusColors.error
pct >= 70 -> statusColors.warning
else -> MaterialTheme.colorScheme.primary
@@ -90,7 +90,7 @@ fun ContextUsageChip(
Text(
text =
if (usedTokens != null) {
- "${formatTokens(used)} / ${formatTokens(full)} context"
+ "${formatTokens(usedTokens)} / ${formatTokens(full)} context"
} else {
"— / ${formatTokens(full)} context"
},
@@ -111,12 +111,14 @@ fun ContextUsageChip(
maxLines = 1,
)
}
- Text(
- text = "$pct%",
- style = MaterialTheme.typography.labelSmall,
- color = barColor,
- maxLines = 1,
- )
+ if (usedTokens != null) {
+ Text(
+ text = "$pct%",
+ style = MaterialTheme.typography.labelSmall,
+ color = barColor,
+ maxLines = 1,
+ )
+ }
}
}
Box(
diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml
index 6c524f74..c0e458e6 100644
--- a/app/src/main/res/values-ar/strings.xml
+++ b/app/src/main/res/values-ar/strings.xml
@@ -1310,6 +1310,7 @@
المطالبة (المدخلات)
تعكس رموز المطالبة إجمالي السياق المستخدم في هذه الجلسة حتى الآن.
نافذة السياق
+استخدام نافذة السياق غير متوفر
تشغيل GIF
تصفية المهام حسب العنوان أو الحالة أو المسؤول...
سجلات Hermes
diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml
index 7fcf777c..8fd352db 100644
--- a/app/src/main/res/values-zh/strings.xml
+++ b/app/src/main/res/values-zh/strings.xml
@@ -1277,6 +1277,7 @@
提示词(输入)
提示词 token 反映此会话迄今使用的总上下文。
上下文窗口
+ 上下文窗口使用量不可用
播放 GIF
按标题、状态或负责人筛选任务…
Hermes 日志
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index a7da130e..16e3cc74 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1437,6 +1437,7 @@
Prompt (input)
Prompt tokens reflect total context used by this session so far.
Context window
+ Context window usage unavailable
Play GIF
Filter tasks by title, status, or assignee...
Hermes Logs