fix(agy): show Antigravity session-log rows as "Session log"

The frontend map of session placeholder names missed
"Antigravity (Session)", so the provider column showed the raw English
name and truncated it. Add the entry and a test that every placeholder
name in usage_stats.rs is translated.
This commit is contained in:
Jason committed 2026-10-21 17:04:27 +08:00
1 parent e91689f2da
commit 6fabe63abb
2 files changed
+20

No files matched your search

+1
View File
@@ -15,6 +15,7 @@ const SESSION_PROVIDER_APPS: Record<string, AppId> = {
"Grok Build (Session)": "grokbuild",
"MiniMax Code (Session)": "mcode",
"Pi (Session)": "pi",
"Antigravity (Session)": "agy",
};
export interface UsageProviderLabel {
@@ -1,3 +1,5 @@
import { readFileSync } from "node:fs";
import { resolve } from "node:path";
import { describe, expect, it } from "vitest";
import type { TFunction } from "i18next";
import {
@@ -20,6 +22,23 @@ describe("getUsageProviderLabel", () => {
);
});
it("translates every placeholder name the backend can return", () => {
// 后端 provider_name_coalesce 里的占位名,新增应用时漏了前端对照表就会原样显示英文全名
const rust = readFileSync(
resolve(__dirname, "../../src-tauri/src/services/usage_stats.rs"),
"utf8",
);
const names = [...rust.matchAll(/THEN '([^']+ \(Session\))'/g)].map(
(m) => m[1],
);
expect(names).toContain("Antigravity (Session)");
for (const name of names) {
expect(getUsageProviderLabel(name, t).shortLabel).toBe(
"usage.sessionProvider.short",
);
}
});
it("keeps real provider names as-is", () => {
expect(getUsageProviderLabel("DeepSeek", t)).toEqual({
label: "DeepSeek",