fix(stats): attribute Hy4 preview traffic to Tencent (#51050)

Co-authored-by: MrMushrooooom <19261047+MrMushrooooom@users.noreply.github.com>
This commit is contained in:
Jack
2026-09-24 14:20:31 +08:00
committed by GitHub
co-authored by MrMushrooooom
parent 0027387dc5
commit 0f549842ee
4 changed files with 18 additions and 1 deletions
+5 -1
View File
@@ -207,7 +207,11 @@ export class GeoStatRepo extends Context.Service<GeoStatRepo, GeoStatRepo.Servic
inArray(geoStat.dataset, scope.datasets),
inArray(geoStat.client, scope.clients),
inArray(geoStat.source, scope.sources),
or(inArray(geoStat.provider, RETIRED_STAT_PROVIDERS), inArray(geoStat.model, RETIRED_STAT_MODELS)),
or(
inArray(geoStat.provider, RETIRED_STAT_PROVIDERS),
inArray(geoStat.model, RETIRED_STAT_MODELS),
and(eq(geoStat.provider, "unknown"), eq(geoStat.model, "hy4-preview")),
),
),
),
catch: (cause) => DatabaseError.make({ cause }),
@@ -57,6 +57,17 @@ describe("inference stat normalization", () => {
expect(statProvider("unknown", "", "custom-provider")).toBe("custom-provider")
})
test("attributes hy4 preview traffic to Tencent instead of the unknown provider", () => {
expect(modelAuthor("hy4-preview")).toBe("tencent")
expect(toModelAggregate(aggregate("hy4-preview", "opencode"))).toMatchObject([
{ model: "hy4-preview", provider: "tencent" },
])
expect(toProviderAggregate(aggregate("hy4-preview", "opencode"))).toMatchObject([{ provider: "tencent" }])
expect(toGeoAggregate({ ...aggregate("hy4-preview", "opencode"), country: "US" })).toMatchObject([
{ model: "hy4-preview", provider: "tencent" },
])
})
test("maps oversized model ids to unknown before aggregation", () => {
expect(statModel("x".repeat(256), "")).toBe("x".repeat(256))
expect(statModel("x".repeat(257), "")).toBe("unknown")
@@ -6,6 +6,7 @@ export const MODEL_AUTHOR_RULES = [
{ match: "gpt", author: "openai" },
{ match: "grok", author: "xai" },
{ match: "hy3", author: "tencent" },
{ match: "hy4", author: "tencent" },
{ match: "kimi", author: "moonshot" },
{ match: "mimo", author: "xiaomi" },
{ match: "minimax", author: "minimax" },
+1
View File
@@ -195,6 +195,7 @@ export class ModelStatRepo extends Context.Service<ModelStatRepo, ModelStatRepo.
or(
inArray(modelStat.provider, RETIRED_STAT_PROVIDERS),
inArray(modelStat.model, RETIRED_STAT_MODELS),
and(eq(modelStat.provider, "unknown"), eq(modelStat.model, "hy4-preview")),
),
),
),