|
| 1 | +--- |
| 2 | +name: add-model-page |
| 3 | +description: 'add, update, or remove a model page entry on the comfy org website. creates a PR to Comfy-Org/ComfyUI_frontend apps/website folder with the change and posts a Vercel preview link back to Slack.' |
| 4 | +--- |
| 5 | + |
| 6 | +# add-model-page |
| 7 | + |
| 8 | +add, update, or remove model pages in the ComfyUI website. |
| 9 | + |
| 10 | +## Trigger phrases |
| 11 | + |
| 12 | +- `Add a model page for <model-name>` |
| 13 | +- `Update the model page for <model-name>` |
| 14 | +- `Remove <model-name> from model pages` |
| 15 | + |
| 16 | +## Phase 1 — Parse the request |
| 17 | + |
| 18 | +Extract: |
| 19 | + |
| 20 | +- **action**: `add` | `update` | `remove` |
| 21 | +- **model-name**: raw string (e.g. `flux1-schnell`, `flux1_dev.safetensors`) |
| 22 | + |
| 23 | +Normalize to a slug: lowercase, replace `_` and `.` with `-`, strip file extensions. |
| 24 | +Example: `flux1_dev.safetensors` → `flux1-dev` |
| 25 | + |
| 26 | +## Architecture overview |
| 27 | + |
| 28 | +Models come from two sources merged at build time: |
| 29 | + |
| 30 | +| File | Purpose | |
| 31 | +| ----------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | |
| 32 | +| `apps/website/src/config/generated-models.json` | Auto-generated from workflow_templates (slug, name, directory, huggingFaceUrl, workflowCount, displayName, thumbnailUrl, docsUrl) | |
| 33 | +| `apps/website/src/config/model-metadata.ts` | Hand-curated overrides (docsUrl, blogUrl, featured) — only add entries that need overrides | |
| 34 | +| `apps/website/src/config/models.ts` | Merges the two above; exports typed `Model[]` | |
| 35 | + |
| 36 | +To regenerate the JSON from workflow_templates: |
| 37 | + |
| 38 | +```bash |
| 39 | +pnpm tsx apps/website/scripts/generate-models.ts |
| 40 | +``` |
| 41 | + |
| 42 | +This writes `apps/website/src/config/generated-models.json` directly. |
| 43 | +Thumbnails are populated from local `.webp` files in `workflow_templates/templates/` — no network access needed. |
| 44 | + |
| 45 | +--- |
| 46 | + |
| 47 | +## Phase 2 — Gather model data (ADD / UPDATE) |
| 48 | + |
| 49 | +Run the generator to get fresh data, then find the model: |
| 50 | + |
| 51 | +```bash |
| 52 | +pnpm tsx apps/website/scripts/generate-models.ts |
| 53 | +jq '.[] | select(.slug | contains("MODEL_SLUG"))' \ |
| 54 | + apps/website/src/config/generated-models.json |
| 55 | +``` |
| 56 | + |
| 57 | +The JSON fields are: |
| 58 | + |
| 59 | +- `slug` — URL slug |
| 60 | +- `name` — exact filename or display name for partner nodes |
| 61 | +- `huggingFaceUrl` — download URL (empty for partner nodes) |
| 62 | +- `directory` — `diffusion_models` | `loras` | … | `partner_nodes` |
| 63 | +- `workflowCount` — integer |
| 64 | +- `displayName` — human-readable name |
| 65 | + |
| 66 | +If no match and it is a known API/partner model, add it to `API_PROVIDER_MAP` in |
| 67 | +`generate-models.ts` and re-run. Otherwise tell the user. |
| 68 | + |
| 69 | +--- |
| 70 | + |
| 71 | +## Phase 3 — Check for existing entry |
| 72 | + |
| 73 | +```bash |
| 74 | +jq --arg slug "${SLUG}" '.[] | select(.slug == $slug)' \ |
| 75 | + apps/website/src/config/generated-models.json |
| 76 | +``` |
| 77 | + |
| 78 | +- Match found + action is `add` → switch to UPDATE flow automatically |
| 79 | +- No match + action is `update` → stop and tell the user |
| 80 | + |
| 81 | +--- |
| 82 | + |
| 83 | +## Phase 4A — ADD: new partner/API model not in workflow_templates |
| 84 | + |
| 85 | +For partner nodes (no local file), add an entry to `API_PROVIDER_MAP` in |
| 86 | +`apps/website/scripts/generate-models.ts`: |
| 87 | + |
| 88 | +```typescript |
| 89 | +mymodel: { name: 'My Model', slug: 'my-model' }, |
| 90 | +``` |
| 91 | + |
| 92 | +Then re-run `pnpm tsx apps/website/scripts/generate-models.ts` — it will appear |
| 93 | +in `generated-models.json` automatically. |
| 94 | + |
| 95 | +If you also want a `docsUrl`, `blogUrl`, or a link to the hub model page, add an entry to `model-metadata.ts`: |
| 96 | + |
| 97 | +```typescript |
| 98 | +'my-model': { |
| 99 | + docsUrl: 'https://docs.comfy.org/tutorials/...', |
| 100 | + blogUrl: 'https://blog.comfy.org/...', |
| 101 | + hubSlug: 'my-model', // slug at comfy.org/workflows/model/{hubSlug} — only set if the page exists (returns 200) |
| 102 | + featured: true |
| 103 | +} |
| 104 | +``` |
| 105 | + |
| 106 | +No changes to `models.ts` or `translations.ts` are needed. |
| 107 | + |
| 108 | +--- |
| 109 | + |
| 110 | +## Phase 4B — UPDATE: edit existing entry |
| 111 | + |
| 112 | +Only `model-metadata.ts` needs editing for most updates (docsUrl, blogUrl, |
| 113 | +featured). For `displayName` or `directory` changes, edit the entry directly in |
| 114 | +`generated-models.json` (until the next generator run would overwrite it — then |
| 115 | +fix the source in `generate-models.ts`). |
| 116 | + |
| 117 | +--- |
| 118 | + |
| 119 | +## Phase 4C — REMOVE: delete entry |
| 120 | + |
| 121 | +Remove the entry from `generated-models.json` (or mark it with `canonicalSlug` |
| 122 | +pointing to the replacement). No translation file changes needed. |
| 123 | + |
| 124 | +--- |
| 125 | + |
| 126 | +## Phase 5 — Verify TypeScript |
| 127 | + |
| 128 | +```bash |
| 129 | +pnpm typecheck 2>&1 | grep -E "error|warning" | head -20 |
| 130 | +``` |
| 131 | + |
| 132 | +Fix any type errors before proceeding. Common issues: |
| 133 | + |
| 134 | +- `ModelDirectory` type not matching a new `directory` value — add it to the union |
| 135 | +- JSON import shape mismatch — `generated-models.json` must match `OutputModel` |
| 136 | + |
| 137 | +--- |
| 138 | + |
| 139 | +## Phase 6 — Create PR |
| 140 | + |
| 141 | +```bash |
| 142 | +BRANCH="add-model-page-MODEL-SLUG" # or update- / remove- |
| 143 | +git checkout -b $BRANCH |
| 144 | +git add apps/website/src/config/generated-models.json \ |
| 145 | + apps/website/scripts/generate-models.ts \ |
| 146 | + apps/website/src/config/model-metadata.ts |
| 147 | +git commit -m "feat(models): add model page for MODEL-SLUG" |
| 148 | +git push -u origin $BRANCH |
| 149 | +gh pr create \ |
| 150 | + --title "Add model page: MODEL-SLUG" \ |
| 151 | + --body "$(cat <<'EOF' |
| 152 | +Adds a new model page entry for MODEL-SLUG. |
| 153 | +
|
| 154 | +## Changes |
| 155 | +- `generated-models.json`: regenerated with new entry (workflowCount N, directory DIRECTORY) |
| 156 | +- `model-metadata.ts`: editorial overrides (docsUrl, featured) if needed |
| 157 | +EOF |
| 158 | +)" |
| 159 | +``` |
| 160 | + |
| 161 | +For UPDATE use branch `update-model-page-MODEL-SLUG`. |
| 162 | +For REMOVE use `remove-model-page-MODEL-SLUG`. |
| 163 | + |
| 164 | +--- |
| 165 | + |
| 166 | +## Error states |
| 167 | + |
| 168 | +| Situation | Response | |
| 169 | +| ------------------------------- | ---------------------------------------------------------------- | |
| 170 | +| Model not in workflow templates | Ask user to verify spelling or add it manually as a partner node | |
| 171 | +| Slug already exists (add) | Switch to update flow automatically | |
| 172 | +| Slug not found (update/remove) | Stop and ask user to confirm | |
| 173 | +| Typecheck fails | Fix the error before pushing | |
0 commit comments