mirror of
https://github.com/lukaszraczylo/traefik-llmgateway.git
synced 2026-11-26 10:06:31 +00:00
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:
+32
-2
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user