[PR #4471] [CLOSED] [GUI] The thinking row shows live time and tokens, and counts only the thinking #5062

Closed
opened 2026-11-07 16:32:24 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/4471
Author: @xvcezrqpbxtpzblrt
Created: 10/28/2026
Status: ❌ Closed

Base: main ← Head: gui/reasoning-display-027


📝 Commits (1)

  • fec4741 [GUI] The thinking row shows live time and tokens, and counts only the thinking

📊 Changes

13 files changed (+107 additions, -24 deletions)

View changed files

📝 apps/host/src/components/ReasoningBlock.tsx (+30 -9)
📝 apps/host/src/lib/reasoning.ts (+33 -0)
📝 apps/host/src/lib/store.ts (+9 -6)
📝 apps/host/src/locales/de.json (+2 -1)
📝 apps/host/src/locales/en.json (+2 -1)
📝 apps/host/src/locales/es.json (+2 -1)
📝 apps/host/src/locales/fr.json (+2 -1)
📝 apps/host/src/locales/ja.json (+2 -1)
📝 apps/host/src/locales/ko.json (+2 -1)
📝 apps/host/src/locales/pt.json (+2 -1)
📝 apps/host/src/locales/ru.json (+2 -1)
📝 apps/host/src/locales/zh.json (+2 -1)
📝 apps/host/tests/live-chat.test.mjs (+17 -0)

📄 Description

Problem

The thinking row above an answer had three faults:

  • while the model thought it showed the newest reasoning line, with no time: a five-minute thought looked frozen;
  • after the answer began it said "Thought for 5m 26s" but no token count;
  • that duration ran from the first reasoning token to the first answer token, so a tool call in between was counted as thinking.

Result

  • While thinking: Thinking… 1m 20s · ≈3,120 tokens, one tick a second, nothing else in the chat re-renders.
  • When the answer starts: Thought for 5m 26s · ≈3,120 tokens, frozen.
  • The time is the sum of thinking segments. A segment ends when the answer text starts, a tool call begins, an error arrives or the turn ends; a later thought opens a new segment instead of replacing the first. Tool runs are not counted.
  • The token count is an estimate (a CJK character is one token, other text about four characters per token) and is marked ≈; the engine does not report a reasoning-only count.
  • All nine languages have the new ≈{0} tokens label; the existing "Thinking…" and "Thought for {0}" translations are reused.

Validation

  • node --test tests/live-chat.test.mjs → 17 pass, including: a running segment counts up, a closed message counts only closed time, two segments add instead of replacing, an idle message adds nothing, and the token estimate (CJK vs Latin vs empty).
  • npm run typecheck clean; catalog tests (key sets, French typography, gaps) pass.
  • Live in the app: the row appeared while streaming as 思考中… 0s · 约 12 词元, then settled to 推理 · 约 37 词元 (Swift thought for under a second, so the "Thought for" form is not used); the long earlier answer now reads 思考了 5m 26s · 约 40,403 词元.
  • Not run live: a multi-minute thought with a tool call in the middle; that timing is the unit-tested part.

Limits

  • Reasoning tokens are approximate; only the engine's total output tokens are exact.
  • A thought shorter than one second still shows "Reasoning · ≈N tokens" rather than "Thought for 0s".
  • The text is display-only; it is not sent back to the model and does not change the answer.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/4471 **Author:** [@xvcezrqpbxtpzblrt](https://github.com/xvcezrqpbxtpzblrt) **Created:** 10/28/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `gui/reasoning-display-027` --- ### 📝 Commits (1) - [`fec4741`](https://github.com/Niko1221/Strata/commit/fec47415a3bf1b0ea2dd2069dd3acef1a7fd360d) [GUI] The thinking row shows live time and tokens, and counts only the thinking ### 📊 Changes **13 files changed** (+107 additions, -24 deletions) <details> <summary>View changed files</summary> 📝 `apps/host/src/components/ReasoningBlock.tsx` (+30 -9) 📝 `apps/host/src/lib/reasoning.ts` (+33 -0) 📝 `apps/host/src/lib/store.ts` (+9 -6) 📝 `apps/host/src/locales/de.json` (+2 -1) 📝 `apps/host/src/locales/en.json` (+2 -1) 📝 `apps/host/src/locales/es.json` (+2 -1) 📝 `apps/host/src/locales/fr.json` (+2 -1) 📝 `apps/host/src/locales/ja.json` (+2 -1) 📝 `apps/host/src/locales/ko.json` (+2 -1) 📝 `apps/host/src/locales/pt.json` (+2 -1) 📝 `apps/host/src/locales/ru.json` (+2 -1) 📝 `apps/host/src/locales/zh.json` (+2 -1) 📝 `apps/host/tests/live-chat.test.mjs` (+17 -0) </details> ### 📄 Description ## Problem The thinking row above an answer had three faults: - while the model thought it showed the newest reasoning line, with no time: a five-minute thought looked frozen; - after the answer began it said "Thought for 5m 26s" but no token count; - that duration ran from the first reasoning token to the first answer token, so a tool call in between was counted as thinking. ## Result - While thinking: `Thinking… 1m 20s · ≈3,120 tokens`, one tick a second, nothing else in the chat re-renders. - When the answer starts: `Thought for 5m 26s · ≈3,120 tokens`, frozen. - The time is the sum of thinking segments. A segment ends when the answer text starts, a tool call begins, an error arrives or the turn ends; a later thought opens a new segment instead of replacing the first. Tool runs are not counted. - The token count is an estimate (a CJK character is one token, other text about four characters per token) and is marked `≈`; the engine does not report a reasoning-only count. - All nine languages have the new `≈{0} tokens` label; the existing "Thinking…" and "Thought for {0}" translations are reused. ## Validation - `node --test tests/live-chat.test.mjs` → 17 pass, including: a running segment counts up, a closed message counts only closed time, two segments add instead of replacing, an idle message adds nothing, and the token estimate (CJK vs Latin vs empty). - `npm run typecheck` clean; catalog tests (key sets, French typography, gaps) pass. - Live in the app: the row appeared while streaming as `思考中… 0s · 约 12 词元`, then settled to `推理 · 约 37 词元` (Swift thought for under a second, so the "Thought for" form is not used); the long earlier answer now reads `思考了 5m 26s · 约 40,403 词元`. - Not run live: a multi-minute thought with a tool call in the middle; that timing is the unit-tested part. ## Limits - Reasoning tokens are approximate; only the engine's total output tokens are exact. - A thought shorter than one second still shows "Reasoning · ≈N tokens" rather than "Thought for 0s". - The text is display-only; it is not sent back to the model and does not change the answer. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 16:32:24 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#5062
No description provided.