From 2e96992dd45483507591b66cfc622eb08dc9e75b Mon Sep 17 00:00:00 2001 From: weishu Date: Sun, 17 May 2026 23:23:28 +0800 Subject: [PATCH] Fix mobile status bar --- .../components/AssistantChat/StatusBar.tsx | 38 ++++++++++++------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/web/src/components/AssistantChat/StatusBar.tsx b/web/src/components/AssistantChat/StatusBar.tsx index c1e14945..557a967c 100644 --- a/web/src/components/AssistantChat/StatusBar.tsx +++ b/web/src/components/AssistantChat/StatusBar.tsx @@ -177,6 +177,13 @@ export function StatusBar(props: { const percentageUsed = Math.min(100, Math.round((props.contextSize / maxContextSize) * 100)) return `ctx ${formatTokenCount(props.contextSize)}/${formatTokenCount(maxContextSize)} (${percentageUsed}%)` }, [props.contextSize, props.contextWindow, props.model, props.agentFlavor]) + const compactContextUsageLabel = useMemo(() => { + if (props.contextSize === undefined) return null + const maxContextSize = props.contextWindow ?? getContextBudgetTokens(props.model, props.agentFlavor) + if (!maxContextSize) return `ctx ${formatTokenCount(props.contextSize)}` + const percentageLeft = Math.max(0, Math.round(100 - (props.contextSize / maxContextSize) * 100)) + return `ctx ${formatTokenCount(maxContextSize).toUpperCase()}, ${percentageLeft}% left` + }, [props.contextSize, props.contextWindow, props.model, props.agentFlavor]) const cacheHitLabel = useMemo(() => { if (!props.contextCacheRead || props.contextCacheRead <= 0) return null return `cache ${formatTokenCount(props.contextCacheRead)}` @@ -211,51 +218,56 @@ export function StatusBar(props: { : null return ( -
-
-
+
+
+
- + {connectionStatus.text}
{contextUsageLabel ? ( - - {contextUsageLabel}{contextWarning ? ` · ${contextWarning.text}` : ''} + + + {compactContextUsageLabel} + + + {contextUsageLabel}{contextWarning ? ` · ${contextWarning.text}` : ''} + ) : null} {cacheHitLabel ? ( - + {cacheHitLabel} ) : null}
-
+
{codexReasoningLabel ? ( - + {codexReasoningLabel} ) : null} {codexFastMode ? ( - + fast ) : null} {goalLabel ? ( - + {goalLabel} ) : null} {collaborationModeLabel ? ( - + {collaborationModeLabel} ) : null} {displayPermissionMode ? ( - + {permissionModeLabel} ) : null}