feat(workflows): import preflight, real test runs and media groups (HEL-643)

- L2 连接核查: /object_info preflight (node existence + combo values) with
  5-min cache + manual refresh; analyze accepts endpoint_id, saved workflows
  get POST /{id}/check; unreachable degrades to 无法核查, never blocks saving
- 测试工作流: jobs.origin='workflow_test' rides the real queue → ComfyUI →
  outputs pipeline; only a downloadable, correctly-typed output counts as a
  pass; dry-run refused; repeat clicks reuse the in-flight job; artifacts
  isolated under assets/_workflow_test/{id}; retention keeps newest 5;
  clear-tests + delete-workflow cascade cleanup; tasks page shows a 测试 badge
- Media groups: Autogrow detection generalized to video/audio lists
  (ref_videos/ref_audios etc.), patcher clones/rewires per media family,
  validation per list kind; entries appear only for actually-wired slots;
  MiniMax H3 Ref2VA official-limit hints keyed off the node class
- 25 new backend tests (preflight / workflow-test / media-groups) against the
  fake ComfyUI; fake server gains /object_info + drop_outputs knobs

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
总工
2026-09-29 19:07:20 +08:00
co-authored by multica-agent
parent 319c7b049b
commit 2ed9d25c24
32 changed files with 3220 additions and 198 deletions
+43 -2
View File
@@ -138,6 +138,8 @@ import type {
ComfyDynamicInput,
ComfyDynamicOutput,
WorkflowOutputMapEntry,
WorkflowConnectionCheck,
WorkflowLastTest,
} from "./comfy/types";
export type {
Job,
@@ -150,6 +152,8 @@ export type {
ComfyDynamicInput,
ComfyDynamicOutput,
WorkflowOutputMapEntry,
WorkflowConnectionCheck,
WorkflowLastTest,
};
async function api<T>(path: string, init?: RequestInit): Promise<T> {
@@ -458,13 +462,50 @@ export const comfy = {
export const workflows = {
list: () => api<Workflow[]>("/api/workflows"),
analyze: (workflow_json: Record<string, unknown>) =>
analyze: (
workflow_json: Record<string, unknown>,
endpoint_id?: string | null,
refresh = false,
) =>
api<WorkflowAnalyzeResult>("/api/workflows/analyze", {
method: "POST",
body: JSON.stringify({ workflow_json }),
body: JSON.stringify({
workflow_json,
...(endpoint_id ? { endpoint_id } : {}),
...(refresh ? { refresh } : {}),
}),
}),
reanalyze: (id: number) =>
api<Workflow>(`/api/workflows/${id}/reanalyze`, { method: "POST" }),
/** L2 re-check against a live ComfyUI (HEL-643): node/model availability. */
check: (
id: number,
payload?: { endpoint_id?: string | null; refresh?: boolean },
) =>
api<WorkflowConnectionCheck>(`/api/workflows/${id}/check`, {
method: "POST",
body: JSON.stringify(payload ?? {}),
}),
/** Launch (or re-attach to) one REAL test run (HEL-643 L3). */
test: (
id: number,
payload: {
endpoint_id?: string | null;
input_values?: Record<string, unknown>;
},
) =>
api<{ ok: boolean; job: Job; reused: boolean }>(
`/api/workflows/${id}/test`,
{
method: "POST",
body: JSON.stringify(payload),
},
),
tests: (id: number) => api<Job[]>(`/api/workflows/${id}/tests`),
clearTests: (id: number) =>
api<{ ok: boolean; removed: number }>(`/api/workflows/${id}/clear-tests`, {
method: "POST",
}),
create: (payload: {
name: string;
workflow_json: Record<string, unknown>;