Skip to content

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

Closed
xvcezrqpbxtpzblrt wants to merge 1 commit into
Niko1221:mainfrom
xvcezrqpbxtpzblrt:gui/reasoning-display-027
Closed

xvcezrqpbxtpzblrt wants to merge 1 commit into
Niko1221:mainfrom
xvcezrqpbxtpzblrt:gui/reasoning-display-027

Conversation

@xvcezrqpbxtpzblrt

Copy link
Copy Markdown
Contributor

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.

@xvcezrqpbxtpzblrt

Copy link
Copy Markdown
Contributor Author

Superseded by #4606, which carries this change with the rest of the 0.2.7 branch. Closing so the review has one place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant