mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-05-31 03:17:23 +08:00
Replaces #13744 with a narrower change. Decision after review: drop the dedicated PUT/DELETE /api/assets/{id}/preview endpoints in favor of extending the existing PUT /api/assets/{id} route with a clear_preview_id flag, matching the codebase's existing pattern for clearing operations elsewhere in the project (`clear: true` on /api/queue and /api/history in the cloud sibling). Changes: - openapi.yaml: add `clear_preview_id: boolean` to the UpdateAsset request body, documented as taking precedence over `preview_id` when both are set. - schemas_in.UpdateAssetBody: add the field, extend at-least-one-field validation (clear=true counts, clear=false is a no-op), reject the zero UUID as `preview_id`. - services/asset_management.update_asset_metadata: add `clear_preview_id` param; when true, call set_reference_preview with None to clear the link. Clear takes precedence over set when both provided. - routes.update_asset_route: wire the flag through. Reject self-referential preview_id (preview_id == path id) at 400 SELF_REFERENCE before service call. - Tests: cover clear-via-flag happy path, clear-takes-precedence, schema validation edge cases (zero UUID rejected, clear-only valid, false-only rejected). |
||
|---|---|---|
| .. | ||
| api | ||
| database | ||
| services | ||
| helpers.py | ||
| scanner.py | ||
| seeder.py | ||