From 181a9591bfec7a255ea052a9a6cb537a17bea3bd Mon Sep 17 00:00:00 2001 From: erlinerd Date: Sat, 3 Oct 2026 13:36:43 +0800 Subject: [PATCH] =?UTF-8?q?providers:=20oMLX=20is=20a=20local-server=20pre?= =?UTF-8?q?set=20=E2=80=94=20its=20:8000=20server=20speaks=20Chat,=20Respo?= =?UTF-8?q?nses=20and=20Anthropic=20Messages=20and=20asks=20no=20key=20on?= =?UTF-8?q?=20a=20loopback=20bind,=20so=20it=20joins=20Ollama=20and=20LM?= =?UTF-8?q?=20Studio=20in=20the=20add=20sheet's=20On=20this=20machine=20se?= =?UTF-8?q?ction=20instead=20of=20being=20typed=20as=20a=20custom=20provid?= =?UTF-8?q?er=20(no=20issue:=20the=20gap=20was=20simply=20that=20oMLX,=20a?= =?UTF-8?q?n=20OpenAI-compatible=20MLX=20server=20for=20Apple=20Silicon,?= =?UTF-8?q?=20was=20missing=20a=20preset).=20TestOmlxPreset=20fails=20with?= =?UTF-8?q?out=20the=20change=20(no=20omlx=20preset).=20go=20vet=20./inter?= =?UTF-8?q?nal/...,=20go=20build=20-tags=20nogui=20(darwin,=20GOOS=3Dlinux?= =?UTF-8?q?),=20GOOS=3Dwindows=20go=20build,=20go=20test=20-tags=20nogui?= =?UTF-8?q?=20-count=3D1=20./...=20under=20a=20temp=20HOME=20pass=20but=20?= =?UTF-8?q?for=20TestBunThroughBridge,=20which=20fails=20on=20a=20clean=20?= =?UTF-8?q?tree=20too=20(a=20local=20bun,=20unrelated=20to=20this=20change?= =?UTF-8?q?).=20(#635)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/gui/assets/icons/omlx.svg | 1 + internal/provider/omlx_test.go | 27 +++++++++++++++++++++++++++ internal/provider/presets.go | 3 +++ 3 files changed, 31 insertions(+) create mode 100644 internal/gui/assets/icons/omlx.svg create mode 100644 internal/provider/omlx_test.go diff --git a/internal/gui/assets/icons/omlx.svg b/internal/gui/assets/icons/omlx.svg new file mode 100644 index 000000000..8d143ebde --- /dev/null +++ b/internal/gui/assets/icons/omlx.svg @@ -0,0 +1 @@ +oMLX diff --git a/internal/provider/omlx_test.go b/internal/provider/omlx_test.go new file mode 100644 index 000000000..c837321c8 --- /dev/null +++ b/internal/provider/omlx_test.go @@ -0,0 +1,27 @@ +package provider + +import "testing" + +// oMLX (omlx.ai, github.com/jundot/omlx) is a local server on :8000 that +// speaks all three APIs. A fresh install binds loopback and asks no key, so +// it's a NoKey local preset; its Anthropic base is the root, /v1/messages is +// magpie's path there, as it is for Ollama. +func TestOmlxPreset(t *testing.T) { + pr := Preset("omlx") + if pr == nil { + t.Fatal("no omlx preset") + } + if pr.Kind != KindLocal || !pr.NoKey || pr.KeysURL != "" { + t.Fatalf("kind/noKey/keysURL: %q %v %q", pr.Kind, pr.NoKey, pr.KeysURL) + } + if pr.Chat != "http://localhost:8000/v1" || pr.Responses != "http://localhost:8000/v1" || pr.Anthropic != "http://localhost:8000" { + t.Fatalf("endpoints: %q %q %q", pr.Chat, pr.Responses, pr.Anthropic) + } + p, err := FromPreset("omlx") + if err != nil { + t.Fatal(err) + } + if p.ID != "omlx" || p.Preset != "omlx" || p.Icon != "omlx" { + t.Fatalf("from preset: %+v", p) + } +} diff --git a/internal/provider/presets.go b/internal/provider/presets.go index 85358233c..029adce34 100644 --- a/internal/provider/presets.go +++ b/internal/provider/presets.go @@ -417,6 +417,9 @@ var presets = []PresetDef{ {ID: "lmstudio", Name: "LM Studio", Icon: "lmstudio", Kind: KindLocal, NoKey: true, Chat: "http://localhost:1234/v1", Note: "local server on :1234", Website: "https://lmstudio.ai"}, + {ID: "omlx", Name: "oMLX", Icon: "omlx", Kind: KindLocal, NoKey: true, + Chat: "http://localhost:8000/v1", Responses: "http://localhost:8000/v1", Anthropic: "http://localhost:8000", + Note: "local server on :8000", Website: "https://omlx.ai"}, } func bedrockChat(region string) string {