fix(create): 参考内容 - 支持添加、独立删除与筛选管理
- 支持参考内容按稳定 ID 删除、筛选、清空、拖拽与触屏交互 - 保留 Vite 生产环境模型 Logo 加载并兼容 Bun 测试 - 同步最新 main,修正相关格式和陈旧测试断言 Co-authored-by: echoD886 <dingxiaojie66@gmail.com>
This commit is contained in:
@@ -15,22 +15,24 @@ function systemConfig(input: { capability?: "image" | "video"; logicalModelId?:
|
||||
apiKey: "system",
|
||||
apiFormat: "openai",
|
||||
models: [model],
|
||||
modelCosts: [{
|
||||
model,
|
||||
capability,
|
||||
pricePolicy: "channel",
|
||||
billingMode: input.tiers[0]?.billingMode || "fixed_request",
|
||||
unitPriceMicrocredits: input.tiers[0]?.unitPriceMicrocredits || 0,
|
||||
logicalModelId: input.logicalModelId,
|
||||
logicalPriceTiers: input.tiers.map((tier) => ({
|
||||
...tier,
|
||||
resolution: tier.selector.vquality || "*",
|
||||
videoSeconds: Number(tier.selector.videoSeconds || 0),
|
||||
inputTokenPriceMicrocredits: 0,
|
||||
outputTokenPriceMicrocredits: 0,
|
||||
cachedTokenPriceMicrocredits: 0,
|
||||
})),
|
||||
}],
|
||||
modelCosts: [
|
||||
{
|
||||
model,
|
||||
capability,
|
||||
pricePolicy: "channel",
|
||||
billingMode: input.tiers[0]?.billingMode || "fixed_request",
|
||||
unitPriceMicrocredits: input.tiers[0]?.unitPriceMicrocredits || 0,
|
||||
logicalModelId: input.logicalModelId,
|
||||
logicalPriceTiers: input.tiers.map((tier) => ({
|
||||
...tier,
|
||||
resolution: tier.selector.vquality || "*",
|
||||
videoSeconds: Number(tier.selector.videoSeconds || 0),
|
||||
inputTokenPriceMicrocredits: 0,
|
||||
outputTokenPriceMicrocredits: 0,
|
||||
cachedTokenPriceMicrocredits: 0,
|
||||
})),
|
||||
},
|
||||
],
|
||||
});
|
||||
return normalizeConfigSnapshot({
|
||||
config: {
|
||||
@@ -66,15 +68,17 @@ describe("model request pricing", () => {
|
||||
});
|
||||
const channel = resolveModelChannel(config, config.model);
|
||||
|
||||
expect(requestCreditCost({
|
||||
channelMode: "remote",
|
||||
modelCosts: channel.modelCosts,
|
||||
model: "agnes-video-2.5",
|
||||
capability: "video",
|
||||
config,
|
||||
requirements: textVideoRequirements,
|
||||
seconds: "5",
|
||||
})).toBe(0.125);
|
||||
expect(
|
||||
requestCreditCost({
|
||||
channelMode: "remote",
|
||||
modelCosts: channel.modelCosts,
|
||||
model: "agnes-video-2.5",
|
||||
capability: "video",
|
||||
config,
|
||||
requirements: textVideoRequirements,
|
||||
seconds: "5",
|
||||
}),
|
||||
).toBe(0.125);
|
||||
});
|
||||
|
||||
test("uses reference count and operation to avoid a text-video price tier", () => {
|
||||
@@ -101,15 +105,17 @@ describe("model request pricing", () => {
|
||||
});
|
||||
const channel = resolveModelChannel(config, config.model);
|
||||
|
||||
expect(requestCreditCost({
|
||||
channelMode: "remote",
|
||||
modelCosts: channel.modelCosts,
|
||||
model: "image-model",
|
||||
capability: "image",
|
||||
config,
|
||||
requirements: { capability: "image" },
|
||||
count: 3,
|
||||
})).toBe(0.03);
|
||||
expect(
|
||||
requestCreditCost({
|
||||
channelMode: "remote",
|
||||
modelCosts: channel.modelCosts,
|
||||
model: "image-model",
|
||||
capability: "image",
|
||||
config,
|
||||
requirements: { capability: "image" },
|
||||
count: 3,
|
||||
}),
|
||||
).toBe(0.03);
|
||||
});
|
||||
|
||||
test("builds a logical-model quote using the normalized current request", () => {
|
||||
|
||||
Reference in New Issue
Block a user