diff --git a/core/config/meta/registry.go b/core/config/meta/registry.go index ca10f604c..84fc9afda 100644 --- a/core/config/meta/registry.go +++ b/core/config/meta/registry.go @@ -286,6 +286,15 @@ func DefaultRegistry() map[string]FieldMetaOverride { Order: 45, }, + // --- Alias --- + "alias": { + Section: "alias", + Label: "Alias target", + Description: "Redirect all traffic for this model to another configured model. When set, every other field on this config is ignored and requests are served by the target model.", + Component: "model-select", + Order: 0, + }, + // --- Pipeline --- "pipeline.llm": { Section: "pipeline", diff --git a/core/config/meta/registry_test.go b/core/config/meta/registry_test.go new file mode 100644 index 000000000..e9d998609 --- /dev/null +++ b/core/config/meta/registry_test.go @@ -0,0 +1,28 @@ +package meta_test + +import ( + "github.com/mudler/LocalAI/core/config/meta" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +var _ = Describe("alias field metadata", func() { + It("registers the alias field as a model-select in the alias section", func() { + reg := meta.DefaultRegistry() + f, ok := reg["alias"] + Expect(ok).To(BeTrue(), "alias field should have a registry override") + Expect(f.Section).To(Equal("alias")) + Expect(f.Component).To(Equal("model-select")) + }) + + It("defines an alias section", func() { + var found bool + for _, s := range meta.DefaultSections() { + if s.ID == "alias" { + found = true + } + } + Expect(found).To(BeTrue(), "DefaultSections should include an alias section") + }) +}) diff --git a/core/config/meta/types.go b/core/config/meta/types.go index a86b8bb69..a29e66967 100644 --- a/core/config/meta/types.go +++ b/core/config/meta/types.go @@ -69,6 +69,7 @@ type FieldMetaOverride struct { func DefaultSections() []Section { return []Section{ {ID: "general", Label: "General", Icon: "settings", Order: 0}, + {ID: "alias", Label: "Alias", Icon: "git-merge", Order: 5}, {ID: "llm", Label: "LLM", Icon: "cpu", Order: 10}, {ID: "parameters", Label: "Parameters", Icon: "sliders", Order: 20}, {ID: "templates", Label: "Templates", Icon: "file-text", Order: 30},