From f2ba636290dcf7f015d63c0d5ee5d5d7181fdba4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 19 Nov 2025 21:52:23 +0000 Subject: [PATCH 1/4] Initial plan From 22d8b48fd12bab231e7f1f7227ef352c3f8764e4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 19 Nov 2025 22:11:28 +0000 Subject: [PATCH 2/4] Add test for multiple configs sharing same model file Co-authored-by: mudler <2420543+mudler@users.noreply.github.com> --- core/config/model_config_test.go | 72 ++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/core/config/model_config_test.go b/core/config/model_config_test.go index 342b10c47f8b..b731f7e6089a 100644 --- a/core/config/model_config_test.go +++ b/core/config/model_config_test.go @@ -166,4 +166,76 @@ parameters: Expect(i.HasUsecases(FLAG_COMPLETION)).To(BeTrue()) Expect(i.HasUsecases(FLAG_CHAT)).To(BeTrue()) }) + + It("Handles multiple configs with same model file but different names", func() { + // Create a temporary directory for test configs + tmpDir, err := os.MkdirTemp("", "config_test_*") + Expect(err).To(BeNil()) + defer os.RemoveAll(tmpDir) + + // Write first config without MCP + config1Path := tmpDir + "/model-without-mcp.yaml" + err = os.WriteFile(config1Path, []byte(`name: model-without-mcp +backend: llama-cpp +parameters: + model: shared-model.gguf +`), 0644) + Expect(err).To(BeNil()) + + // Write second config with MCP + config2Path := tmpDir + "/model-with-mcp.yaml" + err = os.WriteFile(config2Path, []byte(`name: model-with-mcp +backend: llama-cpp +parameters: + model: shared-model.gguf +mcp: + stdio: | + mcpServers: + test: + command: echo + args: ["hello"] +`), 0644) + Expect(err).To(BeNil()) + + // Load all configs + loader := NewModelConfigLoader(tmpDir) + err = loader.LoadModelConfigsFromPath(tmpDir) + Expect(err).To(BeNil()) + + // Verify both configs are loaded + cfg1, exists1 := loader.GetModelConfig("model-without-mcp") + Expect(exists1).To(BeTrue()) + Expect(cfg1.Name).To(Equal("model-without-mcp")) + Expect(cfg1.Model).To(Equal("shared-model.gguf")) + Expect(cfg1.MCP.Stdio).To(Equal("")) + Expect(cfg1.MCP.Servers).To(Equal("")) + + cfg2, exists2 := loader.GetModelConfig("model-with-mcp") + Expect(exists2).To(BeTrue()) + Expect(cfg2.Name).To(Equal("model-with-mcp")) + Expect(cfg2.Model).To(Equal("shared-model.gguf")) + Expect(cfg2.MCP.Stdio).ToNot(Equal("")) + + // Verify both configs are in the list + allConfigs := loader.GetAllModelsConfigs() + Expect(len(allConfigs)).To(Equal(2)) + + // Find each config in the list + foundWithoutMCP := false + foundWithMCP := false + for _, cfg := range allConfigs { + if cfg.Name == "model-without-mcp" { + foundWithoutMCP = true + Expect(cfg.Model).To(Equal("shared-model.gguf")) + Expect(cfg.MCP.Stdio).To(Equal("")) + } + if cfg.Name == "model-with-mcp" { + foundWithMCP = true + Expect(cfg.Model).To(Equal("shared-model.gguf")) + Expect(cfg.MCP.Stdio).ToNot(Equal("")) + } + } + Expect(foundWithoutMCP).To(BeTrue()) + Expect(foundWithMCP).To(BeTrue()) + }) }) From d2ed2b48a8636b575cf24aed4e41a6231cd4c939 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 19 Nov 2025 22:13:39 +0000 Subject: [PATCH 3/4] Fix: Show MCP toggle for all models with MCP config, not just gallery models Co-authored-by: mudler <2420543+mudler@users.noreply.github.com> --- core/http/views/chat.html | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/core/http/views/chat.html b/core/http/views/chat.html index dd917612adc0..7dce5ba66a5e 100644 --- a/core/http/views/chat.html +++ b/core/http/views/chat.html @@ -419,8 +419,7 @@