mirror of
https://github.com/anomalyco/opencode.git
synced 2026-09-28 05:23:19 +08:00
fix(stats): attribute Hy4 preview traffic to Tencent (#51050)
Co-authored-by: MrMushrooooom <19261047+MrMushrooooom@users.noreply.github.com>
This commit is contained in:
@@ -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" },
|
||||
|
||||
@@ -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")),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user