Skip to content

feat(chat): opt-in live TTFT / tok/s chip in the composer - #3227

Open
123ada11f wants to merge 1 commit into
EKKOLearnAI:mainfrom
123ada11f:feat/chat-stream-metrics
Open

123ada11f wants to merge 1 commit into
EKKOLearnAI:mainfrom
123ada11f:feat/chat-stream-metrics

Conversation

@123ada11f

Copy link
Copy Markdown

Supersedes #2713 (author @monikalnbo) — that PR has been CONFLICTING since 2026-08-23.

What this is

A rebase of #2713 onto current main, keeping the original author on the commit and the original intent intact: an opt-in chip inside the composer showing TTFT and a rolling tok/s estimate while a reply streams, driven by a new packages/client/src/utils/hermes/stream-metrics.ts (2-second sliding window over streamed deltas, estimated tokens from chunk text).

What I changed on top of the original

  • ChatInput.vue props block conflicted with main — kept main's initialText / persistDraft defaults and the new showStreamSpeed prop.
  • Dropped a stale noteRunStart(sid) call in stores/hermes/chat.ts: no such export exists in stream-metrics.ts, so it would fail vue-tsc. noteStreamStart(sid) on the next line already records the run-issue moment that the TTFT clock measures from.

Net: +180 / -0 across 15 files (was +181/-0 before removing the stale call). Purely additive — nothing from main is deleted.

Verification

  • 3-way merge (base → main → PR head) done locally with git merge-file; only the ChatInput.vue props block conflicted, and no conflict markers remain anywhere in the change set.
  • The result was diffed against main and stays additive in shape, matching the original PR's footprint.
  • Upstream CI is the authoritative check; local type-check notes will follow in a comment (this box has Node 22 while the repo declares >=23).

Context

Issue #3178 asks for exactly this in the chat UI and notes that the official desktop app already surfaces avg_tps / cache_hit_pct from the TUI gateway while Studio's web UI shows neither. For anyone who wants it today without rebuilding, there is also a non-invasive local overlay (inject a script, or CDP runtime injection — no source changes): https://github.com/123ada11f/ekko-studio-tokps ; anything useful from it (e.g. reading GET /api/studio/sessions/:id for real token counts) can be folded in here instead.

Rebase of EKKOLearnAI#2713 by @monikalnbo onto current main (PR was CONFLICTING since
2026-08-23). Two adjustments were needed for it to build here:

- ChatInput.vue props block: kept main's `initialText` / `persistDraft`
  defaults alongside the new `showStreamSpeed` prop.
- dropped a stale `noteRunStart(sid)` call in the chat store — no such export
  exists in stream-metrics.ts; `noteStreamStart(sid)` on the next line already
  records the run-issue moment the TTFT clock measures from.

Verified locally: 3-way merge against main, no conflict markers left, and the
change set stays additive (no deletion of existing main content).
@123ada11f

123ada11f commented Sep 29, 2026 •

Copy link
Copy Markdown
Author

本地验证补充(这台机器的实际情况,供参考):

  • 合并干净:三方合并(PR base → main → PR head)在本地用 git merge-file 做,只有 ChatInput.vue 的 props 块冲突,按"两边都保留"解决(initialText/persistDraft + showStreamSpeed);改动集里已确认没有冲突标记。
  • 仍是纯新增:相对 main 为 +180/-0、15 文件(移除那行 stale 的 noteRunStart(sid) 之前是 +181/-0)。
  • 语法级检查已过(node --experimental-strip-types --check):
    packages/client/src/utils/hermes/stream-metrics.ts(新增)、stores/hermes/chat.ts、
    ChatInput.vue 的 <script setup> 块、i18n/locales/{zh,en,ja}.ts。
  • 完整 vue-tsc 没能跑:npm ci 两次都因网络中断(ECONNRESET,本机需走代理)失败,依赖装到 ~815 MB 时断开;这台机器是 Node 22,而仓库声明 >=23。
  • 上面的 Build / Playwright 两个 workflow 已触发但状态是 action_required —— fork 来的 PR 需要维护者批准才会运行。

批准后如果 vue-tsc 报错,把日志贴过来,我立刻跟进修。


追加:本机能做的语法层验证已跑过(依赖仍装不上)

  • node --experimental-strip-types --check 全部通过:新增的 packages/client/src/utils/hermes/stream-metrics.ts、改动后的 stores/hermes/chat.ts、ChatInput.vue 的 <script setup> 块,以及抽查的 i18n/locales/{zh,en,ja}.ts。
  • npm ci 两次都在约 815 MB 处 ECONNRESET 失败(本机必须走代理),因此 vue-tsc 仍未能本地执行;这台机器是 Node 22 而仓库要求 >=23。
  • 上面的 Build / Playwright 仍为 action_required,等维护者批准后即为权威验证。

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.

2 participants