Skip to content

feat(web): add AI usage Insights tab strings - #218

Open
Rhainland wants to merge 3 commits into
Silo-Server:mainfrom
Rhainland:feat/ai-usage-insights
Open

Rhainland wants to merge 3 commits into
Silo-Server:mainfrom
Rhainland:feat/ai-usage-insights

Conversation

@Rhainland

@Rhainland Rhainland commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds the English for the web admin's new AI usage tab in Insights. The tab shows the tokens Silo's AI providers used, per model, per feature and per day, plus the audio length sent to speech models.

All 43 keys are web-only (x-platforms: ["web"]):

  • web.admin.insights.tabs.ai: the tab label, next to Bandwidth.
  • web.admin.insights.ai.kpi.*: the four summary cards.
  • web.admin.insights.ai.chart.*: the tokens-per-day chart and its Total / Input / Output and By model / By feature toggles.
  • web.admin.insights.ai.column.*, models.*, features.*: the By model and By feature tables.
  • web.admin.insights.ai.feature.*: feature names (subtitle translation, metadata translation, subtitle transcription, recommendations & search, other). The "Other" key is feature.unattributed, since a key can't end in a plural category.
  • web.admin.insights.ai.empty, trackingSince, tokens: the empty state, the notice for periods before counting began, and the token amount label.

Verification

make check: 0 errors. make test: 215 passed. Every key has a description, and every placeholder is declared as String. Translations are left to the maintainer's make translate-pr pass, so translations-complete fails until then.

Used by Silo-Server/silo-server#5823.

AI disclosure

  • Involvement: Fully AI-generated, human verified
  • Model: claude-opus-5-5 (review: gpt-6.2-sol and claude-opus-5-5)
  • Harness: Claude Code in T3 Code

Note

Add 342 localization strings for AI usage Insights tab

Adds the English (en.arb) catalog entries for the new AI usage Insights tab in the web app. The strings cover the tab's UI and set up the catalog for translation.

Macroscope summarized 5c92fc7.

Translations

make translate-pr translated 1634 strings; all 38 languages have every key (make check-complete).

Last pass, per language

Model: claude-opus-5-5

Language Written Failed Batches Claude calls Wall time
es 43 0 1 1 0 min
de 43 0 1 1 0 min
fr 43 0 1 1 0 min
pt-BR 43 0 1 1 0 min
nl 43 0 1 1 0 min
it 43 0 1 1 0 min
pl 43 0 1 1 2 min
tr 43 0 1 1 2 min
sv 43 0 1 1 0 min
da 43 0 1 1 0 min
nb 43 0 1 1 0 min
fi 43 0 1 1 0 min
cs 43 0 1 1 0 min
hr 43 0 1 1 0 min
ru 43 0 1 1 0 min
uk 43 0 1 1 0 min
ja 43 0 1 1 0 min
ko 43 0 1 1 0 min
zh-Hans 43 0 1 1 0 min
zh-Hant 43 0 1 1 0 min
ar 43 0 1 1 0 min
hu 43 0 1 1 0 min
ro 43 0 1 1 0 min
sk 43 0 1 1 0 min
sl 43 0 1 1 0 min
bg 43 0 1 1 0 min
el 43 0 1 1 0 min
ca 43 0 1 1 0 min
lt 43 0 1 1 0 min
lv 43 0 1 1 0 min
et 43 0 1 1 0 min
vi 43 0 1 1 0 min
pt-PT 43 0 1 1 0 min
id 43 0 1 1 0 min
ms 43 0 1 1 0 min
he 43 0 1 1 0 min
hi 43 0 1 1 0 min
th 43 0 1 1 0 min

@coderabbitai

coderabbitai Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Explain Change →

Walkthrough

The catalogs add translations for the Admin Insights AI-usage view and its tab across supported locales. The English catalog also defines labels, descriptions, and placeholders for charts, metrics, feature and model breakdowns, and tracking information. Locale state files add corresponding translation records and metadata.

Changes: AI Insights Localization

