fix: pipeline only shows compatible tools and displays errors

The pipeline tool picker was showing all tools, but only tools
registered via createToolRoute() support pipeline execution. Tools
with custom routes (remove-background, upscale, ocr, etc.) would
silently fail with "Tool not found" and the empty catch block hid
the error from users.

Add GET /api/v1/pipeline/tools endpoint that returns the IDs of
pipeline-compatible tools. The frontend fetches this list and filters
the tool picker accordingly. Also surface pipeline execution errors
in the UI instead of swallowing them.
This commit is contained in:
Siddharth Kumar Sah
2026-03-28 14:38:48 +08:00
parent 1703dcbcfe
commit 0410bf3461
4 changed files with 47 additions and 3 deletions
+11 -1
View File
@@ -17,7 +17,7 @@ import { validateImageBuffer } from "../lib/file-validation.js";
import { sanitizeFilename } from "../lib/filename.js";
import { createWorkspace } from "../lib/workspace.js";
import { requireAuth } from "../plugins/auth.js";
import { getToolConfig } from "./tool-factory.js";
import { getRegisteredToolIds, getToolConfig } from "./tool-factory.js";
/** Schema for a single pipeline step. */
const pipelineStepSchema = z.object({
@@ -312,5 +312,15 @@ export async function registerPipelineRoutes(app: FastifyInstance): Promise<void
},
);
/**
* GET /api/v1/pipeline/tools
*
* Returns the IDs of tools that can be used as pipeline steps.
* Only tools registered via createToolRoute() support pipeline execution.
*/
app.get("/api/v1/pipeline/tools", async (_request: FastifyRequest, reply: FastifyReply) => {
return reply.send({ toolIds: getRegisteredToolIds() });
});
app.log.info("Pipeline routes registered");
}
+8
View File
@@ -48,6 +48,14 @@ export function getToolConfig(toolId: string): AnyToolRouteConfig | undefined {
return toolRegistry.get(toolId);
}
/**
* Return the IDs of all tools registered via createToolRoute().
* These are the tools that can be used in pipelines and batch processing.
*/
export function getRegisteredToolIds(): string[] {
return [...toolRegistry.keys()];
}
/**
* Factory that registers a POST /api/v1/tools/:toolId route.
*