diff --git a/web/backend/api/model_status.go b/web/backend/api/model_status.go index cb27a8207..98bd501f5 100644 --- a/web/backend/api/model_status.go +++ b/web/backend/api/model_status.go @@ -193,30 +193,18 @@ func runLocalModelProbe(m *config.ModelConfig) bool { func modelProbeCacheKey(m *config.ModelConfig) string { protocol, modelID := splitModel(m.Model) - modelName := strings.ToLower(strings.TrimSpace(m.ModelName)) apiBaseRaw := modelProbeAPIBase(m) apiBase := strings.ToLower(strings.TrimRight(strings.TrimSpace(apiBaseRaw), "/")) - authMethod := strings.ToLower(strings.TrimSpace(m.AuthMethod)) - connectMode := strings.ToLower(strings.TrimSpace(m.ConnectMode)) apiKeyFingerprint := modelProbeAPIKeyFingerprint(m.APIKey()) var b strings.Builder - b.Grow( - len(modelName) + len(protocol) + len(modelID) + len(apiBase) + len(authMethod) + - len(connectMode) + len(apiKeyFingerprint) + 8, - ) - b.WriteString(modelName) - b.WriteByte('|') + b.Grow(len(protocol) + len(modelID) + len(apiBase) + len(apiKeyFingerprint) + 8) b.WriteString(protocol) b.WriteByte('|') b.WriteString(modelID) b.WriteByte('|') b.WriteString(apiBase) b.WriteByte('|') - b.WriteString(authMethod) - b.WriteByte('|') - b.WriteString(connectMode) - b.WriteByte('|') b.WriteString(apiKeyFingerprint) return b.String() diff --git a/web/backend/api/model_status_test.go b/web/backend/api/model_status_test.go index 848c59aeb..d5463a856 100644 --- a/web/backend/api/model_status_test.go +++ b/web/backend/api/model_status_test.go @@ -129,6 +129,29 @@ func TestModelProbeCacheKey_NormalizesTrailingSlashInAPIBase(t *testing.T) { } } +func TestModelProbeCacheKey_IgnoresDisplayAndConnectionFields(t *testing.T) { + base := &config.ModelConfig{ + ModelName: "vllm-one", + Model: "vllm/custom-model", + APIBase: "http://127.0.0.1:8000/v1", + AuthMethod: "none", + ConnectMode: "http", + } + changed := &config.ModelConfig{ + ModelName: "vllm-two", + Model: "vllm/custom-model", + APIBase: "http://127.0.0.1:8000/v1", + AuthMethod: "token", + ConnectMode: "ws", + } + + k1 := modelProbeCacheKey(base) + k2 := modelProbeCacheKey(changed) + if k1 != k2 { + t.Fatalf("modelProbeCacheKey() should ignore non-probe fields, got %q vs %q", k1, k2) + } +} + func TestProbeLocalModelAvailability_SuccessBackoff(t *testing.T) { resetModelProbeHooks(t)