Files
llmgw/internal/control/catalog/presets_test.go
T
Ilker ManapandClaude Opus 5.5 40b8948d7d A picture or 3D model is added by its name: llmgw ctl model add triposr
flux-schnell and triposr come with llmgw as presets: their workflow,
custom nodes, packages and licence as they were found and tried on the
PoC, and a profile that says the card it needs rather than a class, so the
entry places on any site's cards. TripoSR's workflow is built in, with the
LLMGWPrepareForMesh node that keeps a picture's background out of the
mesh, which the copy in the document had left out.

`ctl model add PRESET` adds one, and has the nodes install ComfyUI when
the cluster's settings name none; `ctl model presets` lists them; the
console's add-model dialog offers them beside a definition file. A
ComfyUI build is now also checked to keep its order on a Turing card, so
a node's installed cu13 is not replaced by the cu126 build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 10:21:28 +02:00

60 lines
1.7 KiB
Go

package catalog
import (
"testing"
"gitea.mynodes.xyz/ilker/llmgw/internal/comfy"
)
func TestEveryPresetIsACatalogEntryThatLoads(t *testing.T) {
var models []Model
for _, p := range Presets() {
models = append(models, p.Model)
}
cat, err := New(models)
if err != nil {
t.Fatal(err)
}
for _, p := range Presets() {
m, ok := cat.Resolve(p.Model.Name)
if !ok {
t.Fatalf("%s is not in the catalog", p.Model.Name)
}
if p.Makes == OutputMeshes && !m.MakesMeshes() || p.Makes == OutputPictures && !m.MakesImages() {
t.Errorf("%s does not make %s", m.Name, p.Makes)
}
// A shipped entry has its workflow inside llmgw, not in a file a
// site would have to write.
w, ckpt := m.ComfyWorkflow()
if _, err := comfy.Load(w); err != nil {
t.Errorf("%s: %v", m.Name, err)
}
if ckpt == "" {
t.Errorf("%s has no checkpoint", m.Name)
}
if m.License == nil || m.License.ID == "" || m.License.Commercial == nil {
t.Errorf("%s does not say its licence for a machine to match", m.Name)
}
for _, pr := range m.Profiles {
if pr.GPUClass != "" || pr.GPU == nil {
t.Errorf("%s/%s names a class: a preset fits any site's cards", m.Name, pr.Name)
}
}
}
}
func TestAPresetIsFoundByName(t *testing.T) {
if p, ok := PresetNamed("triposr"); !ok || p.Model.ComfyUI.Workflow != "triposr" {
t.Errorf("triposr: %+v %v", p, ok)
}
if _, ok := PresetNamed("sdxl"); ok {
t.Error("a preset that is not there was found")
}
// Each call is a fresh copy: a caller changing one changes nobody's.
a, _ := PresetNamed("triposr")
a.Model.ComfyUI.Nodes[0].Requirements[0] = "x"
if b, _ := PresetNamed("triposr"); b.Model.ComfyUI.Nodes[0].Requirements[0] == "x" {
t.Error("a preset was changed by a caller")
}
}