fix(web): 模型价格 - 修复零积分显示为未配置

This commit is contained in:
MasterChiefCN
2026-09-01 17:40:24 +08:00
parent 70d272853e
commit 1cd9b296e4
5 changed files with 62 additions and 29 deletions

View File

@@ -1,6 +1,6 @@
import { expect, test } from "bun:test";
import { defaultConfig } from "../src/stores/use-config-store";
import { createModelChannel, defaultConfig } from "../src/stores/use-config-store";
import { runBackendGenerationTask, runBackendGenerationTaskBatch } from "../src/services/api/generation-task";
import { deleteGenerationTask, formatTaskLog, listGenerationTasks, projectBackendSafeTaskLog, splitGenerationTaskObservationIds, type GenerationTask } from "../src/services/api/task-center";
import { isLocalDreaminaBackgroundTask, localDreaminaCancellationCopy, localDreaminaDetachOutcome, projectLocalDreaminaTask } from "../src/services/local-dreamina-task-projection";
@@ -24,6 +24,28 @@ function sourceSection(source: string, startMarker: string, endMarker: string) {
return compactSource(source.slice(start, end));
}
function backendModelConfig(model: string) {
const channel = createModelChannel({
id: "system-test-channel",
name: "系统测试渠道",
baseUrl: "/api/system-test-channel",
apiKey: "system",
apiFormat: "openai",
scope: "system",
models: [model],
});
const selectedModel = `${channel.id}::${model}`;
return {
...defaultConfig,
channelMode: "remote" as const,
channels: [channel],
model: selectedModel,
imageModel: selectedModel,
videoModel: selectedModel,
audioModel: selectedModel,
};
}
test("Dreamina submit failure categories have bounded user-facing messages", () => {
const cases = [
["dreamina_submit_spawn_failed", "无法启动官方即梦 CLI,任务尚未提交。"],
@@ -1286,7 +1308,7 @@ test("remote provider keeps Create resolution semantics and still creates one Ba
{
mode: "video",
prompt: "A remote test clip",
config: { ...defaultConfig, model: "default::grok-imagine-video", vquality: "720", quality: "auto" },
config: { ...backendModelConfig("grok-imagine-video"), vquality: "720", quality: "auto" },
},
{
createTask: async (input) => {
@@ -1354,7 +1376,7 @@ test("remote image video and audio references keep Backend parity without Dreami
{
mode: item.mode,
prompt: "Remote parity fixture",
config: { ...defaultConfig, model: "default::provider-neutral-model" },
config: backendModelConfig("provider-neutral-model"),
...item.references,
},
{
@@ -1673,7 +1695,7 @@ test("Create audio upload converts, previews, removes, and submits through the s
projectId: running.projectId,
mode: "video",
prompt: running.prompt,
config: { ...defaultConfig, model: "remote-video-audio-fixture", videoModel: "remote-video-audio-fixture" },
config: backendModelConfig("remote-video-audio-fixture"),
...references,
} as Parameters<typeof runBackendGenerationTask>[0],
{