mirror of
https://github.com/mudler/LocalAI.git
synced 2026-06-20 22:59:09 -04:00
feat(config-meta): expose alias as a model-select field
Add an 'alias' section to DefaultSections() and an 'alias' field override in DefaultRegistry() so the schema-driven React editor renders the new top-level ModelConfig.Alias field as a model picker in its own section. Assisted-by: Claude:opus-4.8 [Claude Code] Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
@@ -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",
|
||||
|
||||
28
core/config/meta/registry_test.go
Normal file
28
core/config/meta/registry_test.go
Normal file
@@ -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")
|
||||
})
|
||||
})
|
||||
@@ -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},
|
||||
|
||||
Reference in New Issue
Block a user