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

Co-authored-by: MrMushrooooom <19261047+MrMushrooooom@users.noreply.github.com>
This commit is contained in:
opencode-agent[bot]
2026-09-24 00:56:42 +08:00
committed by GitHub
Unverified
parent b3b030856b
commit 7f39ae9ecb
4 changed files with 18 additions and 1 deletions
+5 -1
View File
@@ -199,7 +199,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 }),
@@ -38,6 +38,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("merges union alpha routes without exposing the provider", () => {
;["opencode-go/union-alpha", "opencode/union-alpha"].forEach((model) => {
expect(statModel(model, "")).toBe("union-alpha")
@@ -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
@@ -186,6 +186,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")),
),
),
),