feat: 完善创作工作台与用户诊断支持 (#295)
* feat(canvas): 参考素材 - 增加移除按钮并删除对应连线 * feat(canvas): 完善节点面板交互与拖拽反馈 * fix(canvas): 画布交互与小地图 - 统一浮层层级并完善节点识别 * feat(prompt-optimizer): 增加 AI 提示词优化器及宿主接入 * feat(canvas): 画布 - 增加自动整理节点按钮并补充文档 * chore(web): 前端 - 修正提示词优化器格式 * chore(backend): 后端 - 修正 Go 格式检查 * feat(workspace): 完善诊断导出与本地排障支持 * chore(web): 格式化诊断导出文件 * fix(web-test): 兼容 Bun 测试运行时 * fix(web-test): 对齐模型目录协议断言
This commit is contained in:
1 parent
625a97560b
commit
cf6c78d540
70 files changed
+6863
-1708
No files matched your search
@@ -105,36 +105,14 @@ describe("public channel model catalog", () => {
|
||||
});
|
||||
});
|
||||
|
||||
test("treats endpoint-only video metadata as authoritative without inventing 720P", async () => {
|
||||
test("does not infer a protocol from endpoint-only video metadata", () => {
|
||||
const catalog: ChannelModelCatalogItem = {
|
||||
id: "endpoint-video",
|
||||
supportedEndpointTypes: ["openai-video"],
|
||||
};
|
||||
const config = configForCatalog([catalog], { videoSeconds: "6", size: "16:9", vquality: "720" });
|
||||
const model = "flow::endpoint-video";
|
||||
const cost = config.channels[0]!.modelCosts![0]!;
|
||||
|
||||
expect(cost.capability).toBe("video");
|
||||
expect(cost.protocol).toBe("newapi-channel-2");
|
||||
expect(cost.capabilityConfig?.video?.resolutions).toEqual([]);
|
||||
expect(cost.capabilityConfig?.video?.defaultResolution).toBe("");
|
||||
expect(selectableModelsByCapability(config, "video")).toEqual([model]);
|
||||
expect(resolveModelRequestConfig(config, model).interfaceType).toBe("newapi-channel-2");
|
||||
|
||||
const canvasHtml = renderToStaticMarkup(React.createElement(CanvasVideoSettingsPopover, { config, onConfigChange: () => undefined }));
|
||||
expect(canvasHtml).not.toContain("720P");
|
||||
|
||||
const createSource = await Bun.file(new URL("../src/pages/create/index.tsx", import.meta.url)).text();
|
||||
expect(createSource).toContain('const videoResolutionSupported = props.mode === "video" && resolutions.length > 0;');
|
||||
expect(createSource).toContain("...(videoResolutionSupported ? [videoResolutionLabel(props.videoQuality)] : [])");
|
||||
|
||||
let requestBody: Record<string, unknown> = {};
|
||||
axios.post = (async (_url: string, body: Record<string, unknown>) => {
|
||||
requestBody = body;
|
||||
return { data: { id: "endpoint-video-task" } };
|
||||
}) as typeof axios.post;
|
||||
await createVideoGenerationTask(config, "synthetic prompt");
|
||||
expect(requestBody).not.toHaveProperty("resolution");
|
||||
expect(config.channels[0]!.modelCosts).toEqual([]);
|
||||
});
|
||||
|
||||
test("preserves a manually configured capability profile when a catalog only returns an ID", () => {
|
||||
@@ -259,7 +237,7 @@ describe("public channel model catalog", () => {
|
||||
|
||||
const html = renderToStaticMarkup(React.createElement(CanvasVideoSettingsPopover, { config, onConfigChange: () => undefined }));
|
||||
|
||||
expect(html).toContain("横屏 · 10s");
|
||||
expect(html).toContain("16:9 · 10s");
|
||||
expect(html).not.toContain("720P");
|
||||
});
|
||||
|
||||
@@ -290,11 +268,7 @@ describe("public channel model catalog", () => {
|
||||
const normalized = normalizeConfigSnapshot({
|
||||
config: {
|
||||
...defaultConfig,
|
||||
channels: [
|
||||
platform,
|
||||
custom,
|
||||
createModelChannel({ id: "default", name: "默认渠道", apiKey: "", models: ["gpt-image-2"] }),
|
||||
],
|
||||
channels: [platform, custom, createModelChannel({ id: "default", name: "默认渠道", apiKey: "", models: ["gpt-image-2"] })],
|
||||
models: ["default::gpt-image-2", "ghost-image"],
|
||||
imageModels: ["default::gpt-image-2", "ghost-image"],
|
||||
imageModel: "default::gpt-image-2",
|
||||
@@ -302,10 +276,7 @@ describe("public channel model catalog", () => {
|
||||
}).config;
|
||||
const staleSnapshot = { ...normalized, models: [...normalized.models, "ghost-image"], imageModels: [...normalized.imageModels, "ghost-image"] };
|
||||
|
||||
expect(selectableModelsByCapability(staleSnapshot, "image")).toEqual([
|
||||
"public-logical-models::frontend-image",
|
||||
"custom-channel::custom-image-v1",
|
||||
]);
|
||||
expect(selectableModelsByCapability(staleSnapshot, "image")).toEqual(["public-logical-models::frontend-image", "custom-channel::custom-image-v1"]);
|
||||
expect(staleSnapshot.channels.some((channel) => channel.id === "default")).toBe(false);
|
||||
expect(selectableModelsByCapability(staleSnapshot, "image")).not.toContain("default::gpt-image-2");
|
||||
expect(selectableModelsByCapability(staleSnapshot, "image")).not.toContain("ghost-image");
|
||||
|
||||
@@ -178,7 +178,7 @@ test("Canvas task surfaces route Dreamina uncertainty through shared display sem
|
||||
expect(nodeSource).toContain("isGenerationTaskSubmissionUncertain(errorDisplayTask)");
|
||||
expect(taskCenterSource).toContain("if (currentTask && isGenerationTaskSubmissionUncertain(currentTask))");
|
||||
expect(taskCenterSource).toContain("不能自动重试;请先核对官方状态,避免重复生成");
|
||||
expect(taskCenterSource).toContain('onRetry={() => void runAction(task.id)}');
|
||||
expect(taskCenterSource).toContain("onRetry={() => void runAction(task.id)}");
|
||||
expect(taskCenterSource).toContain("<TaskListRow");
|
||||
expect(taskCenterSource).toContain("<TaskGridCard");
|
||||
expect(createSource).not.toContain('item.generationStage === "submission_unknown"');
|
||||
@@ -192,7 +192,7 @@ test("task center deletion accepts only local Dreamina records", async () => {
|
||||
const deleteActionSource = sourceSection(source, "const deleteLocalTask =", "const refreshLocalTaskStatus =");
|
||||
|
||||
expect(compactedSource).toMatch(/\{detailTask\.provider === "dreamina-cli" \? \( <Button .*?aria-label="删除本机记录".*?onClick=\{\(\) => deleteLocalTask\(detailTask\)\}> 删除本机记录 <\/Button> \) : null\}/);
|
||||
expect(compactedSource).toContain("任务已由官方接受;删除后仍会在后台同步官方状态。");
|
||||
expect(compactedSource).toContain("官方状态采用最终一致轮询;转入后台后仍会继续等待并同步官方状态。");
|
||||
expect(deleteActionSource).toContain("await deleteGenerationTask(task.id);");
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user