fix(web): 模型价格 - 修复零积分显示为未配置
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
|
||||
import { modelQuoteRequest, normalizeTierResolution, priceTiersForCurrentSelection, requestCreditCost } from "../src/lib/model-pricing";
|
||||
import { modelQuoteRequest, normalizeTierResolution, priceTierSummaryLabel, priceTiersForCurrentSelection, requestCreditCost } from "../src/lib/model-pricing";
|
||||
import type { ModelRequirements } from "../src/lib/model-selection";
|
||||
import { createModelChannel, defaultConfig, normalizeConfigSnapshot, resolveModelChannel, type AiConfig } from "../src/stores/use-config-store";
|
||||
|
||||
@@ -86,6 +86,19 @@ describe("model request pricing", () => {
|
||||
).toBe(0.125);
|
||||
});
|
||||
|
||||
test("displays zero-price system tiers as configured free pricing", () => {
|
||||
const fixedConfig = systemConfig({
|
||||
capability: "image",
|
||||
tiers: [{ selector: {}, billingMode: "fixed_request", unitPriceMicrocredits: 0 }],
|
||||
});
|
||||
const perSecondConfig = systemConfig({
|
||||
tiers: [{ selector: {}, billingMode: "per_second", unitPriceMicrocredits: 0 }],
|
||||
});
|
||||
|
||||
expect(priceTierSummaryLabel(resolveModelChannel(fixedConfig, fixedConfig.model).modelCosts![0]!.logicalPriceTiers!)).toBe("0 积分");
|
||||
expect(priceTierSummaryLabel(resolveModelChannel(perSecondConfig, perSecondConfig.model).modelCosts![0]!.logicalPriceTiers!)).toBe("0 积分/秒");
|
||||
});
|
||||
|
||||
test("uses reference count and operation to avoid a text-video price tier", () => {
|
||||
const config = systemConfig({
|
||||
tiers: [
|
||||
|
||||
Reference in New Issue
Block a user