mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-18 19:43:22 +08:00
重构主控编排与运行时预热链路,统一工作区提示词/专家调度协议并补齐 wiki 记忆注入与写回闭环。
同时收敛启动与运维脚本默认行为(含 wiki worker)、更新 Admin 可观测性与相关测试,降低首轮时延并提高运行稳定性。 Made-with: Cursor
This commit is contained in:
parent
4a23b715a2
commit
dbbe3add6a
14438 changed files with 2693620 additions and 2546 deletions
94
openclaw/extensions/comfy/music-generation-provider.test.ts
Normal file
94
openclaw/extensions/comfy/music-generation-provider.test.ts
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
import { describe, expect, it, vi } from "vitest";
|
||||
import { expectExplicitMusicGenerationCapabilities } from "../../test/helpers/media-generation/provider-capability-assertions.js";
|
||||
import { buildComfyMusicGenerationProvider } from "./music-generation-provider.js";
|
||||
import { _setComfyFetchGuardForTesting } from "./workflow-runtime.js";
|
||||
|
||||
const { fetchWithSsrFGuardMock } = vi.hoisted(() => ({
|
||||
fetchWithSsrFGuardMock: vi.fn(),
|
||||
}));
|
||||
|
||||
describe("comfy music-generation provider", () => {
|
||||
it("registers the workflow model", () => {
|
||||
const provider = buildComfyMusicGenerationProvider();
|
||||
|
||||
expect(provider.defaultModel).toBe("workflow");
|
||||
expect(provider.models).toEqual(["workflow"]);
|
||||
expectExplicitMusicGenerationCapabilities(provider);
|
||||
});
|
||||
|
||||
it("runs a music workflow and returns audio outputs", async () => {
|
||||
_setComfyFetchGuardForTesting(fetchWithSsrFGuardMock);
|
||||
fetchWithSsrFGuardMock
|
||||
.mockResolvedValueOnce({
|
||||
response: new Response(JSON.stringify({ prompt_id: "music-job-1" }), {
|
||||
status: 200,
|
||||
headers: { "content-type": "application/json" },
|
||||
}),
|
||||
release: vi.fn(async () => {}),
|
||||
})
|
||||
.mockResolvedValueOnce({
|
||||
response: new Response(
|
||||
JSON.stringify({
|
||||
"music-job-1": {
|
||||
outputs: {
|
||||
"9": {
|
||||
audio: [{ filename: "song.mp3", subfolder: "", type: "output" }],
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
{
|
||||
status: 200,
|
||||
headers: { "content-type": "application/json" },
|
||||
},
|
||||
),
|
||||
release: vi.fn(async () => {}),
|
||||
})
|
||||
.mockResolvedValueOnce({
|
||||
response: new Response(Buffer.from("music-bytes"), {
|
||||
status: 200,
|
||||
headers: { "content-type": "audio/mpeg" },
|
||||
}),
|
||||
release: vi.fn(async () => {}),
|
||||
});
|
||||
|
||||
const provider = buildComfyMusicGenerationProvider();
|
||||
const result = await provider.generateMusic({
|
||||
provider: "comfy",
|
||||
model: "workflow",
|
||||
prompt: "gentle ambient synth loop",
|
||||
cfg: {
|
||||
models: {
|
||||
providers: {
|
||||
comfy: {
|
||||
music: {
|
||||
workflow: {
|
||||
"6": { inputs: { text: "" } },
|
||||
"9": { inputs: {} },
|
||||
},
|
||||
promptNodeId: "6",
|
||||
outputNodeId: "9",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
} as never,
|
||||
});
|
||||
|
||||
expect(result).toMatchObject({
|
||||
model: "workflow",
|
||||
tracks: [
|
||||
{
|
||||
mimeType: "audio/mpeg",
|
||||
fileName: "song.mp3",
|
||||
},
|
||||
],
|
||||
metadata: {
|
||||
promptId: "music-job-1",
|
||||
outputNodeIds: ["9"],
|
||||
inputImageCount: 0,
|
||||
},
|
||||
});
|
||||
expect(result.tracks[0]?.buffer).toEqual(Buffer.from("music-bytes"));
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue