Skip to content

Overview: tell unpriced, free and no-usage models apart - #206

Merged
fylorn merged 1 commit into
devfrom
ui/overview-core-data
Sep 25, 2026
Merged

fylorn merged 1 commit into
devfrom
ui/overview-core-data

Conversation

@fylorn

@fylorn fylorn commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Uses the per-group unpriced_requests / no_usage_requests that CostBucketGroup carries since core v0.48 (ThinkWatch-Core#193) to remove the ambiguous "—" from the Overview's model ranking.

Model ranking: the cost cell

Before, a model with tokens but no cost showed "—" with a tooltip saying "unpriced or not billed": the grouped buckets had no unpriced count, so the UI could not tell which. Now each row carries its unpriced / no-usage counts and the estimated part (history from buckets_by_model, live mode from the event stream), and the cell follows the same rules as the session cost cell (costCell):

State Cell Tooltip
usage known, nothing priced 无法计价 / Unpriced (warning colour) "N 条请求无法计价:模型未定价,费用未计入"
no usage at all 无用量 / No usage (muted) "N 条请求没有用量数据,费用未计入"
partly priced ≥$6.12 (lower bound) the missing requests, as above
part estimated ~$33.94 "含估算 $0.26"
all priced $0.855, or $0 when it really is zero (free upstreams such as Ollama) none

When a single model has unpriced requests, the cost cell is its own link: it opens Traffic filtered to that model's unpriced requests ({ model, unpricedOnly: true }). The row keeps opening the model's traffic. Click and Enter/Space on the cell do not bubble to the row. The merged "Other" row has no link; its cell shows the tooltip only. The cost column widens from 64 to 80px so that ≥~$1234.56 fits (79px measured).

Live mode

  • A request_priced without a cost marks the live sample as unpriced, so the live ranking makes the same distinction. A sample whose price has not arrived yet is not counted as unpriced.
  • The backfill from History now uses core's clock: /in-flight's now_ms gives the window start and the offset for mapping stored at_ms onto the UI's timeline. Before, it compared the UI's Date.now() with core timestamps, so a remote core with a skewed clock shifted the backfilled part of the curve. Checked against the harness with ±5 min of simulated skew: the ranking is now identical to no skew; the old code counted 17 / 6 requests instead of 13.
  • The backfill skips local answers, like core's aggregates do.
  • RunningView only comes from GET /live, which the webview cannot call (menu bar only). The Overview has no list of running requests, so I did not add one.

Chart tooltip (cost measure)

The bucket total is written like the ranking cell: 无法计价 / 无用量 when nothing in the bucket was priced, otherwise the amount with its ≥ / ~ marks (no "≥$0"). The note adds the bucket's unpriced / no-usage counts, for example "8 次请求,1 次失败,1 条无法计价", worded like the qualifiers under the cost figure.

Fix: tooltips on overview links never appeared

LinkText dropped the props that Tip's trigger passes through asChild (pointer and focus handlers, ref). As a result the tooltips on "N 条无法计价", "N 次失败" and "N 个不可用" never opened. It now spreads them onto its span and composes its own click and key handlers with them.

Checks

🤖 Generated with Claude Code

@fylorn
fylorn force-pushed the ui/overview-core-data branch from 5090c8f to cb40988 Compare September 25, 2026 06:14
The model ranking now reads each model's unpriced / no-usage counts and
estimated part from CostBucketGroup (core v0.48) instead of showing an
ambiguous "—" whenever a model had tokens but no cost:

- usage known, nothing priced: 无法计价 / Unpriced, in the warning
  colour; clicking it opens Traffic filtered to that model's unpriced
  requests (the row itself still opens the model's traffic)
- no usage at all: 无用量 / No usage
- otherwise the amount: "≥" when some requests could not be priced,
  "~" when part of it is estimated, and $0 only when it really is zero
  (free upstreams). The reasons are in the tooltip, as in the session
  cost cell.

Live mode makes the same distinction: a request_priced without a cost
marks the sample unpriced. The live backfill from History is placed on
core's clock (/in-flight's now_ms) instead of the UI's, so a remote core
with a skewed clock no longer shifts it, and local answers are skipped
like in core's aggregates.

In the cost measure, the chart tooltip writes a bucket's total the same
way (a word, or the amount with its marks) and its note lists the
bucket's unpriced / no-usage requests.

LinkText now forwards the tooltip trigger's props: the tooltips on
"N 条无法计价", "N 次失败" and "N 个不可用" never appeared.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fylorn
fylorn force-pushed the ui/overview-core-data branch from cb40988 to 35bb5d8 Compare September 25, 2026 06:15
@fylorn
fylorn merged commit c1f3e45 into dev Sep 25, 2026
4 checks passed
@fylorn
fylorn deleted the ui/overview-core-data branch September 25, 2026 06:22
fylorn added a commit that referenced this pull request Sep 25, 2026
…anges; fetch-core.sh says dev builds need it too

Overview, routing, dry-run, remote-switcher and traffic changed on dev
(#206, #207, #208). The comment at the top of fetch-core.sh still said a
dev build needs neither the network nor resources/twcore; the Tauri build
checks the resource at compile time, so a fresh checkout runs the script
once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fylorn added a commit that referenced this pull request Sep 25, 2026
…hots (#201)

* docs: rewrite the READMEs for the current app and use the new screenshots

The READMEs showed screenshots of the old sidebar, including a Findings
page that no longer exists, and said nothing about connecting to a
remote core, the interface languages or the system tray. Both are
rewritten in the same structure, from what the code does today:

- An opening in the approved register, then the platforms, the
  interface languages and in-app updates.
- One section per page (Overview, Traffic, Clients, Keys, Upstreams,
  Routing, Security, MCP, Settings). Security is written from
  tw-config's guard defaults and built-in rules, MCP from tw-adopt's
  targets and tw-scan's sources, and the list of system notifications
  from src-tauri/src/notices/rules.rs.
- "Connecting to a remote core": Settings > Connection, the pages that
  always act on this machine (Clients, MCP), where the connection key
  is kept, what changes while connected; links to Core's server
  deployment guide.
- Layout: the control channel over a unix socket, a loopback port or a
  remote TCP port, each behind the Noise NNpsk0 handshake, replacing
  the per-launch credential the old text described.

Images now come from the committed pipeline: the zh README uses
docs/screenshots/zh/, the English one docs/screenshots/en/, both with
the light/dark <picture> switch, and the overview sits in the
introduction of both. A fresh `pnpm shots` run on this base produced
identical files, so no image changes. The 28 old root-level images are
deleted; nothing in this repository, the website or the organization
profile links to them (the latter two keep their own copies).

Build from source now fetches twcore first: Tauri checks declared
resources at compile time, so `pnpm tauri dev` fails in a fresh
checkout without it, while CONTRIBUTING said it needed nothing. Also
spell "Apple silicon", and give package.json and Cargo.toml a
description that names the platforms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs: name the platforms before the gateway in the English opening

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs: say how a new version is announced, and give the mismatch command

The Updates section said a small window appears when there is a new
version. The automatic check sends a system notification instead
(updater.rs: update_loop -> notify_update), and only when notices are
set to system notifications. The update window opens from that
notification, from the Install Version item that replaces Check for
Updates in the menu bar or tray menu, and from Settings > About. The
notifications paragraph now mentions the new-version notification too.

For a Homebrew installation the check reads the tap's cask, so the
sentence that said when the window appears now says when a new version
is reported.

Connecting to a remote core: when the server's core version differs,
the app gives `sudo twcore upgrade --version <version> --restart`, which
installs the expected version whether it is newer or older than the
installed one (#204). Both languages say the same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs: re-shoot the screenshots on core v0.48.0

`pnpm shots` on dev 2fa65fd changes five scenes, because #202 and #203
changed what they show:

- remote-add: the connection test reports core 0.48.0, the version the
  app now pins (a 0.47.0 server would be a version mismatch). The alt
  text in both READMEs says 0.48.0.
- traffic: the request in progress shows its status code and token
  count, replayed from /in-flight.
- routing and dry-run: the map marks the upstream with a request in
  flight.
- security: the header counts the entries by outcome.

The other alt texts still describe their images. The website copies in
docs/screenshots/web/ are regenerated with them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs: re-shoot five scenes after the overview, routing and traffic changes; fetch-core.sh says dev builds need it too

Overview, routing, dry-run, remote-switcher and traffic changed on dev
(#206, #207, #208). The comment at the top of fetch-core.sh still said a
dev build needs neither the network nor resources/twcore; the Tauri build
checks the resource at compile time, so a fresh checkout runs the script
once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
fylorn pushed a commit that referenced this pull request Sep 27, 2026
… Upstreams

The Keys page (each key's cost and the 24-hour total) and the Upstreams
page (the total in the header and each row's cost) printed one plain
figure. It included estimated cost with no "~", and requests that could
not be priced were simply missing, so a key whose requests all hit a
model without a price read "$0", as if it cost nothing. That is what the
Overview's model ranking stopped doing in #206, and what CONTRIBUTING
asks never to do.

These figures now go through the ranking's own rule (`rankCost`), via a
small shared `CostFigure`: "Unpriced" or "No usage" instead of $0 when
nothing could be priced, "≥" when some requests are missing from the
amount, "~" when part of it is estimated, and the explanation in the
tooltip. The estimated part is summed from the buckets both endpoints
already return, since the totals carry exact and estimated as one sum.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0182jRYSA2HY98GmbHidNTia
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