Bots can now make images and short clips on the user's own GPU server and rework images locally, through the media job runtime. - generate_image: prompt, aspect preset or exact size, up to 4 images, optional source image for image-to-image. Sizes target what the default models are tuned for, and sources are fitted to that size before upload, so large photos cannot exhaust GPU memory. - generate_video: prompt, aspect, duration up to 10 s, optional start frame. - edit_image: crop, rotate, flip, resize to a size or format (crop, pad or blurred background), extend, convert, in that order, with sharp; an optional prompt repaints the result on ComfyUI. Edits keep the source as parent. - Registrations declare the input artifacts so jobs refuse ones the user cannot read, and generation declares a fixed GPU memory floor (6 GB images, 12 GB video) that a custom workflow cannot lower. - Tool definitions reuse the operation input schemas plus continue_after. - Saving media settings rejects custom workflows the provider could not fill. - Tests: sharp edits on generated fixtures, handlers against the ComfyUI emulator, and a PostgreSQL suite running the operations through the media runtime (card outputs, artifact versions, foreign artifacts, GPU wait). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MRtGG9ARfqqhma3t85Ro2u
29 lines
988 B
TypeScript
29 lines
988 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { saveMediaSettings } from "../media-settings.js";
|
|
|
|
const comfyui = (workflows: { imageWorkflow?: string; videoWorkflow?: string }) => ({
|
|
comfyui: { baseUrl: "http://127.0.0.1:8188", ...workflows },
|
|
transcription: null,
|
|
});
|
|
|
|
describe("ComfyUI settings", () => {
|
|
it("refuses custom workflows the provider could not fill", async () => {
|
|
const deps = {} as Parameters<typeof saveMediaSettings>[0];
|
|
await expect(
|
|
saveMediaSettings(
|
|
deps,
|
|
comfyui({ imageWorkflow: '{"1": {"class_type": "X", "inputs": {}}}' }),
|
|
),
|
|
).rejects.toThrow("Image workflow: Workflow needs a {{prompt}} placeholder");
|
|
await expect(
|
|
saveMediaSettings(
|
|
deps,
|
|
comfyui({
|
|
videoWorkflow:
|
|
'{"1": {"class_type": "X", "inputs": {"t": "{{prompt}}", "c": "{{cfg}}"}}}',
|
|
}),
|
|
),
|
|
).rejects.toThrow("Video workflow: Unknown workflow placeholders: {{cfg}}");
|
|
});
|
|
});
|