From cb8dd060f7be1f8285091b60e70ad67e4d562885 Mon Sep 17 00:00:00 2001 From: majiayu000 <1835304752@qq.com> Date: Tue, 30 Dec 2025 18:54:15 +0800 Subject: [PATCH] fix: filter .gguf files from model listing endpoint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add .gguf to the list of file extensions to skip when listing models in the model path. This prevents raw GGUF model files from appearing as available models in the /v1/models endpoint. Fixes #1077 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 Signed-off-by: majiayu000 <1835304752@qq.com> --- pkg/model/loader.go | 1 + pkg/model/loader_test.go | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/pkg/model/loader.go b/pkg/model/loader.go index 27ea78b34b4d..ffe67496df91 100644 --- a/pkg/model/loader.go +++ b/pkg/model/loader.go @@ -122,6 +122,7 @@ var knownModelsNameSuffixToSkip []string = []string{ ".bin", ".partial", ".tar.gz", + ".gguf", } const retryTimeout = time.Duration(2 * time.Minute) diff --git a/pkg/model/loader_test.go b/pkg/model/loader_test.go index 2c296c2ea152..16736614138b 100644 --- a/pkg/model/loader_test.go +++ b/pkg/model/loader_test.go @@ -68,6 +68,18 @@ var _ = Describe("ModelLoader", func() { Expect(files).To(ContainElement("test.model")) Expect(files).ToNot(ContainElement("README.md")) }) + + It("should filter out .gguf files from the model listing", func() { + os.Create(filepath.Join(modelPath, "valid-model")) + os.Create(filepath.Join(modelPath, "model.gguf")) + os.Create(filepath.Join(modelPath, "another-model.gguf")) + + files, err := modelLoader.ListFilesInModelPath() + Expect(err).To(BeNil()) + Expect(files).To(ContainElement("valid-model")) + Expect(files).ToNot(ContainElement("model.gguf")) + Expect(files).ToNot(ContainElement("another-model.gguf")) + }) }) Context("LoadModel", func() {