Comfy-Org / Comfy-Org/ComfyUI_frontend

feat: add missing template dialog fields to hub workflows API

Open
#10,709 5 comments 0 reactions 1 assignee Claimed by @dante01yoon View on GitHub
area:templates enhancement Public API
Dominant language
TypeScript
Stars
2k
Forks
702
Avg merge
1d 8h
Merged PRs (30d)
512

Description

## Problem

PR #10675 integrates the template dialog with the hub workflows API (`/api/hub/workflows`) as discussed — not the index API. However, the workflows API is missing several fields that the template dialog requires for filtering, sorting, and display.

## Context

- **Slack discussion**: https://comfy-organization.slack.com/archives/C0AEPRS8N74/p1774769772557519
- **Frontend PR (will not merge as-is)**: https://github.com/Comfy-Org/ComfyUI_frontend/pull/10675
- **Prior discussion where workflows API was chosen over index API**: https://comfy-organization.slack.com/archives/C0AEPRS8N74/p1774570649286529?thread_ts=1774558375.281259&cid=C0AEPRS8N74

The FE is already designed to consume the workflows API directly. The schema differences (snake_case, `LabelRef[]` vs `string[]`, nested `metadata` vs flat fields) can be handled by refactoring the FE `TemplateInfo` type to align with the API spec — no legacy `index.json` contract preservation needed.

The blocking issue is that the workflows API is **missing fields** the template dialog depends on.

## Missing fields in `/api/hub/workflows`

### Used in template dialog UI

| Field | Type | Used for |
|---|---|---|
| `usage` | `number` | "Popular" and "Recommended" sort |
| `searchRank` | `number` | "Recommended" sort weighting (manual boost 1-10) |
| `isEssential` | `boolean` | "Essential" section in template dialog |
| `includeOnDistributions` | `string[]` | Distribution-specific visibility (cloud/local/desktop) |
| `logos` | `object[]` | Thumbnail logo overlays |

### Used in telemetry (existing gap — never populated in `index.json` either)

| Field | Type | Used for |
|---|---|---|
| `useCase` | `string` | `template_use_case` in execution telemetry |
| `license` | `string` | `template_license` in execution telemetry |

These two fields are referenced in `getExecutionContext.ts` but were never populated in the static `index.json`. This is a pre-existing data gap that should be addressed when adding fields to the workflows API.

### category mapper.
See https://github.com/Comfy-Org/ComfyUI_frontend/issues/10709#issuecomment-4241898225

## Existing fields (schema adaptation only — FE can handle)

These fields exist in the workflows API but in a different shape. The FE will refactor to consume them natively:

| Workflows API | Current FE (`TemplateInfo`) | Adaptation |
|---|---|---|
| `snake_case` fields | `camelCase` fields | FE refactors types |
| `tags: LabelRef[]` | `tags: string[]` | FE extracts `display_name` |
| `models: LabelRef[]` | `models: string[]` | FE extracts `display_name` |
| `metadata.vram` | `vram: number` | FE reads from metadata |
| `metadata.size` | `size: number` | FE reads from metadata |
| `metadata.open_source` | `openSource: boolean` | FE reads from metadata |

## Proposed path

1. **BE**: Add missing fields to the workflows API response (or make them available via `metadata`)
2. **FE**: Refactor `TemplateInfo` to align with the workflows API spec natively — no adapter, no legacy `index.json` contract

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.