fix(ui): send return_wildcard_routes=False from modelAvailableCall

modelAvailableCall left the param off when it wanted wildcard routes hidden,
which used to mean false. It now means the proxy's
model_list_return_wildcard_routes default, so turning that on would have put
openai/* into the dashboard's own pickers (playground, guardrails, policies,
users). Sending False keeps them as they were on every proxy version.
This commit is contained in:
shrey kharbanda 2026-09-28 13:47:23 -07:00
parent 811f1510ec
commit 7eb134a14c
2 changed files with 34 additions and 1 deletions

View file

@ -157,6 +157,37 @@ describe("modelInfoCall", () => {
});
});
describe("modelAvailableCall", () => {
let currentFetch: typeof global.fetch;
beforeEach(() => {
currentFetch = global.fetch;
});
afterEach(() => {
global.fetch = currentFetch;
});
// An omitted return_wildcard_routes takes the proxy's model_list_return_wildcard_routes
// default, so the dashboard's own pickers always send it.
it.each([
[undefined, "False"],
[false, "False"],
[true, "True"],
])("sends return_wildcard_routes=%s as %s", async (returnWildcardRoutes, sent) => {
const mockFetch = vi
.fn()
.mockResolvedValue({ ok: true, text: vi.fn().mockResolvedValue(JSON.stringify({ data: [] })) } as any);
global.fetch = mockFetch as any;
await Networking.modelAvailableCall("token", "user", "Admin", returnWildcardRoutes);
const parsed = new URL(mockFetch.mock.calls[0][0] as string, "http://example.com");
expect(parsed.pathname).toBe("/models");
expect(parsed.searchParams.get("return_wildcard_routes")).toBe(sent);
});
});
describe("daily activity helpers", () => {
const startTime = new Date("2025-02-12T00:00:00.000Z");
const endTime = new Date("2025-02-19T00:00:00.000Z");

View file

@ -1940,7 +1940,9 @@ export const modelAvailableCall = async (
accessToken,
query: {
include_model_access_groups: "True",
return_wildcard_routes: return_wildcard_routes === true ? "True" : undefined,
// Sent either way: an omitted value falls back to the proxy's
// general_settings.model_list_return_wildcard_routes, not to false.
return_wildcard_routes: return_wildcard_routes === true ? "True" : "False",
only_model_access_groups: only_model_access_groups === true ? "True" : undefined,
team_id: teamID || undefined,
scope: scope || undefined,