diff --git a/src/App.tsx b/src/App.tsx index add8766c..af0f7f72 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -302,19 +302,14 @@ const ContextUsagePanel: Component<{ instanceId: string; sessionId: string }> = contextWindow: 0, isSubscriptionModel: false, contextUsageTokens: 0, + contextUsagePercent: null, }, ) const tokens = createMemo(() => info().tokens) const contextUsageTokens = createMemo(() => info().contextUsageTokens ?? 0) const contextWindow = createMemo(() => info().contextWindow) - const percentage = createMemo(() => { - const windowSize = contextWindow() - if (!windowSize || windowSize <= 0) return null - const usage = contextUsageTokens() - const percent = Math.round((usage / windowSize) * 100) - return Math.min(100, Math.max(0, percent)) - }) + const contextUsagePercent = createMemo(() => info().contextUsagePercent) const costLabel = createMemo(() => { if (info().isSubscriptionModel || info().cost <= 0) return "Included in plan" @@ -333,7 +328,7 @@ const ContextUsagePanel: Component<{ instanceId: string; sessionId: string }> =