mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
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:
@@ -26,6 +26,7 @@ export function AutomatePage() {
|
||||
processedSize: number;
|
||||
stepsCompleted: number;
|
||||
} | null>(null);
|
||||
const [executionError, setExecutionError] = useState<string | null>(null);
|
||||
|
||||
// Load saved pipelines
|
||||
const loadPipelines = useCallback(async () => {
|
||||
@@ -96,6 +97,7 @@ export function AutomatePage() {
|
||||
async (file: File) => {
|
||||
setExecuting(true);
|
||||
setExecutionResult(null);
|
||||
setExecutionError(null);
|
||||
try {
|
||||
const formData = new FormData();
|
||||
formData.append("file", file);
|
||||
@@ -123,9 +125,12 @@ export function AutomatePage() {
|
||||
processedSize: data.processedSize,
|
||||
stepsCompleted: data.stepsCompleted,
|
||||
});
|
||||
} else {
|
||||
const data = await res.json().catch(() => ({}));
|
||||
setExecutionError(data.error || `Pipeline failed with status ${res.status}`);
|
||||
}
|
||||
} catch {
|
||||
// Error handling
|
||||
setExecutionError("Connection error. Please try again.");
|
||||
} finally {
|
||||
setExecuting(false);
|
||||
}
|
||||
@@ -215,6 +220,7 @@ export function AutomatePage() {
|
||||
saving={saving}
|
||||
executing={executing}
|
||||
executionResult={executionResult}
|
||||
executionError={executionError}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user