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:
+15
-7
@@ -154,14 +154,9 @@ func (g *Gateway) buildAdminCatalog() adminCatalogResponse {
|
||||
Kind: kinds[model],
|
||||
}
|
||||
}
|
||||
paths := make([]string, 0, len(pathBases))
|
||||
for path := range pathBases {
|
||||
paths = append(paths, path)
|
||||
}
|
||||
sort.Strings(paths)
|
||||
for _, path := range paths {
|
||||
for _, path := range sortedKeys(pathBases) {
|
||||
models = append(models, adminCatalogModel{
|
||||
ID: providerModelScopeID(s.name, path),
|
||||
ID: s.name + path, // path starts with "/", so no extra separator
|
||||
Model: path,
|
||||
Kind: kinds[path],
|
||||
PriceSource: priceSourceUnpriced,
|
||||
@@ -182,6 +177,19 @@ func (g *Gateway) buildAdminCatalog() adminCatalogResponse {
|
||||
return adminCatalogResponse{Providers: providers, Aliases: g.buildAdminAliasViews()}
|
||||
}
|
||||
|
||||
// sortedKeys returns m's keys in ascending order, nil for an empty map.
|
||||
func sortedKeys(m map[string]string) []string {
|
||||
if len(m) == 0 {
|
||||
return nil
|
||||
}
|
||||
keys := make([]string, 0, len(m))
|
||||
for k := range m {
|
||||
keys = append(keys, k)
|
||||
}
|
||||
sort.Strings(keys)
|
||||
return keys
|
||||
}
|
||||
|
||||
// serveAdminCatalog writes buildAdminCatalog's result as JSON.
|
||||
func (g *Gateway) serveAdminCatalog(w http.ResponseWriter) {
|
||||
setAdminJSONHeaders(w)
|
||||
|
||||
Reference in New Issue
Block a user