fix(admin): show kinds and endpoints in the providers panel

The provider accordion reads the overview response, not the catalog, so
the earlier change never reached it. Add kinds and endpoints to the
overview provider view and group the accordion rows by kind. Endpoint ids
now read gx10/v1/decide, without a doubled slash.
This commit is contained in:
2026-11-10 12:38:33 +00:00
parent 085292143c
commit 6fb048b599
9 changed files with 212 additions and 62 deletions
+32 -2
View File
@@ -375,8 +375,8 @@ func TestAdminCatalog_KindsAndEndpointRows(t *testing.T) {
}{
{"zeta/z-model", "", false},
{"zeta/bge-reranker", "reranking", false},
{"zeta//v1/decide", "decision", true},
{"zeta//v1/other", "", true},
{"zeta/v1/decide", "decision", true},
{"zeta/v1/other", "", true},
}
for _, c := range cases {
m, ok := byID[c.id]
@@ -399,3 +399,33 @@ func TestKindsValidation(t *testing.T) {
t.Fatal("empty kind accepted")
}
}
func TestAdminOverview_KindsAndEndpoints(t *testing.T) {
t.Parallel()
cfg := newAdminTestConfig()
cfg.Providers["zeta"].PathBaseURLs = map[string]string{"/v1/decide": "http://thx.invalid"}
cfg.Providers["zeta"].Kinds = map[string]string{"/v1/decide": "decision"}
h, _ := newAdminGatewayHandle(t, cfg)
rec := httptest.NewRecorder()
h.ServeHTTP(rec, adminRequest(http.MethodGet, adminOverviewPath, "sk-admin1"))
if rec.Code != http.StatusOK {
t.Fatalf("status = %d, body=%s", rec.Code, rec.Body.String())
}
var got adminOverviewResponse
if err := json.Unmarshal(rec.Body.Bytes(), &got); err != nil {
t.Fatalf("decode: %v", err)
}
for _, p := range got.Providers {
switch p.Name {
case "zeta":
if len(p.Endpoints) != 1 || p.Endpoints[0] != "/v1/decide" || p.Kinds["/v1/decide"] != "decision" {
t.Errorf("zeta endpoints=%v kinds=%v", p.Endpoints, p.Kinds)
}
default:
if len(p.Endpoints) != 0 || len(p.Kinds) != 0 {
t.Errorf("%s carries endpoints/kinds without config", p.Name)
}
}
}
}