From a2c57ccaf0af6e2d974c56586b1c9af18077b630 Mon Sep 17 00:00:00 2001 From: ekko <152005280+EKKOLearnAI@users.noreply.github.com> Date: Sat, 25 Apr 2026 14:23:37 +0800 Subject: [PATCH] fix(chat): clamp context remaining tokens to 0 instead of showing negative (#202) Co-authored-by: Claude Opus 4.6 --- packages/client/src/components/hermes/chat/ChatInput.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/client/src/components/hermes/chat/ChatInput.vue b/packages/client/src/components/hermes/chat/ChatInput.vue index dd3ba77..fa27785 100644 --- a/packages/client/src/components/hermes/chat/ChatInput.vue +++ b/packages/client/src/components/hermes/chat/ChatInput.vue @@ -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),