Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.
fix(computer): label Pi models by name and keep the effort visible
Dongdong Chen8cb079d65962
diff --git a/apps/computer/local-daemon/internal/provider/native/pi_catalog.go b/apps/computer/local-daemon/internal/provider/native/pi_catalog.goindex 1d2a17a9..ef4a9973 100644--- a/apps/computer/local-daemon/internal/provider/native/pi_catalog.go+++ b/apps/computer/local-daemon/internal/provider/native/pi_catalog.go@@ -113,6 +113,8 @@ func piCatalogList(state piCatalogState, entries []json.RawMessage) (ModelList,defaultKey = provider + "/" + id}var models catalogModels+ // How many listed models carry each name label.+ named := map[string]int{}for _, raw := range entries {var entry piCatalogModelif json.Unmarshal(raw, &entry) != nil {@@ -124,11 +126,12 @@ func piCatalogList(state piCatalogState, entries []json.RawMessage) (ModelList,}key := provider + "/" + idoption := ModelOption{ID: key, Label: key, Provider: provider, Default: key == defaultKey}- // A model ID can be a routing alias (localmodels serves its model as- // "localmodels-agent"); the label leads with the name Pi gives it,- // while the ID keeps selecting the same entry.+ // A model ID can be a routing alias or a long library path; the label+ // is the name Pi gives it, while the ID keeps selecting the same entry.+ nameLabel := falseif name := strings.TrimSpace(entry.Name); name != "" && name != id && name != key {- option.Label = name + " (" + key + ")"+ option.Label = name+ nameLabel = true}// A window that is not a whole token count stays unknown.if window, err := strconv.Atoi(strings.TrimSpace(string(entry.ContextWindow))); err == nil && window > 0 {@@ -141,9 +144,17 @@ func piCatalogList(state piCatalogState, entries []json.RawMessage) (ModelList,}option.Effort = piEffortSupport(entry.ThinkingLevelMap, defaultLevel)}- models.add(option)+ if models.add(option) && nameLabel {+ named[option.Label]+++ }}list := models.list()+ // Models that share a name are told apart by their provider/id.+ for i := range list.Models {+ if named[list.Models[i].Label] > 1 {+ list.Models[i].Label += " (" + list.Models[i].ID + ")"+ }+ }if list.Models == nil {list.Models = []ModelOption{}}diff --git a/apps/computer/local-daemon/internal/provider/native/pi_runtime_test.go b/apps/computer/local-daemon/internal/provider/native/pi_runtime_test.goindex c0d84c73..d3854ff1 100644--- a/apps/computer/local-daemon/internal/provider/native/pi_runtime_test.go+++ b/apps/computer/local-daemon/internal/provider/native/pi_runtime_test.go@@ -623,6 +623,8 @@ func TestPiCatalogLabelsAModelByItsName(t *testing.T) {json.RawMessage(`{"id":"same","name":"same","provider":"local"}`),json.RawMessage(`{"id":"blank","name":" ","provider":"local"}`),json.RawMessage(`{"id":"unnamed","provider":"local"}`),+ json.RawMessage(`{"id":"q4","name":"Qwen 27B","provider":"localmodels-library"}`),+ json.RawMessage(`{"id":"q4","name":"Qwen 27B","provider":"other"}`),})if err != nil {t.Fatal(err)@@ -632,10 +634,10 @@ func TestPiCatalogLabelsAModelByItsName(t *testing.T) {ids = append(ids, model.ID)labels = append(labels, model.Label)}- if !slices.Equal(ids, []string{"localmodels/localmodels-agent", "local/same", "local/blank", "local/unnamed"}) {+ if !slices.Equal(ids, []string{"localmodels/localmodels-agent", "local/same", "local/blank", "local/unnamed", "localmodels-library/q4", "other/q4"}) {t.Fatalf("ids = %v", ids)}- if !slices.Equal(labels, []string{"ling-3.0-tiny (localmodels/localmodels-agent)", "local/same", "local/blank", "local/unnamed"}) {+ if !slices.Equal(labels, []string{"ling-3.0-tiny", "local/same", "local/blank", "local/unnamed", "Qwen 27B (localmodels-library/q4)", "Qwen 27B (other/q4)"}) {t.Fatalf("labels = %v", labels)}}diff --git a/apps/web/src/features/rooms/chat/direct-agent-model-switch.css b/apps/web/src/features/rooms/chat/direct-agent-model-switch.cssindex 9f896e5b..765c016b 100644--- a/apps/web/src/features/rooms/chat/direct-agent-model-switch.css+++ b/apps/web/src/features/rooms/chat/direct-agent-model-switch.css@@ -27,11 +27,18 @@}.agent-model-switch-trigger-label {+ min-width: 0;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;}+.agent-model-switch-trigger-effort {+ flex: none;+ margin-left: 0.25em;+ white-space: nowrap;+}+.agent-model-switch-trigger:focus-visible {outline: 2px solid var(--app-ink);outline-offset: 2px;diff --git a/apps/web/src/features/rooms/chat/direct-agent-model-switch.test.tsx b/apps/web/src/features/rooms/chat/direct-agent-model-switch.test.tsxindex 9d90a662..c979f3e1 100644--- a/apps/web/src/features/rooms/chat/direct-agent-model-switch.test.tsx+++ b/apps/web/src/features/rooms/chat/direct-agent-model-switch.test.tsx@@ -1,5 +1,11 @@import { QueryClient, QueryClientProvider } from "@tanstack/react-query";-import { fireEvent, render, screen, waitFor } from "@testing-library/react";+import {+ fireEvent,+ render,+ screen,+ waitFor,+ within,+} from "@testing-library/react";import { describe, expect, it, vi } from "vitest";import { createTestTeamHubRuntime } from "@/test/teamhub-test-runtime";@@ -75,6 +81,18 @@ describe("Direct Agent runtime settings", () => {);await waitFor(() => expect(screen.queryByRole("dialog")).toBeNull());});+ it("keeps the effort outside the model label that shortens", async () => {+ renderSwitch({});+ const trigger = await screen.findByRole("button", {+ name: "5.4 Sol Medium",+ });+ const label = within(trigger).getByText("5.4 Sol");+ expect(label).toHaveClass("agent-model-switch-trigger-label");+ expect(label).not.toHaveTextContent("Medium");+ expect(within(trigger).getByText("Medium")).toHaveClass(+ "agent-model-switch-trigger-effort",+ );+ });it("allows inspecting while busy but disables saving", async () => {const updateTenantAgent = vi.fn();renderSwitch({ updateTenantAgent, busy: true });diff --git a/apps/web/src/features/rooms/chat/direct-agent-model-switch.tsx b/apps/web/src/features/rooms/chat/direct-agent-model-switch.tsxindex 929a2a70..9b4c28f4 100644--- a/apps/web/src/features/rooms/chat/direct-agent-model-switch.tsx+++ b/apps/web/src/features/rooms/chat/direct-agent-model-switch.tsx@@ -53,7 +53,7 @@ function RuntimeSettingsEntry({ client, registration, tenantId, busy }: Props) {?.runtimes.find((item) => item.type === placement?.runtime_type)?.models;const model = models?.find((item) => item.id === registration.runtime.model);const effort = registration.runtime.reasoning_effort;- const summary = `${model?.label ?? registration.runtime.model}${effort ? ` ${EFFORT_LABEL[effort]}` : ""}`;+ const label = model?.label ?? registration.runtime.model;const update = useMutation({mutationFn: (input: AgentRuntimeUpdateInput) =>teamHubData(@@ -99,7 +99,16 @@ function RuntimeSettingsEntry({ client, registration, tenantId, busy }: Props) {setOpen(true);}}>- <span className="agent-model-switch-trigger-label">{summary}</span>+ <span className="agent-model-switch-trigger-label">{label}</span>+ {/* A long model label shortens with an ellipsis; the effort stays. */}+ {effort ? (+ <>+ {" "}+ <span className="agent-model-switch-trigger-effort">+ {EFFORT_LABEL[effort]}+ </span>+ </>+ ) : null}</button>{open ? (<Suspense