fix(runtime): 运行稳定性 - 修复技能种子、任务续租与回归检查
保留社区技能作者与时间戳修复、Agent 参数约束、资源删除 worker 生命周期、PostgreSQL/Redis 测试门禁及相关回归。 Original-Commit: 0d05ff88bbe6c875d01964041788023a662ff7e8
This commit is contained in:
@@ -18,9 +18,14 @@ export function creationVideoConfig(config: AiConfig, model: string, settings: P
|
||||
size: normalized.ratio,
|
||||
videoSeconds: normalized.seconds,
|
||||
vquality: normalized.resolution.replace(/p$/i, ""),
|
||||
...resolveModelVideoBooleanOptions(config, model, {}, {
|
||||
videoGenerateAudio: config.videoGenerateAudio,
|
||||
videoWatermark: config.videoWatermark,
|
||||
}),
|
||||
...resolveModelVideoBooleanOptions(
|
||||
config,
|
||||
model,
|
||||
{},
|
||||
{
|
||||
videoGenerateAudio: config.videoGenerateAudio,
|
||||
videoWatermark: config.videoWatermark,
|
||||
},
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -15,11 +15,18 @@ function videoConfig(generateAudio: { supported: boolean; default: boolean }): A
|
||||
videoModel: "gravity::minimax-h3-a",
|
||||
videoGenerateAudio: "true",
|
||||
videoWatermark: "true",
|
||||
channels: [{
|
||||
id: "gravity", name: "万有引力", baseUrl: "/api", apiKey: "", apiFormat: "openai", scope: "system",
|
||||
models: ["minimax-h3-a"],
|
||||
modelCosts: [{ model: "minimax-h3-a", capability: "video", billingMode: "per_second", unitPriceMicrocredits: 1, capabilityConfig }],
|
||||
}],
|
||||
channels: [
|
||||
{
|
||||
id: "gravity",
|
||||
name: "万有引力",
|
||||
baseUrl: "/api",
|
||||
apiKey: "",
|
||||
apiFormat: "openai",
|
||||
scope: "system",
|
||||
models: ["minimax-h3-a"],
|
||||
modelCosts: [{ model: "minimax-h3-a", capability: "video", billingMode: "per_second", unitPriceMicrocredits: 1, capabilityConfig }],
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
|
||||
import { FloatingDock } from "../src/components/ui/aceternity/floating-dock";
|
||||
|
||||
// 指针能力探测是纯增强:`window` 存在不代表 `matchMedia` 存在(SSR 垫片、嵌入式 webview、
|
||||
// 部分 DOM polyfill 下它是 undefined),而 FloatingDock 在**渲染期**就取
|
||||
@@ -15,4 +18,17 @@ describe("floating dock pointer capability probe", () => {
|
||||
expect(source).not.toMatch(/window\.matchMedia\("\(pointer: coarse\)"\)\.matches/);
|
||||
expect(source).not.toMatch(/const media = window\.matchMedia/);
|
||||
});
|
||||
|
||||
test("renders the real dock with a window shim lacking matchMedia", () => {
|
||||
const original = Object.getOwnPropertyDescriptor(globalThis, "window");
|
||||
try {
|
||||
Object.defineProperty(globalThis, "window", { configurable: true, value: new EventTarget() });
|
||||
const markup = renderToStaticMarkup(<FloatingDock items={[{ id: "probe", label: "操作", icon: <span>+</span> }]} />);
|
||||
expect(markup).toContain("操作");
|
||||
expect(markup).toContain("button");
|
||||
} finally {
|
||||
if (original) Object.defineProperty(globalThis, "window", original);
|
||||
else Reflect.deleteProperty(globalThis, "window");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -8,16 +8,31 @@ import { createModelChannel, defaultConfig, normalizeConfigSnapshot } from "../s
|
||||
|
||||
function fixture() {
|
||||
const channel = createModelChannel({
|
||||
id: "comfy", name: "Comfy", scope: "system", models: ["h3-multi"],
|
||||
modelCosts: [{
|
||||
model: "h3-multi", displayName: "MiniMax H3", channelLabel: "多图一致性", capability: "video",
|
||||
pricePolicy: "channel", billingMode: "per_second", unitPriceMicrocredits: 100_000,
|
||||
logicalPriceTiers: [480, 720].map((resolution, index) => ({
|
||||
selector: { vquality: resolution + "p", videoSeconds: "6" }, resolution: resolution + "p", videoSeconds: 6,
|
||||
billingMode: "per_second", unitPriceMicrocredits: (index + 1) * 100_000,
|
||||
inputTokenPriceMicrocredits: 0, outputTokenPriceMicrocredits: 0, cachedTokenPriceMicrocredits: 0,
|
||||
})),
|
||||
}],
|
||||
id: "comfy",
|
||||
name: "Comfy",
|
||||
scope: "system",
|
||||
models: ["h3-multi"],
|
||||
modelCosts: [
|
||||
{
|
||||
model: "h3-multi",
|
||||
displayName: "MiniMax H3",
|
||||
channelLabel: "多图一致性",
|
||||
capability: "video",
|
||||
pricePolicy: "channel",
|
||||
billingMode: "per_second",
|
||||
unitPriceMicrocredits: 100_000,
|
||||
logicalPriceTiers: [480, 720].map((resolution, index) => ({
|
||||
selector: { vquality: resolution + "p", videoSeconds: "6" },
|
||||
resolution: resolution + "p",
|
||||
videoSeconds: 6,
|
||||
billingMode: "per_second",
|
||||
unitPriceMicrocredits: (index + 1) * 100_000,
|
||||
inputTokenPriceMicrocredits: 0,
|
||||
outputTokenPriceMicrocredits: 0,
|
||||
cachedTokenPriceMicrocredits: 0,
|
||||
})),
|
||||
},
|
||||
],
|
||||
});
|
||||
return normalizeConfigSnapshot({ config: { ...defaultConfig, channels: [channel], model: "comfy::h3-multi", videoModel: "comfy::h3-multi" } }).config;
|
||||
}
|
||||
@@ -27,8 +42,7 @@ const requirements: ModelRequirements = { capability: "video", videoSeconds: "5"
|
||||
test("candidate rows show their configured prices instead of applying the previous model's specifications", () => {
|
||||
const config = fixture();
|
||||
for (const theme of [canvasThemes.light, canvasThemes.dark]) {
|
||||
const markup = renderToStaticMarkup(<ModelLabel config={config} model={config.model} capability="video" theme={theme}
|
||||
creationVariant showConfiguredModelName={false} requirements={requirements} showPrice showDescription />);
|
||||
const markup = renderToStaticMarkup(<ModelLabel config={config} model={config.model} capability="video" theme={theme} creationVariant showConfiguredModelName={false} requirements={requirements} showPrice showDescription />);
|
||||
expect(markup).toContain("0.1-0.2 积分/秒");
|
||||
expect(markup).not.toContain("当前规格无报价");
|
||||
}
|
||||
@@ -37,19 +51,16 @@ test("candidate rows show their configured prices instead of applying the previo
|
||||
test("candidate rows do not disguise missing prices as zero", () => {
|
||||
const config = fixture();
|
||||
config.channels[0].modelCosts![0].logicalPriceTiers = [];
|
||||
const markup = renderToStaticMarkup(<ModelLabel config={config} model={config.model} capability="video" theme={canvasThemes.dark}
|
||||
creationVariant showConfiguredModelName={false} requirements={requirements} showPrice showDescription />);
|
||||
const markup = renderToStaticMarkup(<ModelLabel config={config} model={config.model} capability="video" theme={canvasThemes.dark} creationVariant showConfiguredModelName={false} requirements={requirements} showPrice showDescription />);
|
||||
expect(markup).toContain("未配置");
|
||||
expect(markup).not.toContain("0 积分");
|
||||
});
|
||||
|
||||
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={() => {}} />);
|
||||
const render = (value: ModelRequirements) => renderToStaticMarkup(<ModelPicker config={config} value={config.model} capability="video" requirements={value} onChange={() => {}} />);
|
||||
expect(render(requirements)).toContain("当前规格无报价");
|
||||
const cost = (value: ModelRequirements) => requestCreditCost({ channelMode: "remote", modelCosts: config.channels[0].modelCosts,
|
||||
model: "h3-multi", capability: "video", config, requirements: value, seconds: "6" });
|
||||
const cost = (value: ModelRequirements) => requestCreditCost({ channelMode: "remote", modelCosts: config.channels[0].modelCosts, model: "h3-multi", capability: "video", config, requirements: value, seconds: "6" });
|
||||
expect(cost(requirements)).toBeNull();
|
||||
const matching = { ...requirements, videoSeconds: "6", options: { vquality: "720p" } };
|
||||
expect(render(matching)).toContain("0.2 积分/秒");
|
||||
|
||||
Reference in New Issue
Block a user