[PR #1112] [MERGED] Show estimated token counts for character cards #4928

Closed
opened 2026-10-22 04:11:47 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1112
Author: @cha1latte
Created: 5/22/2026
Status: ✅ Merged
Merged: 5/22/2026
Merged by: @cha1latte

Base: staging ← Head: feature/issue-1098-character-token-count


📝 Commits (1)

  • 6be5de1 Add character card token estimates

📊 Changes

3 files changed (+127 additions, -4 deletions)

View changed files

📝 packages/client/src/components/characters/CharacterLibraryView.tsx (+24 -4)
📝 packages/client/src/components/panels/CharactersPanel.tsx (+12 -0)
➕ packages/client/src/lib/character-token-count.ts (+91 -0)

📄 Description

Linked issue

Closes #1098

Why this change

  • Users need an easy way to estimate how much context a character card consumes before starting or editing chats with it.

What changed

  • Added a shared client-side character card token estimator using the existing rough chars-per-token convention.
  • Shows estimated token counts in the Characters panel rows.
  • Shows estimated token badges in the full character library grid and selected-card detail view.
  • Labels the count as estimated because tokenizer-specific counts vary by model.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

  • Codex ran pnpm check successfully.
  • Codex ran the app with pnpm dev:client.
  • Codex verified with Playwright that real local character rows in the Characters panel display ~N tokens.
  • Codex verified with Playwright that the full character library grid/detail view displays ~N tokens.
  • Evidence screenshots were captured locally at:
    • scratch/issue-1098-clean-characters-panel.png
    • scratch/issue-1098-clean-character-library.png

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

Characters panel:

Characters panel showing estimated token counts

Full character library:

Full character library showing estimated token badges


🔄 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/Pasta-Devs/Marinara-Engine/pull/1112 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 5/22/2026 **Status:** ✅ Merged **Merged:** 5/22/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `staging` ← **Head:** `feature/issue-1098-character-token-count` --- ### 📝 Commits (1) - [`6be5de1`](https://github.com/Pasta-Devs/Marinara-Engine/commit/6be5de1da85abdb871c0ad81873f7bf0960f9b1d) Add character card token estimates ### 📊 Changes **3 files changed** (+127 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/characters/CharacterLibraryView.tsx` (+24 -4) 📝 `packages/client/src/components/panels/CharactersPanel.tsx` (+12 -0) ➕ `packages/client/src/lib/character-token-count.ts` (+91 -0) </details> ### 📄 Description ## Linked issue Closes #1098 ## Why this change - Users need an easy way to estimate how much context a character card consumes before starting or editing chats with it. ## What changed - Added a shared client-side character card token estimator using the existing rough chars-per-token convention. - Shows estimated token counts in the Characters panel rows. - Shows estimated token badges in the full character library grid and selected-card detail view. - Labels the count as estimated because tokenizer-specific counts vary by model. ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes - Codex ran `pnpm check` successfully. - Codex ran the app with `pnpm dev:client`. - Codex verified with Playwright that real local character rows in the Characters panel display `~N tokens`. - Codex verified with Playwright that the full character library grid/detail view displays `~N tokens`. - Evidence screenshots were captured locally at: - `scratch/issue-1098-clean-characters-panel.png` - `scratch/issue-1098-clean-character-library.png` ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) Characters panel: ![Characters panel showing estimated token counts](https://gist.githubusercontent.com/cha1latte/115ed55eb47d16351a3e3d6b26bca782/raw/35e4d5a50eaa10fd8a9b85945bdfff7159765f8f/issue-1098-clean-characters-panel.png) Full character library: ![Full character library showing estimated token badges](https://gist.githubusercontent.com/cha1latte/115ed55eb47d16351a3e3d6b26bca782/raw/b1cb649055a196880aa924fc96a263d1ea891fe8/issue-1098-clean-character-library.png) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:11:47 +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
Pasta-Devs/Marinara-Engine#4928
No description provided.