fix(chat): clamp context remaining tokens to 0 instead of showing negative (#202)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
ekko
2026-04-25 14:23:37 +08:00
committed by GitHub
parent 4bdcaa6258
commit a2c57ccaf0
@@ -44,7 +44,7 @@ const totalTokens = computed(() => {
return input + output
})
const remainingTokens = computed(() => contextLength.value - totalTokens.value)
const remainingTokens = computed(() => Math.max(0, contextLength.value - totalTokens.value))
const usagePercent = computed(() =>
Math.min((totalTokens.value / contextLength.value) * 100, 100),