Layer / File(s) Summary
Define AI usage insights strings
catalog/*.arb
The English catalog defines chart, table, feature, model, metric, and tracking text, including formatted-value placeholders. Localized catalogs add translations for the view and its tab.
Add locale translation records
state/*.json
Locale state files add translation records for the AI usage insights text and tab, with source and value identifiers and available attribution metadata.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Merge Risk: Low · up to 7a6df

This adds AI usage labels for the Insights tab across locales. The one issue is a minor Ukrainian grammar error in the token label for certain counts. It is safe to merge, with a small wording fix recommended.

Architecture risk: Low · up to 7a6df

The localization data set now includes AI-usage insights content and per-locale freshness records, which the existing completeness check accepts as current only when each source hash matches its English entry.

For each added locale key, the completeness checker treats it as current only when its stored source hash matches the current English entry fingerprint; a mismatch leaves the key incomplete.

Changed areas: catalog, state

Review details

Systems and components

  • observed — 39 changed files mapped to catalog.
  • observed — 38 changed files mapped to state.
Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the change: adding AI usage Insights tab strings to the web app. The changeset adds 342 English keys to catalog/en.arb for that tab, and the same keys are added to the other locale cat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description explains the change. It says the PR adds English web-admin strings for the new AI usage tab in Insights. It lists the 43 web-only keys by group: the tab label, KPI cards, chart and tog…
Full details: Title check

Explanation

The title names the change: adding AI usage Insights tab strings to the web app. The changeset adds 342 English keys to catalog/en.arb for that tab, and the same keys are added to the other locale catalogs and state files. The title is specific, concise, and matches the main change.

Full details: Description check

Explanation

The description explains the change. It says the PR adds English web-admin strings for the new AI usage tab in Insights. It lists the 43 web-only keys by group: the tab label, KPI cards, chart and toggle labels, model and feature tables, feature names, and empty-state and tracking text. It also gives verification results and the translation status. The raw summary and objectives also describe the same catalog and state changes, so the description matches the changeset.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Tools execution failed with the following error:

Failed to run tools: 13 INTERNAL: Received RST_STREAM with code 2 (Internal server error)

@silo-triage silo-triage Bot added the size/L 200–499 added + deleted lines (all files); change volume, not priority. label Dec 3, 2026
Quick104 added a commit to Rhainland/silo-server that referenced this pull request Dec 4, 2026
Resolve the translation pin conflict by re-syncing the web locales from a
local catalog build of main's pinned release plus Silo-Server/silo-translations#218.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@silo-triage silo-triage Bot added size/XXXL 3000+ added + deleted lines (all files); change volume, not priority. and removed size/L 200–499 added + deleted lines (all files); change volume, not priority. labels Dec 4, 2026
Quick104 added a commit to Rhainland/silo-server that referenced this pull request Dec 4, 2026
…nslations#218

Local build of main's pinned catalog release plus Silo-Server/silo-translations#218
with its translation pass. Re-pin to the release once Silo-Server#218 merges.

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments

Minor 1
  1. Use a count-independent token label.
Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8f700f48-083a-419c-a9f7-5ea4bdeac87b
Commits

Reviewing files that changed from the base of the PR and between 2c738a9 and 7a6df27.

Files selected for processing: 77

  • catalog/ar.arb
  • catalog/bg.arb
  • catalog/ca.arb
  • catalog/cs.arb
  • catalog/da.arb
  • catalog/de.arb
  • catalog/el.arb
  • catalog/en.arb
  • catalog/es.arb
  • catalog/et.arb
  • catalog/fi.arb
  • catalog/fr.arb
  • catalog/he.arb
  • catalog/hi.arb
  • catalog/hr.arb
  • catalog/hu.arb
  • catalog/id.arb
  • catalog/it.arb
  • catalog/ja.arb
  • catalog/ko.arb
  • catalog/lt.arb
  • catalog/lv.arb
  • catalog/ms.arb
  • catalog/nb.arb
  • catalog/nl.arb
  • catalog/pl.arb
  • catalog/pt-BR.arb
  • catalog/pt-PT.arb
  • catalog/ro.arb
  • catalog/ru.arb
  • catalog/sk.arb
  • catalog/sl.arb
  • catalog/sv.arb
  • catalog/th.arb
  • catalog/tr.arb
  • catalog/uk.arb
  • catalog/vi.arb
  • catalog/zh-Hans.arb
  • catalog/zh-Hant.arb
  • state/ar.json
  • state/bg.json
  • state/ca.json
  • state/cs.json
  • state/da.json
  • state/de.json
  • state/el.json
  • state/es.json
  • state/et.json
  • state/fi.json
  • state/fr.json
  • state/he.json
  • state/hi.json
  • state/hr.json
  • state/hu.json
  • state/id.json
  • state/it.json
  • state/ja.json
  • state/ko.json
  • state/lt.json
  • state/lv.json
  • state/ms.json
  • state/nb.json
  • state/nl.json
  • state/pl.json
  • state/pt-BR.json
  • state/pt-PT.json
  • state/ro.json
  • state/ru.json
  • state/sk.json
  • state/sl.json
  • state/sv.json
  • state/th.json
  • state/tr.json
  • state/uk.json
  • state/vi.json
  • state/zh-Hans.json
  • state/zh-Hant.json

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Comment thread catalog/uk.arb
"web.admin.insights.ai.models.note": "Кешовані вхідні токени входять до вхідних. Токени міркувань входять до вихідних.",
"web.admin.insights.ai.models.removedProvider": "Видалений постачальник",
"web.admin.insights.ai.models.title": "За моделями",
"web.admin.insights.ai.tokens": "{value} токенів",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor · Functional Correctness · Quick win

Use a count-independent token label.

For a value of 1, this displays 1 токенів, which has the wrong Ukrainian form. Use Токени: {value} to support every formatted count without changing the placeholder.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This string comes from the machine translation pass, and translations here aren't written by hand. Re-running the pass for this key (make translate LOCALE=uk RETRANSLATE=web.admin.insights.ai.tokens) returned the same {value} токенів, so I'm leaving it as is. {value} is a compact number such as "1.2M", so a count of exactly 1 rarely shows. A Ukrainian speaker can still change it to a label form in a translation fix PR, and later passes keep that edit.

🤖 Claude Code (claude-opus-5-5)

Quick104 added a commit to Rhainland/silo-server that referenced this pull request Dec 4, 2026
Re-sync the web locales from a local catalog build of main's new pinned
release (2026.12.04-d577fe4) plus Silo-Server/silo-translations#218.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Quick104 added a commit to Silo-Server/silo-server that referenced this pull request Dec 4, 2026
…5823)

* feat(insights): count AI token usage and show it in an AI usage tab

Record every answered AI provider request (chat, Responses API, ChatGPT plan,
transcription, embeddings) into a daily ai_usage_daily rollup keyed by UTC day,
provider, model and feature, and serve it at GET /api/v2/admin/insights/ai for
a new AI usage tab next to Bandwidth. Tokens only; no pricing.

* fix(insights): keep the AI chart's overflow band apart from the Other feature

Also keep the share bar fill visible in forced-colors mode.

* fix(insights): count only usable or billed embedding replies, under the serving provider

Show the usage-counted-from notice in the empty state too, and shorten
the empty-state message.

* fix(insights): count an unbilled embedding reply only after its vectors pass validation

A reply with the expected number of vectors but an empty one was counted
before being rejected. Provider-reported usage on a rejected reply is
still recorded.

* fix(insights): take the AI usage tracking day in UTC whatever the database timezone

goose_db_version.tstamp is a timestamp without time zone written in the
server's TimeZone. Reading it as UTC moved tracking_since a day early on
servers west of UTC and a day late east of it.

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

* fix(insights): send the AI usage tracking day as a date, and label unknown features

tracking_since names a UTC day, so it is a YYYY-MM-DD date as the API
contract requires for day-only values, not an instant a client could shift
into the day before. The contract fixture's window now starts at UTC
midnight, as the field's description says.

A feature value a newer server adds reads as unattributed in the tab rather
than looking up a label that doesn't exist.

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

* fix(insights): never fail a provider reply over its usage field

Token counts were decoded as int64 inside the embedding and ChatGPT stream
replies, so a provider sending 3.0 or a non-number made a usable reply fail
to decode. Counts now read leniently and fall back to zero.

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

* chore(web): sync the AI usage strings in every language from silo-translations#218

Local build of main's pinned catalog release plus Silo-Server/silo-translations#218
with its translation pass. Re-pin to the release once #218 merges.

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

* fix(insights): read a provider's token count without a swallowed error

Count.UnmarshalJSON returned nil inside an error branch, which nilerr
rejects. It now zeroes the count first and assigns only a valid number,
with one nil return. A non-number, negative or out-of-range count still
reads as zero and a fractional count is still truncated; a unit test
pins both.

* fix(insights): keep a malformed usage field from rejecting embedding vectors

A provider that sends "usage": [] (or Gemini's "usageMetadata": [])
failed the whole decode, so usage tracking threw away vectors Silo could
use. Decode the vectors strictly and read usage on its own, ignoring a
malformed value, as the chat client already does.

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

---------

Co-authored-by: Quick104 <31828688+Quick104@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@silo-triage silo-triage Bot added the enhancement New feature or request label Dec 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size/XXXL 3000+ added + deleted lines (all files); change volume, not priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants