a4274be444
CI / docker (push) Successful in 4m52s
Text keys use OpenAI routes; image keys use predictions with ingress Model ID, owner/name or short name resolution, OpenAPI input schemas, editable workflows with per-field defaults, protocol-aware admin whitelist, and in-app API docs. Co-authored-by: Cursor <cursoragent@cursor.com>
38 lines
1.0 KiB
Go
38 lines
1.0 KiB
Go
package prediction
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/rose_cat707/luminary/internal/model"
|
|
)
|
|
|
|
func TestValidateInputWithDefaultsOverride(t *testing.T) {
|
|
overrides := map[string]any{"width": float64(768), "steps": float64(30)}
|
|
out, err := ValidateInputWithDefaults(model.WorkflowTxt2Img, map[string]any{
|
|
"prompt": "hello",
|
|
}, overrides)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if out["width"] != float64(768) {
|
|
t.Fatalf("width got %#v", out["width"])
|
|
}
|
|
if out["steps"] != float64(30) {
|
|
t.Fatalf("steps got %#v", out["steps"])
|
|
}
|
|
}
|
|
|
|
func TestOpenAPISchemaUsesModelDefaults(t *testing.T) {
|
|
schema := OpenAPISchemaForWorkflow(model.WorkflowTxt2Img, "flux", "desc", map[string]any{
|
|
"width": float64(768),
|
|
})
|
|
components := schema["components"].(map[string]any)
|
|
schemas := components["schemas"].(map[string]any)
|
|
input := schemas["Input"].(map[string]any)
|
|
props := input["properties"].(map[string]any)
|
|
width := props["width"].(map[string]any)
|
|
if width["default"] != float64(768) {
|
|
t.Fatalf("unexpected width default %#v", width["default"])
|
|
}
|
|
}
|