Skip to content

armgit / mso

Public Imported from GitHub
0

Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.

fix(api): restore the models provider name the route extraction dropped (#168)

Abdurrahman Fakhrul966b89b8b5d7
diff --git a/app/api/models/handler.ts b/app/api/models/handler.ts
index 0c395a19..a4b7930d 100644
--- a/app/api/models/handler.ts
+++ b/app/api/models/handler.ts
@@ -69,7 +69,9 @@ export async function handleGetModels(req: NextRequest): Promise<Response> {
const runtimeProvider = provider || m.provider;
return {
ref: `${runtimeProvider}/${id}`,
- provider,
+ // `provider` alone is null when the caller passes no ?provider= filter; the
+ // catalog must still name each model's real provider.
+ provider: runtimeProvider,
id,
name: m.name,
context: m.limit?.context,
diff --git a/app/api/models/route.test.ts b/app/api/models/route.test.ts
index 0430bde1..5174098c 100644
--- a/app/api/models/route.test.ts
+++ b/app/api/models/route.test.ts
@@ -78,6 +78,20 @@ describe("/api/models dynamic pricing and provider mapping", () => {
expect(body.models.map((m: { id: string }) => m.id)).toEqual(["glm-free"]);
});
+ // Regression: the route extraction turned `provider: runtimeProvider` into the
+ // shorthand `provider`, so an unfiltered catalog reported every model as null.
+ it("names each model's real provider when no provider filter is passed", async () => {
+ const { GET } = await import("./route");
+ const res = await GET(new NextRequest("http://localhost/api/models"));
+ const body = await res.json();
+ const rows = body.models.filter((m: { id: string }) => m.id === "glm-free");
+ expect(rows.length).toBeGreaterThan(0);
+ for (const row of rows) {
+ expect(row.provider).toBe("zhipuai");
+ expect(row.ref).toBe("zhipuai/glm-free");
+ }
+ });
+
it("returns a custom provider's declared ids instead of an empty catalog", async () => {
readConfig.mockResolvedValue({
customProviders: { "my-llm": { baseUrl: "https://gw.example/v1", models: ["b", "a"] } },
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index e2bcb5f0..ab259167 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -13,6 +13,7 @@ this is the *what*, and it is what Settings → Account → About shows as “Wh
**Fixed**
+- `api` restore the provider name in the models catalog, and drop three new em dashes
- `build` restore the turbopackIgnore annotation the route extraction dropped
**Faster**
diff --git a/docs/MSO-MIGRATION.md b/docs/MSO-MIGRATION.md
index fb3dde6b..140219cd 100644
--- a/docs/MSO-MIGRATION.md
+++ b/docs/MSO-MIGRATION.md
@@ -371,12 +371,12 @@ browser actually downloads it, then confirmed in a browser at Slow 4G + 4x CPU:
The whole client bundle of the minimal app is 36.90 KB gzip; a realistic page with a nested
layout, a 50-row fetch-driven list, filtering and a re-fetch button added **4.43 KB gzip**, and
-the browser measured 35.16 KB first-load JS for the minimal page and 36.57 KB for that page —
+the browser measured 35.16 KB first-load JS for the minimal page and 36.57 KB for that page,
i.e. the per-file arithmetic was honest to within 1.7 KB.
**Arithmetic that matters.** Framework floor falls 132.70 → 33.07 KB gzip, a **99.63 KB (75 %)
reduction in framework tax**. Holding app code at today's 145.5 KB gzip, MSO's first-load would
-land at **178.6 KB gzip instead of 278.2 KB** — a 35.8 % cut before any template-savings.
+land at **178.6 KB gzip instead of 278.2 KB**, a 35.8 % cut before any template-savings.
That last figure is the honest bound, not a forecast: Svelte's app code is new code, not the
same 145.5 KB. Svelte should shrink it (no `createElement` calls, runes compile inline instead
@@ -487,7 +487,7 @@ of the measured options, cheapest first:
The same measurement that makes 250 KiB hard in-tree makes it trivial after a swap:
the SvelteKit floor measured in §2.1 is 33.07 KiB gzip, so a swapped shell would need
- app code ≤ 217 KiB to stay under 250 — more headroom than today's 145.5 KiB uses. The
+ app code ≤ 217 KiB to stay under 250, more headroom than today's 145.5 KiB uses. The
250/256 KiB target is therefore not a stretch goal at all once React and Next are gone;
it is in-tree that it is out of reach, because 132.7 KiB of the budget is framework.
*Measurement support:* Supported directly by the network throttle control