Skip to content

feat(chat): Clarify token usage in chat header (tooltip + task & project total)#1501

Open
dataCenter430 wants to merge 4 commits intoeigent-ai:mainfrom
dataCenter430:feat/clarify-token-usage-in-header-with-tooltip
Open

feat(chat): Clarify token usage in chat header (tooltip + task & project total)#1501
dataCenter430 wants to merge 4 commits intoeigent-ai:mainfrom
dataCenter430:feat/clarify-token-usage-in-header-with-tooltip

Conversation

@dataCenter430
Copy link
Contributor

@dataCenter430 dataCenter430 commented Mar 16, 2026

Related Issue

Closes #1441

Description

Improves the chat header token display so "Chat #0" is clearly understood as token usage and supports both task and project-level counts.

Changes

  • Hover tooltip: The value next to "Chat" (e.g. # 0) now shows a tooltip on hover with the label "Token usage" and a short explanation.
  • Task vs total: The tooltip shows this task token count and, when available, project total token count (e.g. "This task: 1,234 · Project total: 5,678").
  • UX: Token number uses cursor-help and toLocaleString() for readable numbers.

Technical details

  • HeaderBox: added optional totalTokens prop and wrapped token value in TooltipSimple.
  • ChatBox: passes totalTokens from projectStore.getProjectTotalTokens(activeProjectId).
  • i18n: new keys in all locales — chat.token-usage, chat.token-usage-this-task, chat.token-usage-project-total.

Testing Evidence (REQUIRED)

  • I have included human-verified testing evidence in this PR.
  • This PR includes frontend/UI changes, and I attached screenshot(s) or screen recording(s).
  • No frontend/UI changes in this PR.

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Contribution Guidelines Acknowledgement

@dataCenter430
Copy link
Contributor Author

16.03.2026_17.20.44_REC.mp4

@dataCenter430
Copy link
Contributor Author

Hi, @Wendong-Fan @Pakchoioioi
Could you please review the PR when you have a chance?
Thank you. 🙏

@4pmtong
Copy link
Collaborator

4pmtong commented Mar 17, 2026

Thanks @dataCenter430 for contribution. could @fengju0213 @a7m-1st help review it?

@4pmtong 4pmtong requested review from a7m-1st and fengju0213 March 17, 2026 11:12
@fengju0213
Copy link
Collaborator

thanks @dataCenter430 the code logic looks good to me,but for user experience,shouldn we use a more intuitive way of expressing it?
cc @Douglasymlai @Pakchoioioi

@dataCenter430
Copy link
Contributor Author

thanks @dataCenter430 the code logic looks good to me,but for user experience,shouldn we use a more intuitive way of expressing it? cc @Douglasymlai @Pakchoioioi

What do you prefer? Once you clarify it, I will implement it right away.

@Douglasymlai
Copy link
Contributor

Hi @dataCenter430, yes — I think there are a few changes that would make it more user-friendly and easier to follow. I’ll put together a spec today and send it over tomorrow.

@dataCenter430
Copy link
Contributor Author

Hi @dataCenter430, yes — I think there are a few changes that would make it more user-friendly and easier to follow. I’ll put together a spec today and send it over tomorrow.

Thanks for your review. Please do it. 👍
Once you clarify it, I will implement it perfectly.

@dataCenter430
Copy link
Contributor Author

Hi, @Douglasymlai
Are there any updates for this feature?
Please tell me, so I can implement it.
Thank you

@Douglasymlai
Copy link
Contributor

Hi @dataCenter430, sorry for the delay. I’ve put together a specification for a few changes that I think will improve the UX of these feature.

I’ve written the detailed plan in the markdown file, and included the related materials in the zip file. I usually share design files with developers in the community using a tool called Pencil. You can find the VS Code plugin: https://www.pencil.dev/. It connects easily with Claude Code or Codex, which should help with reviewing the UI design in more detail.

token-counting-design-spec.md
design material.zip

Example Outcome:
Screenshot 2026-03-18 at 13 56 28

Thanks for your contribution. You can tag me for review after the change as been made. I will push the team for faster code formate review and merging to the main branch.

@dataCenter430
Copy link
Contributor Author

Hi, @Douglasymlai thanks for the clarification.
So professional, okay, I got it.
Thank you

@dataCenter430
Copy link
Contributor Author

Hi, @Douglasymlai
I've updated the UI as you wanted.
image
image

Also I've implemented the translations for that.
Really hope your review again.
Thank you.

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.

[Feature Request] Optimize UI for token value

4 participants