fix(*): 插件工作流 - 统一启停状态并闭环校验生成链路

This commit is contained in:
ddCat
2026-08-26 21:36:10 +08:00
parent 3a4a295523
commit c79e984bc3
23 changed files with 351 additions and 65 deletions

View File

@@ -10,7 +10,7 @@ function nodeCommand(type: CanvasNodeType, rest: Omit<AddNodeMenuCommand, "id" |
}
export const addNodeMenuCommands: AddNodeMenuCommand[] = [
// 项目级动作不占用节点网格,保证 8 个节点稳定保持四列两行。
// 项目级动作不占用节点网格,创作节点保持统一排列。
{ id: "style", label: "项目画风", icon: <Palette />, section: "project", defaultOrder: 10, applicable: (ctx) => !ctx.isProjectLinked, run: (ctx) => ctx.handlers.onChooseStyle() },
// 创作节点
nodeCommand(CanvasNodeType.Text, { defaultOrder: 10, run: (ctx) => ctx.handlers.onAddText() }),

View File

@@ -1,4 +1,6 @@
import { normalizeRunningHubCapability, type AiConfig, type RunningHubCapability, type RunningHubWorkflowKind, type WorkflowFieldMapping } from "@/stores/use-config-store";
import { workflowProviderPluginEnabled } from "@/lib/plugins/builtin/workflows";
import { usePluginStore } from "@/stores/use-plugin-store";
export type GenerationWorkflowMode = "text" | "image" | "video" | "audio";
@@ -23,6 +25,7 @@ export function resolveGenerationWorkflowExecution(config: AiConfig, mode: Gener
if (workflowProvider === "model") return null;
if (workflowProvider === "runninghub") {
if (!workflowProviderPluginEnabled(usePluginStore.getState().runtimeStatuses, "runninghub")) throw new Error("RunningHub 工作流插件未启用");
const runningHub = config.runningHub;
const workflowId = runningHub.workflowId.trim();
const kind = runningHub.selectedKind === "app" ? "app" : "workflow";
@@ -53,6 +56,7 @@ export function resolveGenerationWorkflowExecution(config: AiConfig, mode: Gener
};
}
if (!workflowProviderPluginEnabled(usePluginStore.getState().runtimeStatuses, "comfyui")) throw new Error("ComfyUI Bridge 工作流插件未启用");
const comfyBridge = config.comfyBridge;
const workflowId = comfyBridge.workflowId.trim();
if (!comfyBridge.enabled || !comfyBridge.bridgeId.trim() || !workflowId) {

View File

@@ -4,6 +4,16 @@ import { PLUGIN_API_VERSION, type PluginManifest, type RegisteredPlugin } from "
export const RUNNINGHUB_PLUGIN_ID = "runninghub-workflow-provider";
export const COMFYUI_PLUGIN_ID = "comfyui-workflow-provider";
export type WorkflowProvider = "runninghub" | "comfyui";
export function workflowPluginId(provider: WorkflowProvider) {
return provider === "runninghub" ? RUNNINGHUB_PLUGIN_ID : COMFYUI_PLUGIN_ID;
}
export function workflowProviderPluginEnabled(statuses: Record<string, string>, provider: WorkflowProvider) {
return statuses[workflowPluginId(provider)] === "enabled";
}
function workflowContributions(providerId: string, label: string) {
return (["image", "video", "audio"] as const).map((capability) => ({
id: `${providerId}-${capability}`,