feat(*): 生图与视频工作台 - 新增独立生成流程并整合平台配置
This commit is contained in:
1 parent
4c1d2b4012
commit
1f3f2c6020
69 files changed
+7108
-87
No files matched your search
@@ -2,6 +2,7 @@ import { expect, test } from "bun:test";
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
import { ModelLabel, ModelPicker } from "../src/components/model-picker";
|
||||
import { canvasThemes } from "../src/lib/canvas-theme";
|
||||
import { defaultModelCapabilityConfig } from "../src/lib/model-capabilities";
|
||||
import { requestCreditCost } from "../src/lib/model-pricing";
|
||||
import type { ModelRequirements } from "../src/lib/model-selection";
|
||||
import { createModelChannel, defaultConfig, normalizeConfigSnapshot } from "../src/stores/use-config-store";
|
||||
@@ -70,6 +71,35 @@ test("model rows preserve multiple promotional labels and colors without alterin
|
||||
expect(markup).not.toContain('aria-label="模型标签"');
|
||||
});
|
||||
|
||||
test("video capability tag is derived from limits and precedes editable model tags", () => {
|
||||
const config = fixture();
|
||||
const cost = config.channels[0].modelCosts![0];
|
||||
cost.capabilityConfig = defaultModelCapabilityConfig();
|
||||
Object.assign(cost.capabilityConfig.video!.references, { maxImages: 30, maxVideos: 10, maxAudios: 10 });
|
||||
cost.tags = [{ text: "限时特价", color: "purple" }, { text: "按次收费", color: "blue" }];
|
||||
|
||||
const markup = renderToStaticMarkup(<ModelLabel config={config} model={config.model} capability="video" theme={canvasThemes.light} creationVariant showConfiguredModelName={false} showPrice showDescription />);
|
||||
|
||||
expect(markup).toContain('data-color="green">图×30 · 视×10 · 音×10');
|
||||
expect(markup.indexOf("图×30 · 视×10 · 音×10")).toBeLessThan(markup.indexOf("限时特价"));
|
||||
expect(markup.indexOf("限时特价")).toBeLessThan(markup.indexOf("按次收费"));
|
||||
});
|
||||
|
||||
test("video capability tag omits zero limits while preserving editable model tags", () => {
|
||||
const config = fixture();
|
||||
const cost = config.channels[0].modelCosts![0];
|
||||
cost.capabilityConfig = defaultModelCapabilityConfig();
|
||||
Object.assign(cost.capabilityConfig.video!.references, { maxImages: 0, maxVideos: 0, maxAudios: 0 });
|
||||
cost.tags = [{ text: "按次收费", color: "blue" }];
|
||||
|
||||
const markup = renderToStaticMarkup(<ModelLabel config={config} model={config.model} capability="video" theme={canvasThemes.light} creationVariant showConfiguredModelName={false} showPrice showDescription />);
|
||||
|
||||
expect(markup).not.toContain("图×");
|
||||
expect(markup).not.toContain("视×");
|
||||
expect(markup).not.toContain("音×");
|
||||
expect(markup).toContain('data-color="blue">按次收费');
|
||||
});
|
||||
|
||||
test("the selected model and request estimate still require an exact specification match", () => {
|
||||
const config = fixture();
|
||||
const render = (value: ModelRequirements) => renderToStaticMarkup(<ModelPicker config={config} value={config.model} capability="video" requirements={value} onChange={() => {}} />);
|
||||
|
||||
Reference in new issue
Block a user