diff --git a/docs/admin-api.openapi.json b/docs/admin-api.openapi.json index 61db5aa..46efe7e 100644 --- a/docs/admin-api.openapi.json +++ b/docs/admin-api.openapi.json @@ -7661,6 +7661,10 @@ "type": "boolean", "description": "Auto is whether a preset is added when a node fits it and the catalog has no model that makes what it makes (presets.auto)." }, + "comfyui": { + "type": "string", + "description": "ComfyUI is engines.comfyui as it stands: the version the nodes install, \"\" for none — in which case adding a preset sets it, and the control planes start again on that." + }, "presets": { "type": "array", "items": { diff --git a/internal/control/adminapi/presets.go b/internal/control/adminapi/presets.go index 1caaf6e..17454cb 100644 --- a/internal/control/adminapi/presets.go +++ b/internal/control/adminapi/presets.go @@ -22,7 +22,11 @@ import ( type PresetsView struct { // Auto is whether a preset is added when a node fits it and the catalog // has no model that makes what it makes (presets.auto). - Auto bool `json:"auto"` + Auto bool `json:"auto"` + // ComfyUI is engines.comfyui as it stands: the version the nodes + // install, "" for none — in which case adding a preset sets it, and the + // control planes start again on that. + ComfyUI string `json:"comfyui"` Presets []PresetView `json:"presets"` } @@ -96,7 +100,7 @@ func (a *API) Presets(ctx context.Context) (PresetsView, error) { cfg := a.presetCfg() cat := a.ctl.Catalog() kinds := a.gpuKinds() - out := PresetsView{Auto: cfg.Auto} + out := PresetsView{Auto: cfg.Auto, ComfyUI: cfg.ComfyUI} for _, p := range catalog.Presets() { v := PresetView{Name: p.Model.Name, Makes: p.Makes, Description: p.Model.Description, Card: presetCard(p.Model), FitsClasses: presetFits(p.Model, kinds)} diff --git a/internal/control/adminapi/presets_test.go b/internal/control/adminapi/presets_test.go index e9d333d..f784fc0 100644 --- a/internal/control/adminapi/presets_test.go +++ b/internal/control/adminapi/presets_test.go @@ -80,6 +80,9 @@ func TestAPresetIsNotAddedByItselfWhereItShouldNotBe(t *testing.T) { if err != nil { t.Fatal(err) } + if v.ComfyUI != c.cfg.ComfyUI { + t.Errorf("comfyui %q", v.ComfyUI) + } for _, p := range v.Presets { if why, ok := c.want[p.Name]; ok && !strings.Contains(p.Blocked, why) { t.Errorf("%s blocked %q, want it to say %q", p.Name, p.Blocked, why)