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.
feat(web): translate the Models settings
Kilynbea579436b1a
diff --git a/apps/web/src/features/local-models/byok-combobox.tsx b/apps/web/src/features/local-models/byok-combobox.tsxindex 947782e7..5d0e1c9b 100644--- a/apps/web/src/features/local-models/byok-combobox.tsx+++ b/apps/web/src/features/local-models/byok-combobox.tsx@@ -13,8 +13,11 @@ import {DropdownOptions,} from "@/components/ui/dropdown-options";import { Icon } from "@/components/ui/icon";+import { useT } from "@/i18n/use-translation";import { cn } from "@/lib/cn";+import { localModelsMessages as m } from "./local-models.messages";+export interface ByokComboboxOption {/** A second line under the value. */detail?: string;@@ -70,6 +73,7 @@ export function ByokCombobox({placeholder: string;value: string;}) {+ const t = useT();const rootRef = useRef<HTMLDivElement>(null);const inputRef = useRef<HTMLInputElement>(null);const menuRef = useRef<HTMLDivElement>(null);@@ -183,7 +187,7 @@ export function ByokCombobox({value={value}/><button- aria-label={`Show ${label} suggestions`}+ aria-label={t(m.byokShowSuggestions, { label })}className="grid size-6 shrink-0 place-items-center rounded-sm text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:pointer-events-none disabled:opacity-50"disabled={disabled}onClick={() => {@@ -202,7 +206,7 @@ export function ByokCombobox({</button>{open ? (<DropdownOptions- aria-label={`${label} suggestions`}+ aria-label={t(m.byokSuggestions, { label })}className={cn("absolute top-full z-30 mt-1 w-max min-w-[calc(100%+2px)] max-w-[min(22rem,86vw)]",menuClassName,diff --git a/apps/web/src/features/local-models/byok-endpoint.ts b/apps/web/src/features/local-models/byok-endpoint.tsindex 680e46c4..955dcc53 100644--- a/apps/web/src/features/local-models/byok-endpoint.ts+++ b/apps/web/src/features/local-models/byok-endpoint.ts@@ -4,21 +4,28 @@ import {} from "@linger/service-kit/byok-endpoint";import type { components } from "@linger/wire-contracts/teamhub-public/types";+import type { Translate } from "@/i18n/language";++import { localModelsMessages as m } from "./local-models.messages";+type Schemas = components["schemas"];type ByokProtocol = Schemas["ByokProtocol"];/** Paths some providers document; any other path can be typed. */-export const byokPathSuggestions: readonly { label: string; value: string }[] =- [- { label: "Most providers", value: DEFAULT_BYOK_PATH },+export function byokPathSuggestions(+ t: Translate,+): readonly { label: string; value: string }[] {+ return [+ { label: t(m.byokPathMostProviders), value: DEFAULT_BYOK_PATH },{- label: "Zhipu GLM (base https://open.bigmodel.cn)",+ label: t(m.byokPathZhipu, { url: "https://open.bigmodel.cn" }),value: "/api/paas/v4",},- { label: "Volcano Engine Ark", value: "/api/v3" },+ { label: t(m.byokPathVolcano), value: "/api/v3" },{ label: "Gemini", value: "/v1beta/openai" },- { label: "No path. The base URL already has it.", value: "" },+ { label: t(m.byokPathNone), value: "" },];+}/** The three endpoints whose ending names a wire format, then none. */export const byokEndpointSuggestions: readonly {@@ -35,8 +42,8 @@ export const byokEndpointSuggestions: readonly {];/** A context window as the BYOK form shows it. */-export function byokContextLabel(tokens: number) {+export function byokContextLabel(tokens: number, t: Translate) {return tokens < 1024- ? `${tokens}-token context`- : `${Math.round(tokens / 1024)}K context`;+ ? t(m.byokContextTokens, { tokens })+ : t(m.byokContextKilo, { thousands: Math.round(tokens / 1024) });}diff --git a/apps/web/src/features/local-models/byok-panel.tsx b/apps/web/src/features/local-models/byok-panel.tsxindex 4f71017b..25684d16 100644--- a/apps/web/src/features/local-models/byok-panel.tsx+++ b/apps/web/src/features/local-models/byok-panel.tsx@@ -30,6 +30,9 @@ import { Icon } from "@/components/ui/icon";import { Select, SelectItem } from "@/components/ui/select";import { TeamHubError } from "@/features/teamhub/teamhub-error";import { useTeamHubRuntime } from "@/features/teamhub/teamhub-runtime";+import { commonMessages } from "@/i18n/common.messages";+import type { Translate } from "@/i18n/language";+import { RichMessage, useT } from "@/i18n/use-translation";import { cn } from "@/lib/cn";import { ByokCombobox } from "./byok-combobox";@@ -43,6 +46,7 @@ import {byokProtocolLabels,modelSourceRuntimeLabels,} from "./local-models-copy";+import { localModelsMessages as m } from "./local-models.messages";import type { ModelSourceSwitcher } from "./model-source-panel";import {type ByokEndpointInput,@@ -77,10 +81,10 @@ function fittedWidth(value: string): CSSProperties {} as CSSProperties;}-const failureCopy = (error: unknown) =>+const failureCopy = (error: unknown, t: Translate) =>error instanceof TeamHubError- ? byokFailureCopy(error.code, error.message)- : byokFailureCopy(undefined, "");+ ? byokFailureCopy(error.code, error.message, t)+ : byokFailureCopy(undefined, "", t);/*** The person's own endpoint, addressed as base URL + path + endpoint. The API@@ -100,6 +104,7 @@ export function ByokPanel({switcher: ModelSourceSwitcher;tenantId: string;}) {+ const t = useT();const { client } = useTeamHubRuntime();const saved = status.byok;const savedRuntime = status.mode === "byok" ? status.runtime : "claude";@@ -163,7 +168,7 @@ export function ByokPanel({[model.name,model.context_window- ? byokContextLabel(model.context_window)+ ? byokContextLabel(model.context_window, t): undefined,].filter(Boolean)@@ -171,12 +176,15 @@ export function ByokPanel({value: model.id,}));const modelHint = models.isPending- ? `Listing models from ${modelsUrl}…`+ ? t(m.byokListingFrom, { url: modelsUrl }): models.isError- ? failureCopy(models.error)+ ? failureCopy(models.error, t): models.data- ? `${listed.length} ${listed.length === 1 ? "model" : "models"} listed from ${models.data.url}.`- : "List the endpoint's models, or type an ID.";+ ? t(m.byokModelsListedFrom, {+ count: listed.length,+ url: models.data.url,+ })+ : t(m.byokModelHint);// Changing the address or key makes listed models and a test result stale;// changing only the endpoint, model or Runtime keeps the listed models.@@ -194,25 +202,22 @@ export function ByokPanel({switcher.request({ byok: input, mode: "byok", runtime });}- const sendsHow = format.fromUrl- ? byokProtocolLabels[format.protocol]- : `${byokProtocolLabels[format.protocol]} (the ${modelSourceRuntimeLabels[runtime]} format)`;const addressHintId = `${ids}-address-hint`;const modelHintId = `${ids}-model-hint`;return (<form- aria-label="BYOK"+ aria-label={t(m.modeByok)}className="mt-6 rounded-xl border border-border"onSubmit={save}><div className="grid grid-cols-1 gap-4 px-4 py-4"><div><p className="mb-1.5 text-sm font-medium text-foreground">- AI runtime+ {t(m.aiRuntime)}</p><Select- aria-label="AI runtime"+ aria-label={t(m.aiRuntime)}className="w-full"disabled={disabled}onValueChange={(value) => {@@ -230,11 +235,13 @@ export function ByokPanel({</div><fieldset className="min-w-0"><legend className="mb-1.5 text-sm font-medium text-foreground">- API address+ {t(m.byokApiAddress)}</legend><div className="grid grid-cols-2 gap-x-1.5 gap-y-2 sm:grid-cols-[minmax(0,1fr)_auto_auto]"><div className="col-span-2 min-w-0 sm:col-span-1">- <AddressLabel htmlFor={`${ids}-base`}>Base URL</AddressLabel>+ <AddressLabel htmlFor={`${ids}-base`}>+ {t(m.baseUrl)}+ </AddressLabel><inputaria-describedby={addressHintId}autoComplete="off"@@ -253,19 +260,21 @@ export function ByokPanel({/></div><div className="min-w-0">- <AddressLabel htmlFor={`${ids}-path`}>Path</AddressLabel>+ <AddressLabel htmlFor={`${ids}-path`}>+ {t(m.byokPath)}+ </AddressLabel><ByokComboboxaria-describedby={addressHintId}aria-invalid={!validByokPath(pathValue)}className="sm:w-max"disabled={disabled}filled={path === DEFAULT_BYOK_PATH}- heading="Path · optional"+ heading={t(m.byokPathHeading)}menuClassName="-left-px sm:left-auto sm:-right-px"id={`${ids}-path`}inputClassName="font-mono text-[13px] sm:w-(--byok-fit) sm:flex-none"inputStyle={fittedWidth(path)}- label="Path"+ label={t(m.byokPath)}onCommit={() => setPath(normalizeByokPath)}onOpenChange={(open) => setMenu(open ? "path" : null)}onValueChange={(value) => {@@ -273,10 +282,10 @@ export function ByokPanel({resetAll();}}open={menu === "path"}- options={byokPathSuggestions.map((option) => ({+ options={byokPathSuggestions(t).map((option) => ({detail:option.value === DEFAULT_BYOK_PATH- ? `${option.label} · Default`+ ? t(m.byokDefaultOption, { label: option.label }): option.label,value: option.value,}))}@@ -285,19 +294,21 @@ export function ByokPanel({/></div><div className="min-w-0">- <AddressLabel htmlFor={`${ids}-endpoint`}>Endpoint</AddressLabel>+ <AddressLabel htmlFor={`${ids}-endpoint`}>+ {t(m.byokEndpoint)}+ </AddressLabel><ByokComboboxaria-describedby={addressHintId}aria-invalid={!validByokPath(endpointValue)}className="sm:w-max"disabled={disabled}filled={endpoint === null}- heading="Endpoint · optional"+ heading={t(m.byokEndpointHeading)}menuClassName="-right-px"id={`${ids}-endpoint`}inputClassName="font-mono text-[13px] sm:w-(--byok-fit) sm:flex-none"inputStyle={fittedWidth(endpoint ?? runtimeEndpoint)}- label="Endpoint"+ label={t(m.byokEndpoint)}onCommit={() =>setEndpoint((current) => {if (current === null) return null;@@ -314,9 +325,12 @@ export function ByokPanel({options={byokEndpointSuggestions.map((option) => ({detail: option.protocol? option.value === runtimeEndpoint- ? `${byokProtocolLabels[option.protocol]} · ${modelSourceRuntimeLabels[runtime]} default`+ ? t(m.byokEndpointRuntimeDefault, {+ protocol: byokProtocolLabels[option.protocol],+ runtime: modelSourceRuntimeLabels[runtime],+ }): byokProtocolLabels[option.protocol]- : "No endpoint. The base URL is the full address.",+ : t(m.byokEndpointNone),value: option.value,}))}placeholder="-"@@ -328,18 +342,22 @@ export function ByokPanel({className="mt-1.5 grid gap-0.5 text-xs text-muted-foreground"id={addressHintId}>- <p>- Base URL from your provider's docs. Path and endpoint are- optional: pick one, type your own, or clear it.- </p>+ <p>{t(m.byokAddressHint)}</p>{!addressValid ? (- <p className="text-destructive">- Path and endpoint take segments like /v1, without spaces, ?, #- or \.- </p>+ <p className="text-destructive">{t(m.byokAddressInvalid)}</p>) : base ? (<p>- Sends {sendsHow} requests to <Url>{requestUrl}</Url>+ <RichMessage+ message={+ format.fromUrl ? m.byokSendsTo : m.byokSendsToRuntimeFormat+ }+ tags={{ url: (text) => <Url>{text}</Url> }}+ values={{+ protocol: byokProtocolLabels[format.protocol],+ runtime: modelSourceRuntimeLabels[runtime],+ url: requestUrl,+ }}+ /></p>) : null}</div>@@ -349,7 +367,7 @@ export function ByokPanel({className="mb-1.5 block text-sm font-medium text-foreground"htmlFor={`${ids}-key`}>- API key+ {t(m.apiKey)}</label><inputaria-describedby={`${ids}-key-hint`}@@ -368,9 +386,7 @@ export function ByokPanel({className="mt-1.5 text-xs text-muted-foreground"id={`${ids}-key-hint`}>- {canReuseSavedKey- ? "A key is saved on this computer. Leave blank to keep it."- : "Optional for an endpoint on this computer or your local network."}+ {t(canReuseSavedKey ? m.keySavedHint : m.keyOptionalHint)}</p></div><div>@@ -378,7 +394,7 @@ export function ByokPanel({className="mb-1.5 block text-sm font-medium text-foreground"htmlFor={`${ids}-model`}>- Model+ {t(m.model)}</label><div className="relative flex gap-1.5"><ByokCombobox@@ -386,7 +402,7 @@ export function ByokPanel({className="min-w-0 flex-1"disabled={disabled}id={`${ids}-model`}- label="Model"+ label={t(m.model)}note={modelOptions.length ? undefined : modelHint}onCommit={() => setModelId((current) => current.trim())}onOpenChange={(open) => setMenu(open ? "model" : null)}@@ -400,14 +416,14 @@ export function ByokPanel({value={modelId}/><Button- aria-label="List models"+ aria-label={t(m.listModels)}disabled={disabled || base === "" || !addressValid}loading={models.isPending}onClick={() =>models.mutate(address, { onSuccess: () => setMenu("model") })}size="large"- title="List models"+ title={t(m.listModels)}>{models.isPending ? null : <Icon icon={RefreshIcon} size={16} />}</Button>@@ -423,16 +439,16 @@ export function ByokPanel({}}size="large">- Test+ {t(m.byokTest)}</Button>{toastShown && test.isSuccess ? (<TestToastonDismiss={() => setToastShown(false)}- title="Connected"+ title={t(m.byokConnected)}tone="success">{test.data.model_id} ·{" "}- {byokContextLabel(test.data.context_window)} ·{" "}+ {byokContextLabel(test.data.context_window, t)} ·{" "}{byokProtocolLabels[test.data.protocol]}<br /><Url>{test.data.url}</Url>@@ -441,10 +457,10 @@ export function ByokPanel({{toastShown && test.isError ? (<TestToastonDismiss={() => setToastShown(false)}- title="Couldn't connect"+ title={t(m.byokCouldNotConnect)}tone="danger">- {failureCopy(test.error)}+ {failureCopy(test.error, t)}</TestToast>) : null}</div>@@ -467,7 +483,7 @@ export function ByokPanel({tone="primary"type="submit">- {active ? "Save" : "Save & Switch to BYOK"}+ {t(active ? commonMessages.save : m.saveAndSwitch)}</Button></footer></form>@@ -515,6 +531,7 @@ function TestToast({title: string;tone: "danger" | "success";}) {+ const t = useT();const toastRef = useRef<HTMLDivElement>(null);const [leaving, setLeaving] = useState(false);const [hovered, setHovered] = useState(false);@@ -571,7 +588,8 @@ function TestToast({<p className="mt-0.5 [overflow-wrap:anywhere]">{children}</p></div><button- aria-label="Dismiss"+ data-voice-close+ aria-label={t(m.byokDismiss)}className="grid size-5 place-items-center rounded-sm text-primary-foreground/60 transition-colors hover:bg-primary-foreground/10 hover:text-primary-foreground"onClick={() => setLeaving(true)}type="button"diff --git a/apps/web/src/features/local-models/local-model-details.tsx b/apps/web/src/features/local-models/local-model-details.tsxindex 97c466f0..099782a7 100644--- a/apps/web/src/features/local-models/local-model-details.tsx+++ b/apps/web/src/features/local-models/local-model-details.tsx@@ -11,6 +11,9 @@ import { Icon } from "@/components/ui/icon";import { ModalDialog } from "@/components/ui/modal-dialog";import { Select, SelectItem } from "@/components/ui/select";import type { TeamHubLocalComputerPage } from "@/features/teamhub/teamhub-types";+import { commonMessages } from "@/i18n/common.messages";+import type { Translate } from "@/i18n/language";+import { useT } from "@/i18n/use-translation";import { cn } from "@/lib/cn";import {@@ -25,12 +28,14 @@ import {modelNoteCopy,unavailableCopy,} from "./local-models-copy";+import { localModelsMessages as m } from "./local-models.messages";import type { LocalModelPool, LocalModelsView } from "./local-models-queries";import {contextLabel,downloadStopped,formatGigabytes,isModelOnComputer,+ joinList,memoryReclaimable,modelCapabilities,modelSourceLabel,@@ -78,6 +83,7 @@ function Fact({}function CopyEndpoint({ endpoint, name }: { endpoint: string; name: string }) {+ const t = useT();const [copied, setCopied] = useState(false);const timerRef = useRef<number | undefined>(undefined);const codeRef = useRef<HTMLElement>(null);@@ -113,12 +119,10 @@ function CopyEndpoint({ endpoint, name }: { endpoint: string; name: string }) {{endpoint}</code><Button- aria-label={- copied ? `Copied ${name} endpoint` : `Copy ${name} endpoint`- }+ aria-label={t(copied ? m.copiedEndpointOf : m.copyEndpointOf, { name })}onClick={copy}size="compactIcon"- title={copied ? "Copied" : "Copy endpoint"}+ title={t(copied ? commonMessages.copied : m.copyEndpoint)}tone="ghost"><Icon icon={copied ? Tick02Icon : Copy01Icon} size={14} />@@ -140,35 +144,39 @@ function selectCodeText(element: HTMLElement | null) {function gatewayFactValue(entry: ModelEntry,view: LocalModelsView,- computer?: TeamHubLocalComputerPage["items"][number],+ computer: TeamHubLocalComputerPage["items"][number] | undefined,+ t: Translate,): ReactNode {+ // The gateway's name alone, the same in every language.if (!computer || !entry.model.pi_model) return "Bifrost";const piRuntime = computer.runtimes.find((runtime) => runtime.type === "pi");if (!piRuntime) {return (- <span className="text-muted-foreground">Bifrost · Pi not installed</span>+ <span className="text-muted-foreground">+ {t(m.gatewayPiNotInstalled)}+ </span>);}if (piRuntime.status === "ready") {if (piRuntime.models.some((item) => item.id === entry.model.pi_model)) {- return "Ready · Bifrost (Pi)";+ return t(m.gatewayReady);}return (- <span className="text-muted-foreground">- Bifrost · Registering with Pi…- </span>+ <span className="text-muted-foreground">{t(m.gatewayRegistering)}</span>);}if (piRuntime.status === "not_installed") {return (<span className="text-muted-foreground">- {view.computer.status === "online"- ? "Bifrost · Setting up Pi…"- : "Bifrost · Pi not installed"}+ {t(+ view.computer.status === "online"+ ? m.gatewaySettingUp+ : m.gatewayPiNotInstalled,+ )}</span>);}- return <span className="text-app-warning">Bifrost · Pi unavailable</span>;+ return <span className="text-app-warning">{t(m.gatewayPiUnavailable)}</span>;}/** Everything about one model on one Computer, shown when its row expands. */@@ -191,6 +199,7 @@ export function ModelFacts({onAssignAgent?: (agent: AssignableLocalModelAgent) => void;view: LocalModelsView;}) {+ const t = useT();const { model, status } = entry;// A stopped download holds only a partial file, so it reads like a model// not yet on the Computer.@@ -198,10 +207,12 @@ export function ModelFacts({const onComputer = isModelOnComputer(model, status);const pool = poolOf(view, model.pool);const plannedPlace =- status === "available" || stopped ? placeName(view, model.pool) : undefined;+ status === "available" || stopped+ ? placeName(view, model.pool, t)+ : undefined;const capabilities = modelCapabilities(model);- const parameters = parametersLabel(model);- const speed = speedLabel(model);+ const parameters = parametersLabel(model, t);+ const speed = speedLabel(model, t);const sourceUrl = safeModelSourceUrl(model.source_url);const reclaimable = memoryReclaimable(view, model);const availableNeedsRoom =@@ -232,6 +243,9 @@ export function ModelFacts({primaryAgent !== undefined &&!isAgentUsingModel(entry, primaryAgent, computerId) &&primaryAgent.busy;+ const memorySize = formatGigabytes(model.memory_bytes, t);+ const memoryPlace =+ onComputer && pool ? poolLabel(view, pool, t) : plannedPlace;return (<div>{model.error || status === "unavailable" ? (@@ -239,17 +253,17 @@ export function ModelFacts({{model.error ? (<Factbordered={false}- label={stopped ? "Last download" : "Last load"}+ label={t(stopped ? m.factLastDownload : m.factLastLoad)}><span className="text-app-danger">- {modelErrorCopy(model.error)}+ {modelErrorCopy(model.error, t)}</span></Fact>) : null}{status === "unavailable" ? (- <Fact bordered={Boolean(model.error)} label="Why not">+ <Fact bordered={Boolean(model.error)} label={t(m.factWhyNot)}><span className="text-app-danger">- {unavailableCopy(model.availability.reason, reclaimable)}+ {unavailableCopy(model.availability.reason, reclaimable, t)}</span></Fact>) : null}@@ -257,9 +271,13 @@ export function ModelFacts({) : null}{model.note ? (<div className="my-1.5 rounded-lg border border-[var(--app-status-warning-border)] bg-[var(--app-status-warning-surface)] px-3 py-0.5">- <Fact bordered={false} label="Note">+ <Fact bordered={false} label={t(m.factNote)}><span className="text-app-warning">- {modelNoteCopy(model.note.code, placeName(view, model.pool))}+ {modelNoteCopy(+ model.note.code,+ placeName(view, model.pool, t),+ t,+ )}</span></Fact></div>@@ -267,60 +285,64 @@ export function ModelFacts({{idleUsedWarning ? (<div className="my-1.5"><FormFeedback tone="warning">- {usedNames.join(", ")} {usedNames.length === 1 ? "uses" : "use"}{" "}- this model. Load it so {usedNames.length === 1 ? "it" : "they"} can- answer.+ {t(m.idleUsedWarning, {+ count: usedNames.length,+ names: joinList(usedNames, t),+ })}</FormFeedback></div>) : null}{availableNeedsRoom ? (<div className="my-1.5"><FormFeedback tone="warning">- This model can download now, but only{" "}- {formatGigabytes(poolFreeBytes(pool))} is free on{" "}- {poolLabel(view, pool)}. Close memory-heavy apps and recheck memory- before loading it.+ {t(m.downloadNeedsRoom, {+ free: formatGigabytes(poolFreeBytes(pool), t),+ pool: poolLabel(view, pool, t),+ })}</FormFeedback></div>) : null}<div className="mt-1 grid grid-cols-1 gap-x-6 @xl:grid-cols-2">{capabilities.length ? (- <Fact className="@xl:col-span-2" label="Capabilities">+ <Fact className="@xl:col-span-2" label={t(m.factCapabilities)}><span className="flex flex-wrap gap-1.5">{capabilities.map((capability) => (<spanclassName="rounded-full bg-muted px-2.5 py-0.5 text-xs font-medium text-secondary-foreground"key={capability}>- {capabilityCopy(capability)}+ {capabilityCopy(capability, t)}</span>))}</span></Fact>) : null}{model.publisher ? (- <Fact label="Publisher">{model.publisher}</Fact>+ <Fact label={t(m.factPublisher)}>{model.publisher}</Fact>) : null}- {parameters ? <Fact label="Parameters">{parameters}</Fact> : null}- <Fact label="Memory">- {formatGigabytes(model.memory_bytes)}- {onComputer && pool- ? ` on ${poolLabel(view, pool)}`- : plannedPlace- ? ` on ${plannedPlace}`- : ""}+ {parameters ? (+ <Fact label={t(m.factParameters)}>{parameters}</Fact>+ ) : null}+ <Fact label={t(m.factMemory)}>+ {memoryPlace+ ? t(m.memoryOn, { place: memoryPlace, size: memorySize })+ : memorySize}+ </Fact>+ <Fact label={t(onComputer ? m.factOnDisk : m.factDownload)}>+ {formatGigabytes(model.download_bytes, t)}</Fact>- <Fact label={onComputer ? "On disk" : "Download"}>- {formatGigabytes(model.download_bytes)}+ <Fact label={t(m.factContext)}>+ {contextLabel(model.context_tokens, t)}</Fact>- <Fact label="Context">{contextLabel(model.context_tokens)}</Fact>- <Fact label="Version">+ <Fact label={t(m.factVersion)}><code className="rounded bg-muted px-1.5 py-0.5 font-mono text-xs text-secondary-foreground">{model.quant}</code></Fact>- {speed ? <Fact label="Speed">{speed}</Fact> : null}- {model.license ? <Fact label="License">{model.license}</Fact> : null}+ {speed ? <Fact label={t(m.factSpeed)}>{speed}</Fact> : null}+ {model.license ? (+ <Fact label={t(m.factLicense)}>{model.license}</Fact>+ ) : null}{onComputer ? (<FactclassName={@@ -328,15 +350,15 @@ export function ModelFacts({? "@xl:col-span-2": undefined}- label="Used by"+ label={t(m.factUsedBy)}><span className="flex flex-wrap items-center gap-2"><span>- {usedNames.length ? usedNames.join(", ") : "No Agent yet"}+ {usedNames.length ? joinList(usedNames, t) : t(m.noAgentYet)}</span>{showAgentPicker && onAssignAgent ? (<Select- aria-label={`Switch an Agent to ${model.name}`}+ aria-label={t(m.switchAgentTo, { name: model.name })}disabled={disabled || Boolean(assigningAgentId)}onValueChange={(actorId) => {const target = unassigned.find(@@ -344,9 +366,9 @@ export function ModelFacts({);if (target) onAssignAgent(target);}}- placeholder={- assigningAgentId ? "Switching…" : "Switch Agent…"- }+ placeholder={t(+ assigningAgentId ? m.switchingAgent : m.switchAgent,+ )}value=""variant="pill">@@ -356,20 +378,22 @@ export function ModelFacts({key={agent.actorId}value={agent.actorId}>- {agent.busy ? `${agent.name} · Working` : agent.name}+ {agent.busy+ ? t(m.agentWorking, { name: agent.name })+ : agent.name}</SelectItem>))}</Select>) : primaryBusy ? (<span className="text-xs text-muted-foreground">- Finish the current turn to switch+ {t(m.finishTurnToSwitch)}</span>) : null}</span></Fact>) : null}{sourceUrl ? (- <Fact className="@xl:col-span-2" label="Source">+ <Fact className="@xl:col-span-2" label={t(m.factSource)}><aclassName="inline-flex max-w-full items-center gap-1 text-foreground underline underline-offset-2"href={sourceUrl}@@ -382,12 +406,12 @@ export function ModelFacts({</Fact>) : null}{status === "loaded" && model.endpoint ? (- <Fact className="@xl:col-span-2" label="Gateway">- {gatewayFactValue(entry, view, computer)}+ <Fact className="@xl:col-span-2" label={t(m.factGateway)}>+ {gatewayFactValue(entry, view, computer, t)}</Fact>) : null}{model.endpoint ? (- <Fact className="@xl:col-span-2" label="Endpoint">+ <Fact className="@xl:col-span-2" label={t(m.factEndpoint)}><CopyEndpointendpoint={model.endpoint.base_url}name={model.name}@@ -408,7 +432,8 @@ function PoolBar({pool: LocalModelPool;view: LocalModelsView;}) {- const label = poolLabel(view, pool);+ const t = useT();+ const label = poolLabel(view, pool, t);// used_bytes is the device's real use; on a shared card other processes// hold memory that no holder accounts for.const otherBytes = poolOtherBytes(pool);@@ -417,10 +442,16 @@ function PoolBar({return (<div className="flex min-h-10 items-center gap-3 py-1.5 text-sm"><span className="w-28 shrink-0 text-muted-foreground">- {pool.kind === "gpu" ? `GPU ${pool.gpu_index}` : label}+ {pool.kind === "gpu"+ ? t(m.gpuIndex, { index: String(pool.gpu_index) })+ : label}</span><span- aria-label={`${label}: ${formatGigabytes(pool.used_bytes)} of ${formatGigabytes(pool.total_bytes)} in use`}+ aria-label={t(m.poolInUse, {+ pool: label,+ total: formatGigabytes(pool.total_bytes, t),+ used: formatGigabytes(pool.used_bytes, t),+ })}className="flex h-1.5 min-w-0 flex-1 overflow-hidden rounded-full bg-muted"role="img">@@ -434,19 +465,21 @@ function PoolBar({)}key={holder.id}style={{ width: width(holder.bytes) }}- title={`${holder.name} · ${formatGigabytes(holder.bytes)}`}+ title={`${holder.name} · ${formatGigabytes(holder.bytes, t)}`}/>))}{otherBytes ? (<spanclassName="h-full bg-muted-foreground/30"style={{ width: width(otherBytes) }}- title={`Other apps · ${formatGigabytes(otherBytes)}`}+ title={t(m.otherAppsSize, {+ size: formatGigabytes(otherBytes, t),+ })}/>) : null}</span><span className="w-24 shrink-0 text-right text-xs whitespace-nowrap tabular-nums text-muted-foreground">- {formatGigabytes(poolFreeBytes(pool))} free+ {t(m.memoryFree, { free: formatGigabytes(poolFreeBytes(pool), t) })}</span></div>);@@ -460,6 +493,7 @@ export function AdvancedDialog({onClose: () => void;view: LocalModelsView;}) {+ const t = useT();const host = view.computer.host;type PoolHolder = LocalModelPool["holders"][number];const seenHolderIds = new Set<string>();@@ -492,13 +526,13 @@ export function AdvancedDialog({}onClose={onClose}size="md"- title={`${view.computer.display_name} details`}+ title={t(m.detailsOf, { name: view.computer.display_name })}><div className="px-5 py-4">{view.pools.length ? (<><h3 className="mb-1 text-sm font-medium text-muted-foreground">- Memory+ {t(m.factMemory)}</h3><div className="divide-y divide-border">{view.pools.map((pool) => (@@ -530,7 +564,7 @@ export function AdvancedDialog({aria-hiddenclassName="size-1.5 rounded-full bg-muted-foreground/30"/>- Other apps+ {t(m.otherApps)}</span>) : null}</p>@@ -545,19 +579,22 @@ export function AdvancedDialog({view.pools.length > 0 && "mt-5",)}>- Hardware+ {t(m.hardware)}</h3><div>- <Fact bordered={false} label="Memory">- {formatGigabytes(host.ram_total_bytes)}+ <Fact bordered={false} label={t(m.factMemory)}>+ {formatGigabytes(host.ram_total_bytes, t)}</Fact>{host.gpus.map((gpu) => (- <Fact key={gpu.index} label={`GPU ${gpu.index}`}>- {gpu.name} · {formatGigabytes(gpu.total_bytes)}+ <Fact+ key={gpu.index}+ label={t(m.gpuIndex, { index: String(gpu.index) })}+ >+ {gpu.name} · {formatGigabytes(gpu.total_bytes, t)}</Fact>))}- <Fact label="Free disk">- {formatGigabytes(host.disk_free_bytes)}+ <Fact label={t(m.factFreeDisk)}>+ {formatGigabytes(host.disk_free_bytes, t)}</Fact></div></>diff --git a/apps/web/src/features/local-models/local-model-dialogs.tsx b/apps/web/src/features/local-models/local-model-dialogs.tsxindex b6a58e24..4406ca9a 100644--- a/apps/web/src/features/local-models/local-model-dialogs.tsx+++ b/apps/web/src/features/local-models/local-model-dialogs.tsx@@ -4,6 +4,8 @@ import { Button } from "@/components/ui/button";import { FormFeedback } from "@/components/ui/form-feedback";import { ModalDialog } from "@/components/ui/modal-dialog";import { sourceCheckClassName } from "@/features/settings/provider-selection-picker";+import { commonMessages } from "@/i18n/common.messages";+import { useT } from "@/i18n/use-translation";import { cn } from "@/lib/cn";import {@@ -11,9 +13,11 @@ import {isAgentUsingModel,usedByAgentNames,} from "./local-model-agents";+import { localModelsMessages as m } from "./local-models.messages";import type { LocalModelsView } from "./local-models-queries";import {formatGigabytes,+ joinList,makeRoomSelection,makesRoom,placeName,@@ -26,20 +30,24 @@ import {/** The amber notice naming the Agents that stop answering. */function AffectedAgents({+ kind,names,- until,}: {+ /** What ends the wait: loading the model again, or choosing another one. */+ kind: "remove" | "unload";names: readonly string[];- until: string;}) {+ const t = useT();const count = names.length;return count ? (<FormFeedback tone="warning">- {names.join(", ")} {count === 1 ? "uses" : "use"} this model and- can't answer until {until}.+ {t(kind === "unload" ? m.affectedUnload : m.affectedRemove, {+ count,+ names: joinList(names, t),+ })}</FormFeedback>) : (- <p className="text-sm text-muted-foreground">No Agent uses this model.</p>+ <p className="text-sm text-muted-foreground">{t(m.noAgentUses)}</p>);}@@ -66,6 +74,7 @@ export function MakeRoomDialog({rechecking?: boolean;view: LocalModelsView;}) {+ const t = useT();const [selected, setSelected] = useState(() => makeRoomSelection(check));const [switchAgents, setSwitchAgents] = useState(true);const roomFreeNow = check.freeBytes >= check.needBytes;@@ -75,7 +84,8 @@ export function MakeRoomDialog({: selected.filter((id) => loadedIds.has(id));const chosen = new Set(effectiveSelected);const enough = roomFreeNow || makesRoom(check, chosen);- const pool = poolLabel(view, check.pool);+ const pool = poolLabel(view, check.pool, t);+ const place = placeName(view, check.pool.id, t);const otherBytes = poolOtherBytes(check.pool);const unifiedFitsHardware =check.pool.kind === "unified" &&@@ -88,7 +98,9 @@ export function MakeRoomDialog({// Free memory never exceeds the pool's total, whatever else closes.const tooBig = check.needBytes > check.pool.total_bytes;const inUse = [- ...(otherBytes ? [{ bytes: otherBytes, id: "", name: "Other apps" }] : []),+ ...(otherBytes+ ? [{ bytes: otherBytes, id: "", name: t(m.otherApps) }]+ : []),...check.kept,];const computerId = view.computer.computer_id;@@ -118,7 +130,12 @@ export function MakeRoomDialog({return (<ModalDialog- description={`${entry.model.name} needs ${formatGigabytes(check.needBytes)} on ${pool}; ${formatGigabytes(check.freeBytes)} is free.`}+ description={t(m.makeRoomDescription, {+ free: formatGigabytes(check.freeBytes, t),+ name: entry.model.name,+ need: formatGigabytes(check.needBytes, t),+ pool,+ })}footer={<>{onRecheck ? (@@ -127,10 +144,10 @@ export function MakeRoomDialog({loading={rechecking}onClick={onRecheck}>- Recheck memory+ {t(m.recheckMemory)}</Button>) : null}- <Button onClick={onClose}>Cancel</Button>+ <Button onClick={onClose}>{t(commonMessages.cancel)}</Button><Buttondisabled={disabled || !enough}onClick={() =>@@ -143,24 +160,25 @@ export function MakeRoomDialog({}tone="primary">- {effectiveSelected.length ? "Unload and load" : "Load"}+ {t(effectiveSelected.length ? m.unloadAndLoad : m.actionLoad)}</Button></>}onClose={onClose}size="md"- title="Make room to load"+ title={t(m.makeRoomTitle)}><div className="grid gap-3 px-5 py-4">{roomFreeNow ? (<FormFeedback tone="success">- Enough memory is free now ({formatGigabytes(check.freeBytes)}{" "}- available). Click Load to start.+ {t(m.roomFreeNow, {+ free: formatGigabytes(check.freeBytes, t),+ })}</FormFeedback>) : check.loaded.length ? (<fieldset className="grid gap-0.5"><legend className="mb-1.5 text-sm text-muted-foreground">- Unload these to free memory:+ {t(m.unloadTheseLegend)}</legend>{check.loaded.map((item) => (<label@@ -195,12 +213,12 @@ export function MakeRoomDialog({computerId,);return names.length- ? `Used by ${names.join(", ")}`- : "Not used";+ ? t(m.usedByNames, { names: joinList(names, t) })+ : t(m.notUsed);})()}</span><span className="w-16 text-right text-xs tabular-nums text-muted-foreground">- {formatGigabytes(item.model.memory_bytes)}+ {formatGigabytes(item.model.memory_bytes, t)}</span></label>))}@@ -208,14 +226,16 @@ export function MakeRoomDialog({) : null}{tooBig ? (<FormFeedback tone="danger">- {entry.model.name} needs more than all{" "}- {formatGigabytes(check.pool.total_bytes)} of {pool}, so it- can't load there.+ {t(m.tooBig, {+ name: entry.model.name,+ pool,+ total: formatGigabytes(check.pool.total_bytes, t),+ })}</FormFeedback>) : reachable ? null : (<>{inUse.length ? (- <ul aria-label="Also using this memory" className="grid gap-0.5">+ <ul aria-label={t(m.alsoUsingMemory)} className="grid gap-0.5">{inUse.map((holder) => (<liclassName="flex min-h-8 items-center gap-2 px-2 text-sm text-app-body"@@ -225,35 +245,50 @@ export function MakeRoomDialog({{holder.name}</span><span className="w-16 text-right text-xs tabular-nums text-muted-foreground">- {formatGigabytes(holder.bytes)}+ {formatGigabytes(holder.bytes, t)}</span></li>))}</ul>) : null}<FormFeedback tone="danger">- {otherBytes > 0 || unifiedFitsHardware- ? `${otherBytes > 0 ? `Other apps are using ${formatGigabytes(otherBytes)}. ` : ""}Close other apps that use ${placeName(view, check.pool.id)}, then ${onRecheck ? "click Recheck memory" : "try again"}.`- : "Unloading models here doesn't free enough. Choose a smaller model."}+ {otherBytes > 0+ ? t(+ onRecheck ? m.otherAppsCloseRecheck : m.otherAppsCloseRetry,+ {+ place: place ?? t(m.placeMemory),+ size: formatGigabytes(otherBytes, t),+ },+ )+ : unifiedFitsHardware+ ? t(+ onRecheck+ ? m.closeOtherAppsRecheck+ : m.closeOtherAppsRetry,+ { place: place ?? t(m.placeMemory) },+ )+ : t(m.unloadNotEnough)}</FormFeedback></>)}{reachable && !enough && otherBytes > 0 ? (<FormFeedback tone="warning">- Other apps are using {formatGigabytes(otherBytes)} on {pool}. Close- unnecessary apps and click Recheck memory to free the remaining- room.+ {t(m.otherAppsOnPool, {+ pool,+ size: formatGigabytes(otherBytes, t),+ })}</FormFeedback>) : reachable && !enough && remainingShortfallBytes > 0 ? (<FormFeedback tone="info">- Select at least {formatGigabytes(remainingShortfallBytes)} more to- unload before loading {entry.model.name}.+ {t(m.selectMore, {+ name: entry.model.name,+ size: formatGigabytes(remainingShortfallBytes, t),+ })}</FormFeedback>) : null}{affected.length ? (<FormFeedback tone="warning">- {affected.join(", ")} can't answer until their model is loaded- again.+ {t(m.affectedUntilReload, { names: joinList(affected, t) })}</FormFeedback>) : null}{canSwitchOnLoad ? (@@ -265,8 +300,13 @@ export function MakeRoomDialog({type="checkbox"/><span>- Switch {affectedAssignable.map((agent) => agent.name).join(", ")}{" "}- to {entry.model.name} once loaded+ {t(m.switchOnceLoaded, {+ agents: joinList(+ affectedAssignable.map((agent) => agent.name),+ t,+ ),+ model: entry.model.name,+ })}</span></label>) : null}@@ -292,6 +332,7 @@ export function UnloadModelDialog({onConfirm: () => void;view: LocalModelsView;}) {+ const t = useT();const pool = poolOf(view, entry.model.pool);const names = usedByAgentNames(entry,@@ -300,23 +341,30 @@ export function UnloadModelDialog({);return (<ModalDialog- description={`Frees ${formatGigabytes(entry.model.memory_bytes)} of ${- pool ? poolLabel(view, pool) : "memory"- }. It stays on disk, so you can load it again later.`}+ description={+ pool+ ? t(m.unloadDescriptionPool, {+ pool: poolLabel(view, pool, t),+ size: formatGigabytes(entry.model.memory_bytes, t),+ })+ : t(m.unloadDescription, {+ size: formatGigabytes(entry.model.memory_bytes, t),+ })+ }footer={<>- <Button onClick={onClose}>Cancel</Button>+ <Button onClick={onClose}>{t(commonMessages.cancel)}</Button><Button disabled={disabled} onClick={onConfirm} tone="primary">- Unload+ {t(m.actionUnload)}</Button></>}onClose={onClose}size="sm"- title={`Unload ${entry.model.name}?`}+ title={t(m.unloadTitle, { name: entry.model.name })}><div className="px-5 py-4">- <AffectedAgents names={names} until="it is loaded again" />+ <AffectedAgents kind="unload" names={names} /></div></ModalDialog>);@@ -338,6 +386,7 @@ export function RemoveModelDialog({onConfirm: () => void;view: LocalModelsView;}) {+ const t = useT();const names = usedByAgentNames(entry,assignableAgents,@@ -345,28 +394,34 @@ export function RemoveModelDialog({);return (<ModalDialog- description={`${+ description={t(entry.status === "loaded"- ? "Unloads it, deletes its files"- : "Deletes its files"- } and frees ${formatGigabytes(entry.model.download_bytes)} of disk on ${view.computer.display_name}. You can download it again later.`}+ ? m.removeDescriptionLoaded+ : m.removeDescription,+ {+ computer: view.computer.display_name,+ size: formatGigabytes(entry.model.download_bytes, t),+ },+ )}footer={<>- <Button onClick={onClose}>Cancel</Button>- <Button disabled={disabled} onClick={onConfirm} tone="danger">- Remove+ <Button onClick={onClose}>{t(commonMessages.cancel)}</Button>+ <Button+ data-voice-risk="never"+ disabled={disabled}+ onClick={onConfirm}+ tone="danger"+ >+ {t(commonMessages.remove)}</Button></>}onClose={onClose}size="sm"- title={`Remove ${entry.model.name}?`}+ title={t(m.removeTitle, { name: entry.model.name })}><div className="px-5 py-4">- <AffectedAgents- names={names}- until={`you choose another model for ${names.length === 1 ? "it" : "them"}`}- />+ <AffectedAgents kind="remove" names={names} /></div></ModalDialog>);diff --git a/apps/web/src/features/local-models/local-model-row.tsx b/apps/web/src/features/local-models/local-model-row.tsxindex df3f48bb..53fa1774 100644--- a/apps/web/src/features/local-models/local-model-row.tsx+++ b/apps/web/src/features/local-models/local-model-row.tsx@@ -18,6 +18,9 @@ import { Link } from "react-router";import { Button, buttonClassName } from "@/components/ui/button";import { Icon, type IconSvgElement } from "@/components/ui/icon";import type { TeamHubLocalComputerPage } from "@/features/teamhub/teamhub-types";+import { commonMessages } from "@/i18n/common.messages";+import type { Message } from "@/i18n/messages";+import { useT } from "@/i18n/use-translation";import { cn } from "@/lib/cn";import {@@ -28,6 +31,7 @@ import {} from "./local-model-agents";import { ModelFacts } from "./local-model-details";import { modelErrorShortCopy, unavailableShortCopy } from "./local-models-copy";+import { localModelsMessages as m } from "./local-models.messages";import type {LocalModel,LocalModelAction,@@ -39,7 +43,9 @@ import {downloadStatusDetail,downloadStopped,formatGigabytes,+ joinList,placeName,+ placeTitle,usedByBadge,type ModelEntry,type ModelStatus,@@ -133,19 +139,19 @@ function cardTone(*/const statusTags: Record<ModelStatus,- { dot?: string; label: string; working?: boolean }+ { dot?: string; label: Message<string>; working?: boolean }> = {- available: { label: "Not downloaded" },+ available: { label: m.statusAvailable },downloading: {dot: "bg-app-info",- label: "Downloading",+ label: m.statusDownloading,working: true,},- failed: { dot: "bg-app-danger", label: "Couldn't load" },- idle: { dot: "bg-muted-foreground/60", label: "Downloaded" },- loaded: { dot: "bg-app-success", label: "Loaded" },- loading: { dot: "bg-app-info", label: "Loading", working: true },- unavailable: { label: "Can't download" },+ failed: { dot: "bg-app-danger", label: m.statusFailed },+ idle: { dot: "bg-muted-foreground/60", label: m.statusIdle },+ loaded: { dot: "bg-app-success", label: m.statusLoaded },+ loading: { dot: "bg-app-info", label: m.statusLoading, working: true },+ unavailable: { label: m.statusUnavailable },};/**@@ -153,10 +159,10 @@ const statusTags: Record<* under way: until a snapshot moves the model on, the status alone would* read as if nothing had happened.*/-const endingLabels: Partial<Record<LocalModelAction, string>> = {- cancel: "Cancelling",- remove: "Removing",- unload: "Unloading",+const endingLabels: Partial<Record<LocalModelAction, Message<string>>> = {+ cancel: m.endingCancel,+ remove: m.endingRemove,+ unload: m.endingUnload,};interface Handlers {@@ -180,6 +186,7 @@ function OpenChatLink({href: string;onClick: (event: MouseEvent) => void;}) {+ const t = useT();return (<LinkclassName={buttonClassName({@@ -190,7 +197,7 @@ function OpenChatLink({onClick={onClick}to={href}>- Open chat+ {t(m.openChat)}</Link>);}@@ -208,8 +215,9 @@ function RowStatusLine({recommended: boolean;slower: boolean;status: ModelStatus;- tag: { dot?: string; label: string; working?: boolean };+ tag: { dot?: string; label: Message<string>; working?: boolean };}) {+ const t = useT();return (<span className="mt-0.5 flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground">{tag.dot ? (@@ -235,21 +243,23 @@ function RowStatusLine({: undefined}>- {tag.label}+ {t(tag.label)}</span>{recommended ? (<>{" · "}{download}{" · "}- <span className="font-medium text-app-info">Recommended</span>+ <span className="font-medium text-app-info">+ {t(m.recommended)}+ </span></>) : slower ? (<>{" · "}{download}{" · "}- <span className="text-app-warning">runs slower</span>+ <span className="text-app-warning">{t(m.runsSlower)}</span></>) : detail ? (` · ${detail}`@@ -312,6 +322,7 @@ function DownloadProgress({model: LocalModel;progress: number;}) {+ const t = useT();const shownProgress =model.download?.step === "verify" && !model.download.total_bytes? 100@@ -319,7 +330,7 @@ function DownloadProgress({return (<div className="px-4 pb-3"><span- aria-label={`${model.name} download progress`}+ aria-label={t(m.downloadProgress, { name: model.name })}aria-valuemax={100}aria-valuemin={0}aria-valuenow={shownProgress}@@ -371,6 +382,7 @@ export function ModelRow({switchingForAgents?: boolean;view: LocalModelsView;}) {+ const t = useT();const panelId = useId();const { model } = entry;// A requested load or download reads as started at once; the snapshot that@@ -385,28 +397,28 @@ export function ModelRow({: entry.status;const started = status !== entry.status;const stopped = status === "failed" && downloadStopped(model);- const where = placeName(view, model.pool);+ const where = placeName(view, model.pool, t);const ending = requested && endingLabels[requested];const tag = ending? {dot: statusTags[status].dot,- label: stopped && requested === "cancel" ? "Discarding" : ending,+ label: stopped && requested === "cancel" ? m.endingDiscard : ending,working: true,}: stopped- ? { ...statusTags.failed, label: "Download stopped" }+ ? { ...statusTags.failed, label: m.statusDownloadStopped }: statusTags[status];const progress = downloadPercent(model);- const download = formatGigabytes(model.download_bytes);+ const download = formatGigabytes(model.download_bytes, t);const recommended = status === "available" && model.recommended;const slower =status === "available" && !model.recommended && model.fit === "system";const brand = familyBrand(model.family);const computerId = view.computer.computer_id;const usedNames = usedByAgentNames(entry, assignableAgents, computerId);- const usedBy = usedByBadge({ ...entry, status }, usedNames);+ const usedBy = usedByBadge({ ...entry, status }, t, usedNames);const usedByTitle = usedNames.length- ? `Used by ${usedNames.join(", ")}`+ ? t(m.usedByNames, { names: joinList(usedNames, t) }): undefined;const primaryAgent = primaryLocalModelAgent(assignableAgents);const primaryUsing = primaryAgent@@ -417,7 +429,7 @@ export function ModelRow({Boolean(model.pi_model) &&Boolean(primaryAgent) &&Boolean(onAssignAgent);- const { badges, overflowTitle } = collapsedRowBadges(model);+ const { badges, overflowTitle } = collapsedRowBadges(model, t);const hasMeta = Boolean(usedBy) || badges.length > 0;const damagedFiles =status === "failed" &&@@ -425,34 +437,61 @@ export function ModelRow({model.error?.code === "MODEL_FILES_MISSING");const detail = {available: download,- downloading: started ? null : downloadStatusDetail(model),- failed: modelErrorShortCopy(model.error) ?? null,+ downloading: started ? null : downloadStatusDetail(model, t),+ failed: modelErrorShortCopy(model.error, t) ?? null,idle: model.note- ? "no room to load yet"+ ? t(m.noRoomYet): usedNames.length- ? "load to answer"+ ? t(m.loadToAnswer): null,loaded: [- where ? `${where[0]!.toUpperCase()}${where.slice(1)}` : undefined,- formatGigabytes(model.memory_bytes),+ placeTitle(view, model.pool, t),+ formatGigabytes(model.memory_bytes, t),].filter(Boolean).join(" · "),loading: where ?? null,- unavailable: unavailableShortCopy(model.availability.reason),+ unavailable: unavailableShortCopy(model.availability.reason, t),}[status];+ // The button's word, what it does, the action it asks for, and its name+ // with the model for assistive technology.const action = ({- available: ["Download", handlers.onDownload, "download"],- downloading: ["Cancel", handlers.onCancel, "cancel"],+ available: [+ m.actionDownload,+ handlers.onDownload,+ "download",+ m.downloadModel,+ ],+ downloading: [+ commonMessages.cancel,+ handlers.onCancel,+ "cancel",+ m.cancelModel,+ ],failed: stopped- ? (["Resume download", handlers.onDownload, "download"] as const)+ ? ([+ m.actionResumeDownload,+ handlers.onDownload,+ "download",+ m.resumeDownloadModel,+ ] as const): damagedFiles- ? (["Remove", handlers.onRemove, "remove"] as const)- : (["Retry", handlers.onLoad, "load"] as const),- idle: ["Load", handlers.onLoad, "load"],- loaded: ["Unload", handlers.onUnload, "unload"],+ ? ([+ commonMessages.remove,+ handlers.onRemove,+ "remove",+ m.removeModel,+ ] as const)+ : ([+ commonMessages.retry,+ handlers.onLoad,+ "load",+ m.retryModel,+ ] as const),+ idle: [m.actionLoad, handlers.onLoad, "load", m.loadModel],+ loaded: [m.actionUnload, handlers.onUnload, "unload", m.unloadModel],loading: null,unavailable: null,} as const@@ -537,7 +576,7 @@ export function ModelRow({>{status === "loaded" && handlers.onUseForAgents ? (<Button- aria-label={`Use ${model.name} for Agents`}+ aria-label={t(m.useForAgentsNamed, { name: model.name })}className="px-2.5"disabled={disabled}loading={switchingForAgents}@@ -548,11 +587,14 @@ export function ModelRow({size="compact"tone="primary">- Use for Agents+ {t(m.useForAgents)}</Button>) : showsPrimaryAssignButton && primaryAgent && onAssignAgent ? (<Button- aria-label={`Use ${model.name} with ${primaryAgent.name}`}+ aria-label={t(m.useWithNamed, {+ agent: primaryAgent.name,+ model: model.name,+ })}className="px-2.5"disabled={disabled || primaryAgent.busy || Boolean(assigningAgentId)@@ -565,12 +607,12 @@ export function ModelRow({size="compact"title={primaryAgent.busy- ? `Wait for ${primaryAgent.name} to finish the current turn`+ ? t(m.waitForTurn, { agent: primaryAgent.name }): undefined}tone="primary">- Use with {primaryAgent.name}+ {t(m.useWith, { agent: primaryAgent.name })}</Button>) : !handlers.onUseForAgents &&canUsePrimary &&@@ -581,7 +623,7 @@ export function ModelRow({) : null}{action ? (<Button- aria-label={`${action[0]} ${model.name}`}+ aria-label={t(action[3], { name: model.name })}className="px-2.5"disabled={disabled}loading={requested === action[2]}@@ -600,7 +642,7 @@ export function ModelRow({: "secondary"}>- {action[0]}+ {t(action[0])}</Button>) : null}<Button@@ -630,7 +672,7 @@ export function ModelRow({className="border-t border-border px-4 pt-1 pb-3"id={panelId}role="region"- aria-label={`${model.name} details`}+ aria-label={t(m.detailsOf, { name: model.name })}>{model.description ? (<p className="pt-2 pb-1 text-sm text-muted-foreground">@@ -651,24 +693,26 @@ export function ModelRow({<div className="mt-2 border-t border-border/70 pt-2.5">{removable ? (<Button+ data-voice-risk="never"disabled={disabled}loading={requested === "remove"}onClick={handlers.onRemove}size="compact"tone="danger">- Remove from computer+ {t(m.removeFromComputer)}</Button>) : null}{stopped ? (<Button+ data-voice-risk="never"disabled={disabled}loading={requested === "cancel"}onClick={handlers.onCancel}size="compact"tone="danger">- Discard download+ {t(m.discardDownload)}</Button>) : null}</div>diff --git a/apps/web/src/features/local-models/local-models-copy.ts b/apps/web/src/features/local-models/local-models-copy.tsindex 29aac7f5..c211e21d 100644--- a/apps/web/src/features/local-models/local-models-copy.ts+++ b/apps/web/src/features/local-models/local-models-copy.ts@@ -1,271 +1,283 @@import type { components } from "@linger/wire-contracts/teamhub-public/types";+import type { Translate } from "@/i18n/language";+import type { Message } from "@/i18n/messages";++import { localModelsMessages as m } from "./local-models.messages";import { formatGigabytes, type MemoryGuidance } from "./local-models-rules";type Schemas = components["schemas"];/**- * Every code the Local models page shows, as English copy. The page branches- * on codes only; diagnostic `detail` text from the Computer is never shown.- * Typing each map by its generated code set makes a new code a type error- * here until it has copy.+ * Every code the Local models page shows, as the message that words it. The+ * page branches on codes only; diagnostic `detail` text from the Computer is+ * never shown. Typing each map by its generated code set makes a new code a+ * type error here until it has copy.*/-const actionRefusals: Record<Schemas["LocalModelsErrorCode"], string> = {- LOCAL_COMPUTER_OFFLINE:- "The computer is offline. Reconnect it in Computers, then try again.",- LOCAL_MODEL_ACTION_FAILED: "The computer couldn't start this. Try again.",- LOCAL_MODEL_ACTION_UNCONFIRMED:- "The computer didn't confirm in time. Its models below show what it's doing.",- LOCAL_MODEL_ACTION_FORBIDDEN:- "Only the person who connected this computer can manage its models.",- LOCAL_MODEL_DISK_INSUFFICIENT:- "There isn't enough free disk on the computer for this model.",- LOCAL_MODEL_INVALID_STATE:- "The model changed on the computer. Check its status and try again.",- LOCAL_MODEL_JOB_RUNNING:- "The computer is still working on this model. Wait for it to finish.",- LOCAL_MODEL_MEMORY_INSUFFICIENT:- "The computer doesn't have enough memory for this model.",- LOCAL_MODEL_NO_ROOM:- "There isn't enough free memory to load it. Close memory-heavy apps or unload another model, then recheck memory.",- LOCAL_MODEL_PLATFORM_UNSUPPORTED: "This model doesn't run on this computer.",- LOCAL_MODEL_UNKNOWN: "The computer doesn't have this model anymore.",- LOCAL_MODELS_SERVICE_UNAVAILABLE:- "Linger couldn't reach the computer right now. Try again.",- LOCAL_MODELS_UNAVAILABLE:- "The local model tools on this computer aren't working.",+const actionRefusals: Record<+ Schemas["LocalModelsErrorCode"],+ Message<string>+> = {+ LOCAL_COMPUTER_OFFLINE: m.refusalOffline,+ LOCAL_MODEL_ACTION_FAILED: m.refusalActionFailed,+ LOCAL_MODEL_ACTION_UNCONFIRMED: m.refusalUnconfirmed,+ LOCAL_MODEL_ACTION_FORBIDDEN: m.refusalForbidden,+ LOCAL_MODEL_DISK_INSUFFICIENT: m.refusalDiskInsufficient,+ LOCAL_MODEL_INVALID_STATE: m.refusalInvalidState,+ LOCAL_MODEL_JOB_RUNNING: m.refusalJobRunning,+ LOCAL_MODEL_MEMORY_INSUFFICIENT: m.refusalMemoryInsufficient,+ LOCAL_MODEL_NO_ROOM: m.refusalNoRoom,+ LOCAL_MODEL_PLATFORM_UNSUPPORTED: m.refusalPlatformUnsupported,+ LOCAL_MODEL_UNKNOWN: m.refusalModelUnknown,+ LOCAL_MODELS_SERVICE_UNAVAILABLE: m.refusalServiceUnavailable,+ LOCAL_MODELS_UNAVAILABLE: m.refusalToolsUnavailable,};/** Why an action or a read failed: a TeamHub error code, or anything else. */-export function actionErrorCopy(code: string | undefined) {+export function actionErrorCopy(code: string | undefined, t: Translate) {if (code === "LOCAL_COMPUTER_NOT_FOUND") {- return "This computer wasn't found. It may have been removed.";+ return t(m.refusalComputerNotFound);}- return code && Object.hasOwn(actionRefusals, code)- ? actionRefusals[code as keyof typeof actionRefusals]- : "Something went wrong. Try again.";+ return t(+ code && Object.hasOwn(actionRefusals, code)+ ? actionRefusals[code as keyof typeof actionRefusals]+ : m.somethingWentWrong,+ );}-const modelErrors: Record<Schemas["LocalModelErrorCode"], string> = {- CANCELLED: "Loading was stopped.",- CHECKSUM_MISMATCH:- "The downloaded files were damaged. Remove the model and download it again.",- DISK_INSUFFICIENT: "There wasn't enough free disk.",- DOWNLOAD_FAILED: "The download didn't finish.",- ENGINE_START_FAILED: "The model engine didn't start.",- GATEWAY_REGISTRATION_FAILED:- "It loaded, but Agents couldn't be given access to it.",- HEALTH_CHECK_FAILED: "The model started but didn't answer.",- INVALID_STATE: "The model was busy with another step.",- JOB_RUNNING: "Another step was still running.",- LOAD_NO_ROOM: "There wasn't enough free memory to load it.",- MEMORY_INSUFFICIENT: "The computer doesn't have enough memory for it.",- MODEL_FILES_MISSING:- "Its files are missing. Remove the model and download it again.",- MODEL_UNKNOWN: "The computer doesn't know this model anymore.",- NETWORK_UNAVAILABLE: "The computer couldn't reach the network.",- OUT_OF_MEMORY: "It ran out of memory while loading.",- PLATFORM_UNSUPPORTED: "This model doesn't run on this computer.",+const modelErrors: Record<Schemas["LocalModelErrorCode"], Message<string>> = {+ CANCELLED: m.errorCancelled,+ CHECKSUM_MISMATCH: m.errorChecksumMismatch,+ DISK_INSUFFICIENT: m.errorDiskInsufficient,+ DOWNLOAD_FAILED: m.errorDownloadFailed,+ ENGINE_START_FAILED: m.errorEngineStartFailed,+ GATEWAY_REGISTRATION_FAILED: m.errorGatewayRegistrationFailed,+ HEALTH_CHECK_FAILED: m.errorHealthCheckFailed,+ INVALID_STATE: m.errorInvalidState,+ JOB_RUNNING: m.errorJobRunning,+ LOAD_NO_ROOM: m.errorLoadNoRoom,+ MEMORY_INSUFFICIENT: m.errorMemoryInsufficient,+ MODEL_FILES_MISSING: m.errorModelFilesMissing,+ MODEL_UNKNOWN: m.errorModelUnknown,+ NETWORK_UNAVAILABLE: m.errorNetworkUnavailable,+ OUT_OF_MEMORY: m.errorOutOfMemory,+ PLATFORM_UNSUPPORTED: m.refusalPlatformUnsupported,};-const modelErrorCauses: Record<+const modelErrorCauses = {+ GATEWAY_HOME_NOT_PRIVATE: {+ withPath: m.errorGatewayHomeNotPrivatePath,+ withoutPath: m.errorGatewayHomeNotPrivate,+ },+} satisfies Record<NonNullable<Schemas["LocalModelError"]["cause"]>,- (path: string | undefined) => string-> = {- GATEWAY_HOME_NOT_PRIVATE: (path) =>- path- ? `It loaded, but Agents couldn't be given access to it: the folder ${path} belongs to another account. Quit Linger, rename that folder, then open Linger and load the model again.`- : "It loaded, but Agents couldn't be given access to it: a Linger folder on the computer belongs to another account.",-};+ { withPath: Message; withoutPath: Message }+>;const modelErrorsShort: Record<Schemas["LocalModelErrorCode"],- string | undefined+ Message<string> | undefined> = {- CANCELLED: "loading stopped",- CHECKSUM_MISMATCH: "files damaged",- DISK_INSUFFICIENT: "not enough disk",+ CANCELLED: m.shortCancelled,+ CHECKSUM_MISMATCH: m.shortChecksumMismatch,+ DISK_INSUFFICIENT: m.shortDiskInsufficient,DOWNLOAD_FAILED: undefined,- ENGINE_START_FAILED: "engine didn't start",- GATEWAY_REGISTRATION_FAILED: "Agents couldn't reach it",- HEALTH_CHECK_FAILED: "model didn't answer",- INVALID_STATE: "busy with another step",- JOB_RUNNING: "busy with another step",- LOAD_NO_ROOM: "not enough free memory",- MEMORY_INSUFFICIENT: "not enough memory",- MODEL_FILES_MISSING: "files missing",- MODEL_UNKNOWN: "no longer on computer",- NETWORK_UNAVAILABLE: "network unavailable",- OUT_OF_MEMORY: "ran out of memory",- PLATFORM_UNSUPPORTED: "not for this computer",+ ENGINE_START_FAILED: m.shortEngineStartFailed,+ GATEWAY_REGISTRATION_FAILED: m.shortGatewayRegistrationFailed,+ HEALTH_CHECK_FAILED: m.shortHealthCheckFailed,+ INVALID_STATE: m.shortBusy,+ JOB_RUNNING: m.shortBusy,+ LOAD_NO_ROOM: m.shortLoadNoRoom,+ MEMORY_INSUFFICIENT: m.shortMemoryInsufficient,+ MODEL_FILES_MISSING: m.shortModelFilesMissing,+ MODEL_UNKNOWN: m.shortModelUnknown,+ NETWORK_UNAVAILABLE: m.shortNetworkUnavailable,+ OUT_OF_MEMORY: m.shortOutOfMemory,+ PLATFORM_UNSUPPORTED: m.shortNotForComputer,};/** Short failure summary for a collapsed model row; undefined when the status label suffices. */export function modelErrorShortCopy(error: Schemas["LocalModelError"] | undefined,+ t: Translate,) {- return error ? modelErrorsShort[error.code] : undefined;+ const message = error ? modelErrorsShort[error.code] : undefined;+ return message ? t(message) : undefined;}/*** Why the last load or download of a model failed. A cause names the fix;* its path reaches only the Computer's owner.*/-export function modelErrorCopy(error: Schemas["LocalModelError"]) {- return error.cause- ? modelErrorCauses[error.cause](error.path)- : modelErrors[error.code];+export function modelErrorCopy(+ error: Schemas["LocalModelError"],+ t: Translate,+) {+ if (!error.cause) return t(modelErrors[error.code]);+ const cause = modelErrorCauses[error.cause];+ return error.path+ ? t(cause.withPath, { path: error.path })+ : t(cause.withoutPath);}-const notes: Record<- Schemas["LocalModelNote"]["code"],- (place: string) => string-> = {- NO_ROOM_TO_LOAD: (place) =>- `It downloaded, but there wasn't enough free ${place} to load it. Load it when there is room.`,-};+const notes = {+ NO_ROOM_TO_LOAD: m.noteNoRoomToLoad,+} satisfies Record<Schemas["LocalModelNote"]["code"], Message>;/** Why a finished download did not load by itself; `place` names its memory. */export function modelNoteCopy(code: Schemas["LocalModelNote"]["code"],- place = "memory",+ place: string | undefined,+ t: Translate,) {- return notes[code](place);+ return t(notes[code], { place: place ?? t(m.placeMemory) });}type AvailabilityReason = Schemas["LocalModelAvailabilityReason"];/** The short reason on a row that can't be downloaded. */-export function unavailableShortCopy(reason: AvailabilityReason | undefined) {+export function unavailableShortCopy(+ reason: AvailabilityReason | undefined,+ t: Translate,+) {if (reason?.code === "PLATFORM_UNSUPPORTED" || !reason)- return "not for this computer";- const need =- reason.need_bytes === undefined ? "" : formatGigabytes(reason.need_bytes);- if (!need)- return reason.code === "DISK_INSUFFICIENT"- ? "needs more disk"- : "needs more memory";+ return t(m.shortNotForComputer);+ if (reason.need_bytes === undefined)+ return t(+ reason.code === "DISK_INSUFFICIENT"+ ? m.shortNeedsDisk+ : m.shortNeedsMemory,+ );+ const need = formatGigabytes(reason.need_bytes, t);return reason.code === "DISK_INSUFFICIENT"- ? `needs ${need} of disk`- : `needs ${need}`;+ ? t(m.shortNeedsDiskSize, { need })+ : t(m.shortNeedsSize, { need });}/** The full reason a model can't be downloaded, shown in its details. */export function unavailableCopy(reason: AvailabilityReason | undefined,- reclaimable = false,+ reclaimable: boolean,+ t: Translate,) {- const need =- reason?.need_bytes === undefined- ? undefined- : formatGigabytes(reason.need_bytes);- const have =- reason?.have_bytes === undefined+ const sizes =+ reason?.need_bytes === undefined || reason.have_bytes === undefined? undefined- : formatGigabytes(reason.have_bytes);+ : {+ have: formatGigabytes(reason.have_bytes, t),+ need: formatGigabytes(reason.need_bytes, t),+ };switch (reason?.code) {- case "MEMORY_INSUFFICIENT": {- const base =- need && have- ? `Needs ${need} of memory; this computer has ${have} for models.`- : "This computer doesn't have enough memory for it.";- return reclaimable- ? `${base} Close memory-heavy apps and recheck memory.`- : base;- }+ case "MEMORY_INSUFFICIENT":+ if (sizes)+ return t(+ reclaimable+ ? m.unavailableMemorySizesReclaimable+ : m.unavailableMemorySizes,+ sizes,+ );+ return t(+ reclaimable ? m.unavailableMemoryReclaimable : m.unavailableMemory,+ );case "DISK_INSUFFICIENT":- return need && have- ? `Needs ${need} of disk; ${have} is free.`- : "There isn't enough free disk for it.";+ return sizes ? t(m.unavailableDiskSizes, sizes) : t(m.unavailableDisk);default:- return "This model doesn't run on this computer.";+ return t(m.refusalPlatformUnsupported);}}-const libraryUnavailable: Record<- Schemas["LocalModelsViewUnavailableReason"]["code"],- { body: string; title: (computer: string) => string }-> = {+const libraryUnavailable = {NOT_REPORTED: {- body: "It reports them once it connects with an up-to-date Linger app.",- title: (computer) => `${computer} hasn't reported local models yet`,+ body: m.libraryNotReportedBody,+ title: m.libraryNotReportedTitle,},TOOL_FAILED: {- body: "The local model tools on this computer didn't answer. Check that they're installed and working, then open this page again.",- title: (computer) => `Couldn't read the local models on ${computer}`,+ body: m.libraryToolFailedBody,+ title: m.libraryToolFailedTitle,},TOOL_NOT_INSTALLED: {- body: "Run Quick Install in the Linger desktop app on that computer to add them.",- title: (computer) => `Local models aren't set up on ${computer}`,+ body: m.libraryToolNotInstalledBody,+ title: m.libraryToolNotInstalledTitle,},-};+} satisfies Record<+ Schemas["LocalModelsViewUnavailableReason"]["code"],+ { body: Message<string>; title: Message }+>;/** Why a Computer reports no model library. */export function libraryUnavailableCopy(code: Schemas["LocalModelsViewUnavailableReason"]["code"] | undefined,computer: string,+ t: Translate,) {const copy = libraryUnavailable[code ?? "NOT_REPORTED"];- return { body: copy.body, title: copy.title(computer) };+ return { body: t(copy.body), title: t(copy.title, { computer }) };}-const capabilityLabels: Record<Schemas["LocalModelCapability"], string> = {- coding: "Coding",- multilingual: "Multilingual",- reasoning: "Reasoning",- tool_use: "Tool use",- vision: "Vision",+const capabilityLabels: Record<+ Schemas["LocalModelCapability"],+ Message<string>+> = {+ coding: m.capabilityCoding,+ multilingual: m.capabilityMultilingual,+ reasoning: m.capabilityReasoning,+ tool_use: m.capabilityToolUse,+ vision: m.capabilityVision,};/** Human-readable badge label for a verified model capability. */-export function capabilityCopy(capability: Schemas["LocalModelCapability"]) {- return capabilityLabels[capability];+export function capabilityCopy(+ capability: Schemas["LocalModelCapability"],+ t: Translate,+) {+ return t(capabilityLabels[capability]);}-const architectureLabels: Record<Schemas["LocalModelArchitecture"], string> = {- dense: "Dense",- moe: "MoE",+const architectureLabels: Record<+ Schemas["LocalModelArchitecture"],+ Message<string>+> = {+ dense: m.architectureDense,+ moe: m.architectureMoe,};/** Human-readable architecture label for display in model details. */export function architectureCopy(architecture: Schemas["LocalModelArchitecture"],+ t: Translate,) {- return architectureLabels[architecture];+ return t(architectureLabels[architecture]);}-const modelSourceRefusals: Record<Schemas["ModelSourceErrorCode"], string> = {- AGENT_HAS_ACTIVE_RUNS: "Agents on this computer are working on tasks.",- BYOK_AUTH_FAILED: "The endpoint rejected the API key.",- BYOK_INVALID_CONFIG:- "The computer can't use this endpoint. An HTTPS endpoint needs an API key; plain HTTP works only on this computer or your local network.",- BYOK_NOT_FOUND:- "Nothing answered at the endpoint's address, or it doesn't serve this model ID.",- BYOK_UNREACHABLE: "The computer couldn't reach the endpoint.",- BYOK_UPSTREAM_REJECTED: "The endpoint rejected the test request.",- LOCAL_COMPUTER_OFFLINE:- "The computer is offline. Reconnect it in Computers, then try again.",- LOCAL_MODEL_NO_ROOM:- "There isn't enough free memory on the computer to load that model. Close memory-heavy apps or unload another model, recheck memory, and try again.",- LOCAL_MODEL_UNKNOWN: "The computer doesn't have this model anymore.",- MODEL_SOURCE_FAILED: "The computer couldn't switch. Try again.",- MODEL_SOURCE_FORBIDDEN:- "Only the person who connected this computer can change its models.",- MODEL_SOURCE_SERVICE_UNAVAILABLE:- "Linger couldn't reach the computer right now. Try again.",- MODEL_SOURCE_UNAVAILABLE:- "This computer can't switch models. Update Linger on it, then try again.",- MODEL_SOURCE_UNCONFIRMED:- "The computer didn't answer in time. It may still be switching; check again in a minute.",- RUNTIME_NOT_ENABLED: "This AI runtime isn't set up on the computer.",+const modelSourceRefusals: Record<+ Schemas["ModelSourceErrorCode"],+ Message<string>+> = {+ AGENT_HAS_ACTIVE_RUNS: m.sourceAgentsWorking,+ BYOK_AUTH_FAILED: m.sourceByokAuthFailed,+ BYOK_INVALID_CONFIG: m.sourceByokInvalidConfig,+ BYOK_NOT_FOUND: m.sourceByokNotFound,+ BYOK_UNREACHABLE: m.sourceByokUnreachable,+ BYOK_UPSTREAM_REJECTED: m.sourceByokUpstreamRejected,+ LOCAL_COMPUTER_OFFLINE: m.refusalOffline,+ LOCAL_MODEL_NO_ROOM: m.sourceNoRoom,+ LOCAL_MODEL_UNKNOWN: m.refusalModelUnknown,+ MODEL_SOURCE_FAILED: m.sourceSwitchFailed,+ MODEL_SOURCE_FORBIDDEN: m.sourceForbidden,+ MODEL_SOURCE_SERVICE_UNAVAILABLE: m.refusalServiceUnavailable,+ MODEL_SOURCE_UNAVAILABLE: m.sourceUnavailable,+ MODEL_SOURCE_UNCONFIRMED: m.sourceUnconfirmed,+ RUNTIME_NOT_ENABLED: m.sourceRuntimeNotEnabled,};/** Why a model-source switch or endpoint test failed. */-export function modelSourceErrorCopy(code: string | undefined) {- return code && Object.hasOwn(modelSourceRefusals, code)- ? modelSourceRefusals[code as keyof typeof modelSourceRefusals]- : "Something went wrong. Try again.";+export function modelSourceErrorCopy(code: string | undefined, t: Translate) {+ return t(+ code && Object.hasOwn(modelSourceRefusals, code)+ ? modelSourceRefusals[code as keyof typeof modelSourceRefusals]+ : m.somethingWentWrong,+ );}// For these the Computer's own message names the address it sent to and the@@ -278,26 +290,40 @@ const byokEndpointRefusals = new Set([]);/** Why a request to a BYOK endpoint (a test or a model listing) failed. */-export function byokFailureCopy(code: string | undefined, message: string) {+export function byokFailureCopy(+ code: string | undefined,+ message: string,+ t: Translate,+) {return code && byokEndpointRefusals.has(code) && message? message- : modelSourceErrorCopy(code);+ : modelSourceErrorCopy(code, t);}/** Why reading a Computer's model source failed. */-export function modelSourceReadErrorCopy(code: string | undefined) {+export function modelSourceReadErrorCopy(+ code: string | undefined,+ t: Translate,+) {if (code === "MODEL_SOURCE_SERVICE_UNAVAILABLE") {- return modelSourceRefusals.MODEL_SOURCE_SERVICE_UNAVAILABLE;+ return t(modelSourceRefusals.MODEL_SOURCE_SERVICE_UNAVAILABLE);}if (code === "MODEL_SOURCE_UNCONFIRMED") {- return "The computer didn't answer in time. Try again.";+ return t(m.sourceReadUnconfirmed);}- return "Couldn't read how Agents on this computer get their model. Try again.";+ return t(m.sourceReadFailed);}-export const modelSourceModeLabels: Record<Schemas["ModelSourceMode"], string> =- { byok: "BYOK", local: "Local model", subscription: "Subscription" };+export const modelSourceModeLabels: Record<+ Schemas["ModelSourceMode"],+ Message<string>+> = {+ byok: m.modeByok,+ local: m.modeLocal,+ subscription: m.modeSubscription,+};+/** Product and protocol names read the same in every language. */export const modelSourceRuntimeLabels: Record<Schemas["ModelSourceRuntime"],string@@ -309,27 +335,40 @@ export const byokProtocolLabels: Record<Schemas["ByokProtocol"], string> = {"openai-responses": "OpenAI Responses",};+const memoryGuidanceMessages = {+ blocked_download: {+ body: m.guidanceBlockedDownloadBody,+ bodyGpu: m.guidanceBlockedDownloadBodyGpu,+ title: m.guidanceBlockedDownloadTitle,+ titleGpu: m.guidanceBlockedDownloadTitleGpu,+ },+ blocked_load: {+ body: m.guidanceBlockedLoadBody,+ bodyGpu: m.guidanceBlockedLoadBodyGpu,+ title: m.guidanceBlockedLoadTitle,+ titleGpu: m.guidanceBlockedLoadTitleGpu,+ },+ constrained_pool: {+ body: m.guidanceConstrainedBody,+ bodyGpu: m.guidanceConstrainedBodyGpu,+ title: m.guidanceConstrainedTitle,+ titleGpu: m.guidanceConstrainedTitleGpu,+ },+} satisfies Record<+ MemoryGuidance["kind"],+ Record<"body" | "bodyGpu", Message> &+ Record<"title" | "titleGpu", Message<string>>+>;+/** Guidance telling the owner how freeing external memory unlocks larger models. */-export function memoryGuidanceCopy(guidance: MemoryGuidance) {- const memoryKind = guidance.gpu ? "GPU memory" : "memory";- const other = formatGigabytes(guidance.otherBytes);- const free = formatGigabytes(guidance.freeBytes);- const total = formatGigabytes(guidance.totalBytes);- switch (guidance.kind) {- case "blocked_load":- return {- body: `Other apps are holding ${other} of ${memoryKind} (${free} of ${total} free). Forcing a model into tight memory can freeze the computer. Close video players, games, browsers, or other memory-heavy apps, then click Recheck memory to load it.`,- title: `Free ${memoryKind} before loading`,- };- case "blocked_download":- return {- body: `Other apps are holding ${other} of ${memoryKind} (${free} of ${total} free), so larger models look unavailable right now. Close unnecessary apps (such as video players, games, or browsers) and click Recheck memory to detect all free memory before installing.`,- title: `Free ${memoryKind} to install a larger model`,- };- case "constrained_pool":- return {- body: `Other apps are using ${other} of ${memoryKind} (${free} of ${total} free). To avoid loading failures or system freezes, close unnecessary apps and click Recheck memory so you can load a better model.`,- title: `Other apps are using ${memoryKind}`,- };- }+export function memoryGuidanceCopy(guidance: MemoryGuidance, t: Translate) {+ const copy = memoryGuidanceMessages[guidance.kind];+ return {+ body: t(guidance.gpu ? copy.bodyGpu : copy.body, {+ free: formatGigabytes(guidance.freeBytes, t),+ other: formatGigabytes(guidance.otherBytes, t),+ total: formatGigabytes(guidance.totalBytes, t),+ }),+ title: t(guidance.gpu ? copy.titleGpu : copy.title),+ };}diff --git a/apps/web/src/features/local-models/local-models-page.tsx b/apps/web/src/features/local-models/local-models-page.tsxindex b565f507..aedbe227 100644--- a/apps/web/src/features/local-models/local-models-page.tsx+++ b/apps/web/src/features/local-models/local-models-page.tsx@@ -32,6 +32,9 @@ import type {TeamHubLocalComputerPage,TeamHubTenantAgent,} from "@/features/teamhub/teamhub-types";+import { commonMessages } from "@/i18n/common.messages";+import { translate } from "@/i18n/language";+import { RichMessage, useT, useTranslation } from "@/i18n/use-translation";import {type AssignableLocalModelAgent,@@ -53,6 +56,7 @@ import {memoryGuidanceCopy,modelSourceReadErrorCopy,} from "./local-models-copy";+import { localModelsMessages as m } from "./local-models.messages";import {actOnLocalComputerModel,localModelActionMutationKey,@@ -67,6 +71,7 @@ import {import {downloadStopped,formatGigabytes,+ joinList,loadCheck,localSwitchTargets,memoryGuidance,@@ -119,6 +124,7 @@ type InventoryComputer = TeamHubLocalComputerPage["items"][number];* and a browser the first one.*/export function ModelsPage() {+ const t = useT();const { client } = useTeamHubRuntime();const tenantId = requireRoomRouteParam(useParams().tenantId, "Tenant");const { data: inventory } = useSuspenseQuery(@@ -176,16 +182,16 @@ export function ModelsPage() {/>) : (<>- <h1 className="text-2xl text-foreground">Models</h1>- <EmptyState title="No computers yet">- Connect a computer in{" "}- <Link- className="text-foreground underline underline-offset-2"- to={computersPath(tenantId)}- >- Computers- </Link>{" "}- to download and run models on it.+ <h1 className="text-2xl text-foreground">{t(m.title)}</h1>+ <EmptyState title={t(m.noComputersTitle)}>+ <RichMessage+ message={m.noComputersBody}+ tags={{+ link: (text) => (+ <ComputersLink tenantId={tenantId}>{text}</ComputersLink>+ ),+ }}+ /></EmptyState></>)}@@ -219,6 +225,24 @@ function EmptyState({);}+/** The link to Settings › Computers inside a sentence. */+function ComputersLink({+ children,+ tenantId,+}: {+ children: ReactNode;+ tenantId: string;+}) {+ return (+ <Link+ className="text-foreground underline underline-offset-2"+ to={computersPath(tenantId)}+ >+ {children}+ </Link>+ );+}+function Notice({ children }: { children: ReactNode }) {return (<p@@ -250,6 +274,8 @@ function ComputerModels({ownedComputers: readonly InventoryComputer[];tenantId: string;}) {+ const translation = useTranslation();+ const { t } = translation;const { client } = useTeamHubRuntime();const queryClient = useQueryClient();const query = useQuery(localModelsQueryOptions(client, tenantId, computerId));@@ -297,7 +323,7 @@ function ComputerModels({// off it; the Subscription tab is not offered.const shownTab = tab ?? (status?.mode === "byok" ? "byok" : "local");const computerName =- displayName ?? view?.computer.display_name ?? "this computer";+ displayName ?? view?.computer.display_name ?? t(m.thisComputer);const { feedback, switcher } = useModelSourceSwitch({computerId,computerName,@@ -333,7 +359,7 @@ function ComputerModels({: Boolean(view && ownedComputers.length > 0);const computerPicker = showComputerPicker ? (<Select- aria-label="Computer"+ aria-label={t(m.computerPicker)}onValueChange={onSelectComputer}value={computerId}variant="pill"@@ -342,14 +368,14 @@ function ComputerModels({<SelectItem value={computerId}>{view.computer.status === "online"? view.computer.display_name- : `${view.computer.display_name} · Offline`}+ : t(m.computerOffline, { name: view.computer.display_name })}</SelectItem>) : null}{ownedComputers.map((item) => (<SelectItem key={item.computer_id} value={item.computer_id}>{item.status === "online"? item.display_name- : `${item.display_name} · Offline`}+ : t(m.computerOffline, { name: item.display_name })}</SelectItem>))}</Select>@@ -365,24 +391,32 @@ function ComputerModels({<><header className="flex flex-wrap items-start justify-between gap-3 sm:gap-4"><div className="min-w-48 flex-1">- <h1 className="text-2xl text-foreground">Models</h1>+ <h1 className="text-2xl text-foreground">{t(m.title)}</h1>{status ? (<p className="mt-1.5 text-sm text-muted-foreground">- Agents on {computerName} use {activeSourceLabel(status)}+ {t(m.agentsUse, {+ computer: computerName,+ source: activeSourceLabel(status, t),+ })}</p>) : null}{summary?.totalBytes ? (<><p className="mt-1.5 text-sm text-muted-foreground">- {formatGigabytes(summary.usedBytes)} of{" "}- {formatGigabytes(summary.totalBytes)}{" "}- {summary.gpu ? "GPU memory" : "memory"} in use+ {t(summary.gpu ? m.gpuMemoryInUse : m.memoryInUse, {+ total: formatGigabytes(summary.totalBytes, t),+ used: formatGigabytes(summary.usedBytes, t),+ })}</p><p className="mt-0.5 text-xs text-muted-foreground">- {formatGigabytes(summary.freeBytes)} free{view?.observed_at- ? ` · Checked ${relativeTime(view.observed_at)}`- : ""}+ ? t(m.memoryFreeChecked, {+ free: formatGigabytes(summary.freeBytes, t),+ time: relativeTime(view.observed_at, translation),+ })+ : t(m.memoryFree, {+ free: formatGigabytes(summary.freeBytes, t),+ })}</p></>) : null}@@ -395,7 +429,7 @@ function ComputerModels({onClick={() => refresh.mutate()}size="compact">- Recheck memory+ {t(m.recheckMemory)}</Button>) : null}{view?.available ? (@@ -403,7 +437,7 @@ function ComputerModels({onClick={() => setDialog({ kind: "advanced" })}size="compact">- Details+ {t(m.details)}</Button>) : null}</div>@@ -425,6 +459,7 @@ function ComputerModels({source.error instanceof TeamHubError? source.error.code: undefined,+ t,)}</span><button@@ -433,7 +468,7 @@ function ComputerModels({onClick={() => void source.refetch()}type="button">- {source.isFetching ? "Retrying…" : "Retry"}+ {t(source.isFetching ? m.retrying : commonMessages.retry)}</button></span></FormFeedback>@@ -447,13 +482,13 @@ function ComputerModels({{refreshError ? (<div className="mt-4"><FormFeedback tone="danger">- {actionErrorCopy(refreshError)}+ {actionErrorCopy(refreshError, t)}</FormFeedback></div>) : null}{switching ? (<p className="mt-4 text-sm text-muted-foreground" role="status">- Switching {computerName}. This can take a few minutes the first time.+ {t(m.switchingComputer, { computer: computerName })}</p>) : null}{feedback}@@ -461,21 +496,12 @@ function ComputerModels({<>{offline && view ? (<Notice>- <span className="text-foreground">- {view.computer.display_name} is offline- {view.computer.last_seen_at- ? ` (last seen ${relativeTime(view.computer.last_seen_at)})`- : ""}- .- </span>{" "}- Reconnect it in{" "}- <Link- className="text-foreground underline underline-offset-2"- to={computersPath(tenantId)}- >- Computers- </Link>{" "}- to test or change its model source.+ <OfflineMessage+ lastSeenAt={view.computer.last_seen_at}+ messages={[m.offlineByok, m.offlineByokLastSeen]}+ name={view.computer.display_name}+ tenantId={tenantId}+ /></Notice>) : null}<ByokPanel@@ -527,27 +553,71 @@ function ComputerModels({size="compact"tone="primary">- Open {defaultComputerName ?? "my computers"}+ {defaultComputerName+ ? t(m.openComputer, { name: defaultComputerName })+ : t(m.openMyComputers)}</Button>) : null}<Button onClick={() => void query.refetch()} size="compact">- Try again+ {t(commonMessages.tryAgain)}</Button></div>}- title={`Couldn't load the models of ${displayName ?? "this computer"}`}+ title={+ displayName === undefined+ ? t(m.loadFailedTitleThisComputer)+ : t(m.loadFailedTitle, { name: displayName })+ }>- {actionErrorCopy(queryErrorCode)}+ {actionErrorCopy(queryErrorCode, t)}</EmptyState>) : (<p className="mt-6 text-sm text-muted-foreground" role="status">- Loading models+ {t(m.loadingModels)}</p>)}</>);}+/**+ * A Computer is offline, with when it was last seen once known. `messages`+ * holds the sentence without and with that time.+ */+function OfflineMessage({+ lastSeenAt,+ messages,+ name,+ tenantId,+}: {+ lastSeenAt: string | null | undefined;+ messages:+ | readonly [typeof m.offlineByok, typeof m.offlineByokLastSeen]+ | readonly [typeof m.offlineLibrary, typeof m.offlineLibraryLastSeen]+ | readonly [typeof m.offlineReadOnly, typeof m.offlineReadOnlyLastSeen];+ name: string;+ tenantId: string;+}) {+ const translation = useTranslation();+ const tags = {+ link: (text: ReactNode) => (+ <ComputersLink tenantId={tenantId}>{text}</ComputersLink>+ ),+ strong: (text: ReactNode) => (+ <span className="text-foreground">{text}</span>+ ),+ };+ return lastSeenAt ? (+ <RichMessage+ message={messages[1]}+ tags={tags}+ values={{ name, time: relativeTime(lastSeenAt, translation) }}+ />+ ) : (+ <RichMessage message={messages[0]} tags={tags} values={{ name }} />+ );+}+function Library({computer,dialog,@@ -575,6 +645,7 @@ function Library({tenantId: string;view: LocalModelsView;}) {+ const t = useT();const { client } = useTeamHubRuntime();const queryClient = useQueryClient();const computerId = view.computer.computer_id;@@ -732,9 +803,7 @@ function Library({onError: (error, variables) => {if (!variables.preserveError) {setAssignError(- error instanceof Error- ? error.message- : "Couldn't switch the Agent to this model. Try again.",+ error instanceof Error ? error.message : translate(m.assignFailed),);}void Promise.all([@@ -880,7 +949,13 @@ function Library({const targets = matching.filter((agent) => !agent.busy);setPendingSwitch(null);const busyMessage = busySkipped.length- ? `Couldn't switch ${busySkipped.map((agent) => agent.name).join(", ")} to ${target.model.name} while working. Switch once the current turn finishes.`+ ? translate(m.assignBusy, {+ agents: joinList(+ busySkipped.map((agent) => agent.name),+ translate,+ ),+ model: target.model.name,+ }): null;if (busyMessage) {setAssignError(busyMessage);@@ -895,9 +970,18 @@ function Library({.filter((_, index) => results[index]?.status === "rejected").map((agent) => agent.name);const failureMessage = failedNames.length- ? `Couldn't switch ${failedNames.join(", ")} to ${target.model.name}. Try again.`+ ? translate(m.assignFailedNamed, {+ agents: joinList(failedNames, translate),+ model: target.model.name,+ }): null;- const combined = [busyMessage, failureMessage].filter(Boolean).join(" ");+ const combined =+ busyMessage && failureMessage+ ? translate(m.sentences, {+ first: busyMessage,+ second: failureMessage,+ })+ : (busyMessage ?? failureMessage);if (combined) setAssignError(combined);});}, [@@ -941,7 +1025,7 @@ function Library({const failedEntry = failure ? find(failure.modelId) : undefined;const guidanceCopy =!offline && view.available && guidance- ? memoryGuidanceCopy(guidance)+ ? memoryGuidanceCopy(guidance, t): undefined;function act(input: LocalModelActionInput) {@@ -971,7 +1055,7 @@ function Library({const unavailable = view.available? undefined- : libraryUnavailableCopy(view.reason?.code, name);+ : libraryUnavailableCopy(view.reason?.code, name, t);const canRetryUnavailable =!offline && !readOnly && view.reason?.code === "TOOL_FAILED";const pendingSwitchTarget = pendingSwitch@@ -989,35 +1073,19 @@ function Library({<>{offline ? (<Notice>- <span className="text-foreground">- {name} is offline- {view.computer.last_seen_at- ? ` (last seen ${relativeTime(view.computer.last_seen_at)})`- : ""}- .- </span>{" "}- This is what it last reported.- {readOnly ? null : (- <>- {" "}- Reconnect it in{" "}- <Link- className="text-foreground underline underline-offset-2"- to={computersPath(tenantId)}- >- Computers- </Link>{" "}- to manage its models.- </>- )}- </Notice>- ) : null}- {readOnly ? (- <Notice>- Only the person who connected {name} can download, load or remove its- models.+ <OfflineMessage+ lastSeenAt={view.computer.last_seen_at}+ messages={+ readOnly+ ? [m.offlineReadOnly, m.offlineReadOnlyLastSeen]+ : [m.offlineLibrary, m.offlineLibraryLastSeen]+ }+ name={name}+ tenantId={tenantId}+ /></Notice>) : null}+ {readOnly ? <Notice>{t(m.readOnlyNotice, { name })}</Notice> : null}{unavailable ? (<EmptyState@@ -1029,7 +1097,7 @@ function Library({onClick={onRefresh}size="compact">- Try again+ {t(commonMessages.tryAgain)}</Button>) : undefined}@@ -1042,8 +1110,12 @@ function Library({{failure ? (<div className="mt-6"><FormFeedback tone="danger">- {failedEntry ? `${failedEntry.model.name}: ` : null}- {actionErrorCopy(failure.code)}+ {failedEntry+ ? t(m.modelFailure, {+ name: failedEntry.model.name,+ reason: actionErrorCopy(failure.code, t),+ })+ : actionErrorCopy(failure.code, t)}</FormFeedback></div>) : null}@@ -1055,14 +1127,16 @@ function Library({{pendingSwitchTarget && pendingSwitchNames.length ? (<div className="mt-6"><FormFeedback tone="info">- Will switch {pendingSwitchNames.join(", ")} to{" "}- {pendingSwitchTarget.model.name} once it finishes loading.+ {t(m.willSwitch, {+ agents: joinList(pendingSwitchNames, t),+ model: pendingSwitchTarget.model.name,+ })}</FormFeedback></div>) : null}{guidanceCopy ? (<aside- aria-label="Memory guidance"+ aria-label={t(m.memoryGuidance)}className="mt-6 flex flex-col items-start justify-between gap-3 rounded-xl border border-[var(--app-status-warning-border)] bg-[var(--app-status-warning-surface)] px-4 py-3 sm:flex-row"><div className="min-w-0 flex-1">@@ -1080,17 +1154,17 @@ function Library({onClick={onRefresh}size="compact">- Recheck memory+ {t(m.recheckMemory)}</Button>)}</aside>) : null}{entries.length === 0 ? (- <EmptyState title="No local models available">- {name} didn't list any models for this hardware yet.+ <EmptyState title={t(m.noModelsTitle)}>+ {t(m.noModelsBody, { name })}</EmptyState>) : (- <section aria-label="Models" className="mt-6 grid gap-2">+ <section aria-label={t(m.title)} className="mt-6 grid gap-2">{entries.map((entry) => {const modelId = entry.model.id;const canUseForAgents =diff --git a/apps/web/src/features/local-models/local-models-rules.test.ts b/apps/web/src/features/local-models/local-models-rules.test.tsindex 3749ea85..0b531e9a 100644--- a/apps/web/src/features/local-models/local-models-rules.test.ts+++ b/apps/web/src/features/local-models/local-models-rules.test.ts@@ -1,5 +1,7 @@import { describe, expect, it } from "vitest";+import { translate } from "@/i18n/language";+import {collapsedRowBadges,contextLabel,@@ -65,24 +67,24 @@ describe("local models rules", () => {});it("formats every size in GB with at most one decimal", () => {- expect(formatGigabytes(gb(0.6))).toBe("0.6 GB");- expect(formatGigabytes(0)).toBe("0 GB");- expect(formatGigabytes(gb(46))).toBe("46 GB");- expect(formatGigabytes(gb(21.44))).toBe("21.4 GB");+ expect(formatGigabytes(gb(0.6), translate)).toBe("0.6 GB");+ expect(formatGigabytes(0, translate)).toBe("0 GB");+ expect(formatGigabytes(gb(46), translate)).toBe("46 GB");+ expect(formatGigabytes(gb(21.44), translate)).toBe("21.4 GB");});it("names pools from what the Computer reported", () => {const view = labView();- expect(view.pools.map((pool) => poolLabel(view, pool))).toEqual([+ expect(view.pools.map((pool) => poolLabel(view, pool, translate))).toEqual(["GPU 0 · RTX 4090","GPU 1 · RTX 4090","System memory",]);- expect(placeName(view, "gpu:1")).toBe("GPU 1");- expect(placeName(view, "system")).toBe("system memory");- expect(placeName(macView(), "unified")).toBe("memory");+ expect(placeName(view, "gpu:1", translate)).toBe("GPU 1");+ expect(placeName(view, "system", translate)).toBe("system memory");+ expect(placeName(macView(), "unified", translate)).toBe("memory");// A model that fits nowhere has no placement to show.- expect(placeName(view, undefined)).toBeUndefined();+ expect(placeName(view, undefined, translate)).toBeUndefined();});it("adds up GPU memory, or the memory of a Computer without GPUs", () => {@@ -406,8 +408,8 @@ describe("local models rules", () => {parameters: "30B",vision: true,});- expect(parametersLabel(moe)).toBe("30B · 3B active (MoE)");- expect(collapsedRowBadges(moe)).toEqual({+ expect(parametersLabel(moe, translate)).toBe("30B · 3B active (MoE)");+ expect(collapsedRowBadges(moe, translate)).toEqual({badges: ["3B active", "Vision", "Tool use", "+2"],overflowTitle: "Reasoning, Coding",});@@ -419,17 +421,22 @@ describe("local models rules", () => {name: "Qwen3 4B",parameters: "4B",});- expect(parametersLabel(dense)).toBe("4B (Dense)");- expect(collapsedRowBadges(dense)).toEqual({ badges: ["4B", "Tool use"] });+ expect(parametersLabel(dense, translate)).toBe("4B (Dense)");+ expect(collapsedRowBadges(dense, translate)).toEqual({+ badges: ["4B", "Tool use"],+ });// Collapsed badges depend strictly on structured fields, never name or description.expect(- collapsedRowBadges({- ...dense,- description: "Vision reasoning model with 70B scale.",- name: "Renamed Without Size",- }),- ).toEqual(collapsedRowBadges(dense));+ collapsedRowBadges(+ {+ ...dense,+ description: "Vision reasoning model with 70B scale.",+ name: "Renamed Without Size",+ },+ translate,+ ),+ ).toEqual(collapsedRowBadges(dense, translate));expect(collapsedRowBadges(@@ -438,6 +445,7 @@ describe("local models rules", () => {name: "Llama 3.3",parameters: "70B",}),+ translate,),).toEqual({ badges: ["70B"] });});@@ -468,28 +476,37 @@ describe("local models rules", () => {).toBe(true);expect(- usedByBadge({- model: localModel({ id: "m", name: "M", state: "loaded" }),- status: "loaded",- used_by: [{ agent_id: "a1", name: "Research" }],- }),+ usedByBadge(+ {+ model: localModel({ id: "m", name: "M", state: "loaded" }),+ status: "loaded",+ used_by: [{ agent_id: "a1", name: "Research" }],+ },+ translate,+ ),).toBe("1 Agent");expect(- usedByBadge({- model: localModel({ id: "m", name: "M", state: "idle" }),- status: "idle",- used_by: [- { agent_id: "a1", name: "Research" },- { agent_id: "a2", name: "Writer" },- ],- }),+ usedByBadge(+ {+ model: localModel({ id: "m", name: "M", state: "idle" }),+ status: "idle",+ used_by: [+ { agent_id: "a1", name: "Research" },+ { agent_id: "a2", name: "Writer" },+ ],+ },+ translate,+ ),).toBe("2 Agents");expect(- usedByBadge({- model: localModel({ id: "m", name: "M", state: "loaded" }),- status: "loaded",- used_by: [],- }),+ usedByBadge(+ {+ model: localModel({ id: "m", name: "M", state: "loaded" }),+ status: "loaded",+ used_by: [],+ },+ translate,+ ),).toBeUndefined();expect(usedByBadge(@@ -498,27 +515,34 @@ describe("local models rules", () => {status: "loaded",used_by: [],},+ translate,["Research", "Delegate"],),).toBe("2 Agents");expect(- usedByBadge({- model: localModel({ id: "m", name: "M", state: "absent" }),- status: "available",- used_by: [{ agent_id: "a1", name: "Research" }],- }),+ usedByBadge(+ {+ model: localModel({ id: "m", name: "M", state: "absent" }),+ status: "available",+ used_by: [{ agent_id: "a1", name: "Research" }],+ },+ translate,+ ),).toBeUndefined();expect(- usedByBadge({- model: localModel({- error: { code: "NETWORK_UNAVAILABLE" },- id: "m",- name: "M",- state: "failed",- }),- status: "failed",- used_by: [{ agent_id: "a1", name: "Research" }],- }),+ usedByBadge(+ {+ model: localModel({+ error: { code: "NETWORK_UNAVAILABLE" },+ id: "m",+ name: "M",+ state: "failed",+ }),+ status: "failed",+ used_by: [{ agent_id: "a1", name: "Research" }],+ },+ translate,+ ),).toBeUndefined();});@@ -537,6 +561,7 @@ describe("local models rules", () => {name: "m",state: "downloading",}),+ translate,),).toBe("25% · 50 MB/s · 5m left");expect(@@ -547,6 +572,7 @@ describe("local models rules", () => {name: "m",state: "downloading",}),+ translate,),).toBe("checking file");expect(@@ -557,6 +583,7 @@ describe("local models rules", () => {prompt_tokens_per_second: 612.4,tokens_per_second: 46.2,}),+ translate,),).toBe("46 tokens/s · 612 prompt tokens/s");expect(safeModelSourceUrl("http://example.com/model")).toBeUndefined();@@ -575,10 +602,11 @@ describe("local models rules", () => {name: "m",state: "downloading",}),+ translate,),).toBe("0% · 1 MB/s · 1h left");- expect(contextLabel(512)).toBe("512 tokens");- expect(contextLabel(131_072)).toBe("128K tokens");+ expect(contextLabel(512, translate)).toBe("512 tokens");+ expect(contextLabel(131_072, translate)).toBe("128K tokens");// A stopped download does not trigger blocked_load memory guidance.const stoppedDownloadView = labView({diff --git a/apps/web/src/features/local-models/local-models-rules.ts b/apps/web/src/features/local-models/local-models-rules.tsindex af88c8a5..5f3808a8 100644--- a/apps/web/src/features/local-models/local-models-rules.ts+++ b/apps/web/src/features/local-models/local-models-rules.ts@@ -1,6 +1,8 @@+import type { Translate } from "@/i18n/language";import { formatBytes } from "@/lib/format-bytes";import { architectureCopy, capabilityCopy } from "./local-models-copy";+import { localModelsMessages as m } from "./local-models.messages";import type {LocalModel,LocalModelPool,@@ -102,22 +104,49 @@ function gpuName(view: LocalModelsView, pool: LocalModelPool) {}/** A pool's full name: "GPU 0 · RTX 4090", "System memory", "Unified memory". */-export function poolLabel(view: LocalModelsView, pool: LocalModelPool) {- if (pool.kind === "system") return "System memory";- if (pool.kind === "unified") return "Unified memory";+export function poolLabel(+ view: LocalModelsView,+ pool: LocalModelPool,+ t: Translate,+) {+ if (pool.kind === "system") return t(m.poolSystem);+ if (pool.kind === "unified") return t(m.poolUnified);const name = gpuName(view, pool);- return name ? `GPU ${pool.gpu_index} · ${name}` : `GPU ${pool.gpu_index}`;+ return name+ ? t(m.gpuIndexNamed, { index: gpuIndex(pool), name })+ : t(m.gpuIndex, { index: gpuIndex(pool) });+}++/** A GPU's number as the Computer reports it, never grouped like a count. */+function gpuIndex(pool: LocalModelPool) {+ return String(pool.gpu_index);}/*** A pool's short name for status lines: "GPU 0", "system memory", "memory".* Undefined without a pool, so no placement is shown.*/-export function placeName(view: LocalModelsView, poolId: string | undefined) {+export function placeName(+ view: LocalModelsView,+ poolId: string | undefined,+ t: Translate,+) {const pool = poolOf(view, poolId);if (!pool) return undefined;- if (pool.kind === "gpu") return `GPU ${pool.gpu_index}`;- return pool.kind === "system" ? "system memory" : "memory";+ if (pool.kind === "gpu") return t(m.gpuIndex, { index: gpuIndex(pool) });+ return t(pool.kind === "system" ? m.placeSystem : m.placeMemory);+}++/** The same short name where it stands alone: "GPU 0", "System memory", "Memory". */+export function placeTitle(+ view: LocalModelsView,+ poolId: string | undefined,+ t: Translate,+) {+ const pool = poolOf(view, poolId);+ if (!pool) return undefined;+ if (pool.kind === "gpu") return t(m.gpuIndex, { index: gpuIndex(pool) });+ return t(pool.kind === "system" ? m.poolSystem : m.placeMemoryTitle);}/**@@ -125,8 +154,8 @@ export function placeName(view: LocalModelsView, poolId: string | undefined) {* small model and an empty pool compare at a glance with the rest: 0.6 GB and* 0 GB, not 614.4 MB and 0 B.*/-export function formatGigabytes(bytes: number) {- return `${Math.round((bytes / 1024 ** 3) * 10) / 10} GB`;+export function formatGigabytes(bytes: number, t: Translate) {+ return t(m.gigabytes, { value: Math.round((bytes / 1024 ** 3) * 10) / 10 });}export function poolFreeBytes(pool: LocalModelPool) {@@ -400,26 +429,27 @@ export function downloadPercent(model: LocalModel) {}/** Context length in thousands of tokens, as model cards write it: 128K. */-export function contextLabel(tokens: number) {- if (tokens < 1024) return `${tokens} tokens`;- return `${Math.round(tokens / 1024)}K tokens`;+export function contextLabel(tokens: number, t: Translate) {+ if (tokens < 1024) return t(m.contextTokens, { tokens });+ return t(m.contextKiloTokens, { thousands: Math.round(tokens / 1024) });}-/** Agent names joined for a sentence. */-export function agentNames(entry: Pick<LocalModelView, "used_by">) {- return entry.used_by.map((user) => user.name).join(", ");+/** Names in one line, separated the way the language lists them. */+export function joinList(items: readonly string[], t: Translate) {+ return items.join(t(m.listSeparator));}/** Compact Agent count chip for a model on the Computer, or undefined when unused. */export function usedByBadge(entry: Pick<ModelEntry, "model" | "status" | "used_by">,+ t: Translate,names?: readonly string[],): string | undefined {const count = names ? names.length : entry.used_by.length;if (!isModelOnComputer(entry.model, entry.status) || !count) {return undefined;}- return count === 1 ? "1 Agent" : `${count} Agents`;+ return t(m.agentCount, { count });}export type LocalModelCapability = NonNullable<@@ -442,29 +472,32 @@ export function modelCapabilities(model: LocalModel): LocalModelCapability[] {}/** Parameter scale and activation topology for details: "30B · 3B active (MoE)". */-export function parametersLabel(model: LocalModel) {+export function parametersLabel(model: LocalModel, t: Translate) {const scale = [model.parameters,- model.active_parameters ? `${model.active_parameters} active` : undefined,+ model.active_parameters+ ? t(m.activeParameters, { parameters: model.active_parameters })+ : undefined,].filter(Boolean).join(" · ");- const arch = model.architecture- ? architectureCopy(model.architecture)+ const architecture = model.architecture+ ? architectureCopy(model.architecture, t): undefined;- if (scale && arch) return `${scale} (${arch})`;- return scale || arch;+ if (scale && architecture)+ return t(m.parametersWithArchitecture, { architecture, scale });+ return scale || architecture;}-function allModelBadges(model: LocalModel): string[] {+function allModelBadges(model: LocalModel, t: Translate): string[] {const badges: string[] = [];if (model.active_parameters) {- badges.push(`${model.active_parameters} active`);+ badges.push(t(m.activeParameters, { parameters: model.active_parameters }));} else if (model.parameters) {badges.push(model.parameters);}for (const capability of modelCapabilities(model)) {- badges.push(capabilityCopy(capability));+ badges.push(capabilityCopy(capability, t));}return badges;}@@ -477,8 +510,11 @@ export interface CollapsedRowBadges {}/** Concise badges and any `+N` overflow tooltip for the collapsed row, built once from structured fields. */-export function collapsedRowBadges(model: LocalModel): CollapsedRowBadges {- const badges = allModelBadges(model);+export function collapsedRowBadges(+ model: LocalModel,+ t: Translate,+): CollapsedRowBadges {+ const badges = allModelBadges(model, t);if (badges.length <= visibleBadgeCount) {return { badges };}@@ -487,30 +523,37 @@ export function collapsedRowBadges(model: LocalModel): CollapsedRowBadges {...badges.slice(0, visibleBadgeCount),`+${badges.length - visibleBadgeCount}`,],- overflowTitle: badges.slice(visibleBadgeCount).join(", "),+ overflowTitle: joinList(badges.slice(visibleBadgeCount), t),};}-function formatRemainingTime(seconds: number) {- if (seconds < 60) return `${seconds}s left`;+function formatRemainingTime(seconds: number, t: Translate) {+ if (seconds < 60) return t(m.secondsLeft, { seconds });const totalMinutes = Math.ceil(seconds / 60);- if (totalMinutes < 60) return `${totalMinutes}m left`;+ if (totalMinutes < 60) return t(m.minutesLeft, { minutes: totalMinutes });const hours = Math.floor(totalMinutes / 60);const minutes = totalMinutes % 60;- return minutes > 0 ? `${hours}h ${minutes}m left` : `${hours}h left`;+ return minutes > 0+ ? t(m.hoursMinutesLeft, { hours, minutes })+ : t(m.hoursLeft, { hours });}/** Live download progress summary: "checking file", or "25% · 50 MB/s · 5m left". */-export function downloadStatusDetail(model: LocalModel) {+export function downloadStatusDetail(model: LocalModel, t: Translate) {const download = model.download;- if (download?.step === "verify") return "checking file";- const parts = [`${downloadPercent(model)}%`];+ if (download?.step === "verify") return t(m.checkingFile);+ const parts = [t(m.percent, { percent: downloadPercent(model) })];if (download?.bytes_per_second && download.bytes_per_second > 0) {- parts.push(`${formatBytes(download.bytes_per_second)}/s`);+ parts.push(+ t(m.perSecond, { size: formatBytes(download.bytes_per_second) }),+ );const remaining = download.total_bytes - download.done_bytes;if (remaining > 0) {parts.push(- formatRemainingTime(Math.ceil(remaining / download.bytes_per_second)),+ formatRemainingTime(+ Math.ceil(remaining / download.bytes_per_second),+ t,+ ),);}}@@ -518,13 +561,19 @@ export function downloadStatusDetail(model: LocalModel) {}/** Measured generation and prompt-processing throughput for model details. */-export function speedLabel(model: LocalModel) {+export function speedLabel(model: LocalModel, t: Translate) {const parts: string[] = [];if (model.tokens_per_second && model.tokens_per_second > 0) {- parts.push(`${Math.round(model.tokens_per_second)} tokens/s`);+ parts.push(+ t(m.tokensPerSecond, { speed: Math.round(model.tokens_per_second) }),+ );}if (model.prompt_tokens_per_second && model.prompt_tokens_per_second > 0) {- parts.push(`${Math.round(model.prompt_tokens_per_second)} prompt tokens/s`);+ parts.push(+ t(m.promptTokensPerSecond, {+ speed: Math.round(model.prompt_tokens_per_second),+ }),+ );}return parts.length ? parts.join(" · ") : undefined;}diff --git a/apps/web/src/features/local-models/local-models.messages.ts b/apps/web/src/features/local-models/local-models.messages.tsnew file mode 100644index 00000000..66d48675--- /dev/null+++ b/apps/web/src/features/local-models/local-models.messages.ts@@ -0,0 +1,438 @@+import { defineMessages } from "@/i18n/messages";++/** Settings › Models: a Computer's model source and its local model library. */+export const localModelsMessages = defineMessages("localModels", {+ // The page and its header.+ title: "Models",+ noComputersTitle: "No computers yet",+ noComputersBody:+ "Connect a computer in <link>Computers</link> to download and run models on it.",+ thisComputer: "this computer",+ computerPicker: "Computer",+ computerOffline: "{name} · Offline",+ agentsUse: "Agents on {computer} use {source}",+ memoryInUse: "{used} of {total} memory in use",+ gpuMemoryInUse: "{used} of {total} GPU memory in use",+ memoryFree: "{free} free",+ memoryFreeChecked: "{free} free · Checked {time}",+ recheckMemory: "Recheck memory",+ details: "Details",+ retrying: "Retrying…",+ switchingComputer:+ "Switching {computer}. This can take a few minutes the first time.",+ offlineByok:+ "<strong>{name} is offline.</strong> Reconnect it in <link>Computers</link> to test or change its model source.",+ offlineByokLastSeen:+ "<strong>{name} is offline (last seen {time}).</strong> Reconnect it in <link>Computers</link> to test or change its model source.",+ offlineLibrary:+ "<strong>{name} is offline.</strong> This is what it last reported. Reconnect it in <link>Computers</link> to manage its models.",+ offlineLibraryLastSeen:+ "<strong>{name} is offline (last seen {time}).</strong> This is what it last reported. Reconnect it in <link>Computers</link> to manage its models.",+ offlineReadOnly:+ "<strong>{name} is offline.</strong> This is what it last reported.",+ offlineReadOnlyLastSeen:+ "<strong>{name} is offline (last seen {time}).</strong> This is what it last reported.",+ readOnlyNotice:+ "Only the person who connected {name} can download, load or remove its models.",+ openComputer: "Open {name}",+ openMyComputers: "Open my computers",+ loadFailedTitle: "Couldn't load the models of {name}",+ loadFailedTitleThisComputer: "Couldn't load the models of this computer",+ loadingModels: "Loading models",+ modelFailure: "{name}: {reason}",+ assignFailed: "Couldn't switch the Agent to this model. Try again.",+ assignBusy:+ "Couldn't switch {agents} to {model} while working. Switch once the current turn finishes.",+ assignFailedNamed: "Couldn't switch {agents} to {model}. Try again.",+ willSwitch: "Will switch {agents} to {model} once it finishes loading.",+ memoryGuidance: "Memory guidance",+ noModelsTitle: "No local models available",+ noModelsBody: "{name} didn't list any models for this hardware yet.",+ /** Joins two full sentences shown as one notice. */+ sentences: "{first} {second}",+ /** Between the names of a list, such as the Agents that use a model. */+ listSeparator: ", ",++ // Sizes, counts and progress.+ gigabytes: "{value} GB",+ poolSystem: "System memory",+ poolUnified: "Unified memory",+ gpuIndex: "GPU {index}",+ gpuIndexNamed: "GPU {index} · {name}",+ placeSystem: "system memory",+ placeMemory: "memory",+ placeMemoryTitle: "Memory",+ contextTokens: "{tokens} tokens",+ contextKiloTokens: "{thousands}K tokens",+ agentCount: { one: "{count} Agent", other: "{count} Agents" },+ activeParameters: "{parameters} active",+ parametersWithArchitecture: "{scale} ({architecture})",+ secondsLeft: "{seconds}s left",+ minutesLeft: "{minutes}m left",+ hoursMinutesLeft: "{hours}h {minutes}m left",+ hoursLeft: "{hours}h left",+ checkingFile: "checking file",+ percent: "{percent}%",+ perSecond: "{size}/s",+ tokensPerSecond: "{speed} tokens/s",+ promptTokensPerSecond: "{speed} prompt tokens/s",++ // A model row.+ statusAvailable: "Not downloaded",+ statusDownloading: "Downloading",+ statusFailed: "Couldn't load",+ statusIdle: "Downloaded",+ statusLoaded: "Loaded",+ statusLoading: "Loading",+ statusUnavailable: "Can't download",+ statusDownloadStopped: "Download stopped",+ endingCancel: "Cancelling",+ endingRemove: "Removing",+ endingUnload: "Unloading",+ endingDiscard: "Discarding",+ openChat: "Open chat",+ recommended: "Recommended",+ runsSlower: "runs slower",+ noRoomYet: "no room to load yet",+ loadToAnswer: "load to answer",+ usedByNames: "Used by {names}",+ actionDownload: "Download",+ actionResumeDownload: "Resume download",+ actionLoad: "Load",+ actionUnload: "Unload",+ downloadModel: "Download {name}",+ cancelModel: "Cancel {name}",+ resumeDownloadModel: "Resume download {name}",+ removeModel: "Remove {name}",+ retryModel: "Retry {name}",+ loadModel: "Load {name}",+ unloadModel: "Unload {name}",+ useForAgentsNamed: "Use {name} for Agents",+ useForAgents: "Use for Agents",+ useWithNamed: "Use {model} with {agent}",+ useWith: "Use with {agent}",+ waitForTurn: "Wait for {agent} to finish the current turn",+ downloadProgress: "{name} download progress",+ detailsOf: "{name} details",+ removeFromComputer: "Remove from computer",+ discardDownload: "Discard download",++ // The details of a model and of a Computer.+ copyEndpointOf: "Copy {name} endpoint",+ copiedEndpointOf: "Copied {name} endpoint",+ copyEndpoint: "Copy endpoint",+ gatewayPiNotInstalled: "Bifrost · Pi not installed",+ gatewayReady: "Ready · Bifrost (Pi)",+ gatewayRegistering: "Bifrost · Registering with Pi…",+ gatewaySettingUp: "Bifrost · Setting up Pi…",+ gatewayPiUnavailable: "Bifrost · Pi unavailable",+ factLastDownload: "Last download",+ factLastLoad: "Last load",+ factWhyNot: "Why not",+ factNote: "Note",+ factCapabilities: "Capabilities",+ factPublisher: "Publisher",+ factParameters: "Parameters",+ factMemory: "Memory",+ factOnDisk: "On disk",+ factDownload: "Download",+ factContext: "Context",+ factVersion: "Version",+ factSpeed: "Speed",+ factLicense: "License",+ factUsedBy: "Used by",+ factSource: "Source",+ factGateway: "Gateway",+ factEndpoint: "Endpoint",+ factFreeDisk: "Free disk",+ memoryOn: "{size} on {place}",+ idleUsedWarning: {+ one: "{names} uses this model. Load it so it can answer.",+ other: "{names} use this model. Load it so they can answer.",+ },+ downloadNeedsRoom:+ "This model can download now, but only {free} is free on {pool}. Close memory-heavy apps and recheck memory before loading it.",+ noAgentYet: "No Agent yet",+ switchAgentTo: "Switch an Agent to {name}",+ switchingAgent: "Switching…",+ switchAgent: "Switch Agent…",+ agentWorking: "{name} · Working",+ finishTurnToSwitch: "Finish the current turn to switch",+ poolInUse: "{pool}: {used} of {total} in use",+ otherApps: "Other apps",+ otherAppsSize: "Other apps · {size}",+ hardware: "Hardware",++ // Confirmations.+ affectedUnload: {+ one: "{names} uses this model and can't answer until it is loaded again.",+ other: "{names} use this model and can't answer until it is loaded again.",+ },+ affectedRemove: {+ one: "{names} uses this model and can't answer until you choose another model for it.",+ other:+ "{names} use this model and can't answer until you choose another model for them.",+ },+ noAgentUses: "No Agent uses this model.",+ makeRoomTitle: "Make room to load",+ makeRoomDescription: "{name} needs {need} on {pool}; {free} is free.",+ unloadAndLoad: "Unload and load",+ roomFreeNow:+ "Enough memory is free now ({free} available). Click Load to start.",+ unloadTheseLegend: "Unload these to free memory:",+ notUsed: "Not used",+ tooBig:+ "{name} needs more than all {total} of {pool}, so it can't load there.",+ alsoUsingMemory: "Also using this memory",+ closeOtherAppsRecheck:+ "Close other apps that use {place}, then click Recheck memory.",+ closeOtherAppsRetry: "Close other apps that use {place}, then try again.",+ otherAppsCloseRecheck:+ "Other apps are using {size}. Close other apps that use {place}, then click Recheck memory.",+ otherAppsCloseRetry:+ "Other apps are using {size}. Close other apps that use {place}, then try again.",+ unloadNotEnough:+ "Unloading models here doesn't free enough. Choose a smaller model.",+ otherAppsOnPool:+ "Other apps are using {size} on {pool}. Close unnecessary apps and click Recheck memory to free the remaining room.",+ selectMore: "Select at least {size} more to unload before loading {name}.",+ affectedUntilReload:+ "{names} can't answer until their model is loaded again.",+ switchOnceLoaded: "Switch {agents} to {model} once loaded",+ unloadTitle: "Unload {name}?",+ unloadDescription:+ "Frees {size} of memory. It stays on disk, so you can load it again later.",+ unloadDescriptionPool:+ "Frees {size} of {pool}. It stays on disk, so you can load it again later.",+ removeTitle: "Remove {name}?",+ removeDescription:+ "Deletes its files and frees {size} of disk on {computer}. You can download it again later.",+ removeDescriptionLoaded:+ "Unloads it, deletes its files and frees {size} of disk on {computer}. You can download it again later.",++ // Where the Agents of a Computer get their model.+ modeByok: "BYOK",+ modeLocal: "Local model",+ modeSubscription: "Subscription",+ sourceByok: "BYOK · {model}",+ sourceSubscription: "Subscription · {runtime}",+ byokExplanation:+ "Bring your own key: use your own OpenAI-compatible or Anthropic API endpoint. A gateway on this computer serves it to your Agents.",+ switched: "Switched.",+ agentsNowUse: "Agents now use {source}.",+ agentsMoved: {+ one: "{count} Agent was moved.",+ other: "{count} Agents were moved.",+ },+ tasksEnded: {+ one: "{count} task was ended.",+ other: "{count} tasks were ended.",+ },+ terminateTitle: "End running tasks?",+ terminateDescription: {+ one: "{names} is working on tasks on {computer}. Switching now ends those tasks; they can't be resumed.",+ other:+ "{names} are working on tasks on {computer}. Switching now ends those tasks; they can't be resumed.",+ },+ terminateDescriptionSome:+ "Some Agents are working on tasks on {computer}. Switching now ends those tasks; they can't be resumed.",+ terminateBody: "To keep them, wait until they finish and switch then.",+ terminateConfirm: "Terminate tasks & Switch",+ modelSource: "Model source",+ inUse: "In use",+ switchLocalSingle:+ "<model>{name}</model> is on this computer and can run your Agents locally.",+ switchLocalChoose:+ "Choose a model on this computer to run your Agents locally.",+ switchLocalDownload: "Download a model below to run your Agents locally.",+ localOptionLoaded: "{name} · Loaded · {size}",+ localOptionDownloaded: "{name} · Downloaded · {size}",+ switchToLocal: "Switch to Local model",+ aiRuntime: "AI runtime",+ byokApiAddress: "API address",+ baseUrl: "Base URL",+ byokPath: "Path",+ byokEndpoint: "Endpoint",+ byokPathHeading: "Path · optional",+ byokEndpointHeading: "Endpoint · optional",+ byokShowSuggestions: "Show {label} suggestions",+ byokSuggestions: "{label} suggestions",+ byokDefaultOption: "{label} · Default",+ byokPathMostProviders: "Most providers",+ byokPathZhipu: "Zhipu GLM (base {url})",+ byokPathVolcano: "Volcano Engine Ark",+ byokPathNone: "No path. The base URL already has it.",+ byokEndpointRuntimeDefault: "{protocol} · {runtime} default",+ byokEndpointNone: "No endpoint. The base URL is the full address.",+ byokAddressHint:+ "Base URL from your provider's docs. Path and endpoint are optional: pick one, type your own, or clear it.",+ byokAddressInvalid:+ "Path and endpoint take segments like /v1, without spaces, ?, # or \\.",+ byokSendsTo: "Sends {protocol} requests to <url>{url}</url>",+ byokSendsToRuntimeFormat:+ "Sends {protocol} (the {runtime} format) requests to <url>{url}</url>",+ keySavedHint: "A key is saved on this computer. Leave blank to keep it.",+ keyOptionalHint:+ "Optional for an endpoint on this computer or your local network.",+ apiKey: "API key",+ model: "Model",+ listModels: "List models",+ byokListingFrom: "Listing models from {url}…",+ byokModelsListedFrom: {+ one: "{count} model listed from {url}.",+ other: "{count} models listed from {url}.",+ },+ byokModelHint: "List the endpoint's models, or type an ID.",+ byokContextTokens: "{tokens}-token context",+ byokContextKilo: "{thousands}K context",+ byokTest: "Test",+ byokConnected: "Connected",+ byokCouldNotConnect: "Couldn't connect",+ byokDismiss: "Dismiss",+ saveAndSwitch: "Save & Switch to BYOK",++ // Why an action on a model or a read of the page failed.+ refusalOffline:+ "The computer is offline. Reconnect it in Computers, then try again.",+ refusalActionFailed: "The computer couldn't start this. Try again.",+ refusalUnconfirmed:+ "The computer didn't confirm in time. Its models below show what it's doing.",+ refusalForbidden:+ "Only the person who connected this computer can manage its models.",+ refusalDiskInsufficient:+ "There isn't enough free disk on the computer for this model.",+ refusalInvalidState:+ "The model changed on the computer. Check its status and try again.",+ refusalJobRunning:+ "The computer is still working on this model. Wait for it to finish.",+ refusalMemoryInsufficient:+ "The computer doesn't have enough memory for this model.",+ refusalNoRoom:+ "There isn't enough free memory to load it. Close memory-heavy apps or unload another model, then recheck memory.",+ refusalPlatformUnsupported: "This model doesn't run on this computer.",+ refusalModelUnknown: "The computer doesn't have this model anymore.",+ refusalServiceUnavailable:+ "Linger couldn't reach the computer right now. Try again.",+ refusalToolsUnavailable:+ "The local model tools on this computer aren't working.",+ refusalComputerNotFound:+ "This computer wasn't found. It may have been removed.",+ somethingWentWrong: "Something went wrong. Try again.",++ // Why the last load or download of a model failed.+ errorCancelled: "Loading was stopped.",+ errorChecksumMismatch:+ "The downloaded files were damaged. Remove the model and download it again.",+ errorDiskInsufficient: "There wasn't enough free disk.",+ errorDownloadFailed: "The download didn't finish.",+ errorEngineStartFailed: "The model engine didn't start.",+ errorGatewayRegistrationFailed:+ "It loaded, but Agents couldn't be given access to it.",+ errorHealthCheckFailed: "The model started but didn't answer.",+ errorInvalidState: "The model was busy with another step.",+ errorJobRunning: "Another step was still running.",+ errorLoadNoRoom: "There wasn't enough free memory to load it.",+ errorMemoryInsufficient: "The computer doesn't have enough memory for it.",+ errorModelFilesMissing:+ "Its files are missing. Remove the model and download it again.",+ errorModelUnknown: "The computer doesn't know this model anymore.",+ errorNetworkUnavailable: "The computer couldn't reach the network.",+ errorOutOfMemory: "It ran out of memory while loading.",+ errorGatewayHomeNotPrivate:+ "It loaded, but Agents couldn't be given access to it: a Linger folder on the computer belongs to another account.",+ errorGatewayHomeNotPrivatePath:+ "It loaded, but Agents couldn't be given access to it: the folder {path} belongs to another account. Quit Linger, rename that folder, then open Linger and load the model again.",+ shortCancelled: "loading stopped",+ shortChecksumMismatch: "files damaged",+ shortDiskInsufficient: "not enough disk",+ shortEngineStartFailed: "engine didn't start",+ shortGatewayRegistrationFailed: "Agents couldn't reach it",+ shortHealthCheckFailed: "model didn't answer",+ shortBusy: "busy with another step",+ shortLoadNoRoom: "not enough free memory",+ shortMemoryInsufficient: "not enough memory",+ shortModelFilesMissing: "files missing",+ shortModelUnknown: "no longer on computer",+ shortNetworkUnavailable: "network unavailable",+ shortOutOfMemory: "ran out of memory",+ shortNotForComputer: "not for this computer",+ noteNoRoomToLoad:+ "It downloaded, but there wasn't enough free {place} to load it. Load it when there is room.",++ // Why a model can't be downloaded to this Computer.+ shortNeedsDisk: "needs more disk",+ shortNeedsMemory: "needs more memory",+ shortNeedsDiskSize: "needs {need} of disk",+ shortNeedsSize: "needs {need}",+ unavailableMemory: "This computer doesn't have enough memory for it.",+ unavailableMemoryReclaimable:+ "This computer doesn't have enough memory for it. Close memory-heavy apps and recheck memory.",+ unavailableMemorySizes:+ "Needs {need} of memory; this computer has {have} for models.",+ unavailableMemorySizesReclaimable:+ "Needs {need} of memory; this computer has {have} for models. Close memory-heavy apps and recheck memory.",+ unavailableDisk: "There isn't enough free disk for it.",+ unavailableDiskSizes: "Needs {need} of disk; {have} is free.",++ // A Computer that reports no model library.+ libraryNotReportedTitle: "{computer} hasn't reported local models yet",+ libraryNotReportedBody:+ "It reports them once it connects with an up-to-date Linger app.",+ libraryToolFailedTitle: "Couldn't read the local models on {computer}",+ libraryToolFailedBody:+ "The local model tools on this computer didn't answer. Check that they're installed and working, then open this page again.",+ libraryToolNotInstalledTitle: "Local models aren't set up on {computer}",+ libraryToolNotInstalledBody:+ "Run Quick Install in the Linger desktop app on that computer to add them.",++ capabilityCoding: "Coding",+ capabilityMultilingual: "Multilingual",+ capabilityReasoning: "Reasoning",+ capabilityToolUse: "Tool use",+ capabilityVision: "Vision",+ architectureDense: "Dense",+ architectureMoe: "MoE",++ // Why a model-source switch, endpoint test or read failed.+ sourceAgentsWorking: "Agents on this computer are working on tasks.",+ sourceByokAuthFailed: "The endpoint rejected the API key.",+ sourceByokInvalidConfig:+ "The computer can't use this endpoint. An HTTPS endpoint needs an API key; plain HTTP works only on this computer or your local network.",+ sourceByokNotFound:+ "Nothing answered at the endpoint's address, or it doesn't serve this model ID.",+ sourceByokUnreachable: "The computer couldn't reach the endpoint.",+ sourceByokUpstreamRejected: "The endpoint rejected the test request.",+ sourceNoRoom:+ "There isn't enough free memory on the computer to load that model. Close memory-heavy apps or unload another model, recheck memory, and try again.",+ sourceSwitchFailed: "The computer couldn't switch. Try again.",+ sourceForbidden:+ "Only the person who connected this computer can change its models.",+ sourceUnavailable:+ "This computer can't switch models. Update Linger on it, then try again.",+ sourceUnconfirmed:+ "The computer didn't answer in time. It may still be switching; check again in a minute.",+ sourceRuntimeNotEnabled: "This AI runtime isn't set up on the computer.",+ sourceReadUnconfirmed: "The computer didn't answer in time. Try again.",+ sourceReadFailed:+ "Couldn't read how Agents on this computer get their model. Try again.",++ // What freeing memory other apps hold would unlock.+ guidanceBlockedLoadTitle: "Free memory before loading",+ guidanceBlockedLoadTitleGpu: "Free GPU memory before loading",+ guidanceBlockedLoadBody:+ "Other apps are holding {other} of memory ({free} of {total} free). Forcing a model into tight memory can freeze the computer. Close video players, games, browsers, or other memory-heavy apps, then click Recheck memory to load it.",+ guidanceBlockedLoadBodyGpu:+ "Other apps are holding {other} of GPU memory ({free} of {total} free). Forcing a model into tight memory can freeze the computer. Close video players, games, browsers, or other memory-heavy apps, then click Recheck memory to load it.",+ guidanceBlockedDownloadTitle: "Free memory to install a larger model",+ guidanceBlockedDownloadTitleGpu: "Free GPU memory to install a larger model",+ guidanceBlockedDownloadBody:+ "Other apps are holding {other} of memory ({free} of {total} free), so larger models look unavailable right now. Close unnecessary apps (such as video players, games, or browsers) and click Recheck memory to detect all free memory before installing.",+ guidanceBlockedDownloadBodyGpu:+ "Other apps are holding {other} of GPU memory ({free} of {total} free), so larger models look unavailable right now. Close unnecessary apps (such as video players, games, or browsers) and click Recheck memory to detect all free memory before installing.",+ guidanceConstrainedTitle: "Other apps are using memory",+ guidanceConstrainedTitleGpu: "Other apps are using GPU memory",+ guidanceConstrainedBody:+ "Other apps are using {other} of memory ({free} of {total} free). To avoid loading failures or system freezes, close unnecessary apps and click Recheck memory so you can load a better model.",+ guidanceConstrainedBodyGpu:+ "Other apps are using {other} of GPU memory ({free} of {total} free). To avoid loading failures or system freezes, close unnecessary apps and click Recheck memory so you can load a better model.",+});diff --git a/apps/web/src/features/local-models/model-source-panel.tsx b/apps/web/src/features/local-models/model-source-panel.tsxindex a7bbe9dd..9f44ef81 100644--- a/apps/web/src/features/local-models/model-source-panel.tsx+++ b/apps/web/src/features/local-models/model-source-panel.tsx@@ -13,6 +13,9 @@ import {} from "@/features/rooms/room-queries";import { TeamHubError } from "@/features/teamhub/teamhub-error";import { useTeamHubRuntime } from "@/features/teamhub/teamhub-runtime";+import { commonMessages } from "@/i18n/common.messages";+import type { Translate } from "@/i18n/language";+import { RichMessage, useT } from "@/i18n/use-translation";import { cn } from "@/lib/cn";import {@@ -20,11 +23,12 @@ import {modelSourceModeLabels,modelSourceRuntimeLabels,} from "./local-models-copy";+import { localModelsMessages as m } from "./local-models.messages";import {type LocalModel,tenantLocalModelsQueryKey,} from "./local-models-queries";-import { formatGigabytes } from "./local-models-rules";+import { formatGigabytes, joinList } from "./local-models-rules";import {type ModelSourceMode,type ModelSourceStatus,@@ -39,16 +43,14 @@ import {// unloads local models.const modes: readonly ModelSourceMode[] = ["local", "byok"];-const byokExplanation =- "Bring your own key: use your own OpenAI-compatible or Anthropic API endpoint. A gateway on this computer serves it to your Agents.";-/** What the page says the Computer's Agents run on now. */-export function activeSourceLabel(status: ModelSourceStatus) {+export function activeSourceLabel(status: ModelSourceStatus, t: Translate) {const runtime = modelSourceRuntimeLabels[status.runtime];if (status.mode === "byok")- return `BYOK · ${status.byok.model_id ?? runtime}`;- if (status.mode === "subscription") return `Subscription · ${runtime}`;- return "Local model";+ return t(m.sourceByok, { model: status.byok.model_id ?? runtime });+ if (status.mode === "subscription")+ return t(m.sourceSubscription, { runtime });+ return t(m.modeLocal);}export interface ModelSourceSwitcher {@@ -74,13 +76,15 @@ export function useModelSourceSwitch({computerName: string;tenantId: string;}) {+ const t = useT();const { client } = useTeamHubRuntime();const queryClient = useQueryClient();const [busy, setBusy] = useState<{agents: string[];body: ModelSourceSwitchRequest;} | null>(null);- const [notice, setNotice] = useState<string | null>(null);+ // The answer to the last switch, kept so its notice follows the language.+ const [switched, setSwitched] = useState<ModelSourceView | null>(null);const [saveRevision, setSaveRevision] = useState(0);const mutation = useMutation({mutationFn: (body: ModelSourceSwitchRequest) =>@@ -100,10 +104,10 @@ export function useModelSourceSwitch({body,});},- onMutate: () => setNotice(null),+ onMutate: () => setSwitched(null),onSuccess: (view) => {queryClient.setQueryData(modelSourceQueryKey(tenantId, computerId), view);- setNotice(switchedNotice(view));+ setSwitched(view);setSaveRevision((current) => current + 1);void Promise.all([queryClient.invalidateQueries({@@ -125,12 +129,12 @@ export function useModelSourceSwitch({mutation.error instanceof TeamHubError ? mutation.error.code : undefined;const switcher: ModelSourceSwitcher = {clearFeedback: () => {- setNotice(null);+ setSwitched(null);if (mutation.isError) mutation.reset();},failure:mutation.isError && failureCode !== "AGENT_HAS_ACTIVE_RUNS"- ? modelSourceErrorCopy(failureCode)+ ? modelSourceErrorCopy(failureCode, t): undefined,pending: mutation.isPending ? mutation.variables : undefined,request: (body) => mutation.mutate(body),@@ -138,9 +142,11 @@ export function useModelSourceSwitch({};const feedback = (<>- {notice ? (+ {switched ? (<div className="mt-4">- <FormFeedback tone="success">{notice}</FormFeedback>+ <FormFeedback tone="success">+ {switchedNotice(switched, t)}+ </FormFeedback></div>) : null}{busy ? (@@ -159,18 +165,16 @@ export function useModelSourceSwitch({return { feedback, switcher };}-function switchedNotice(view: ModelSourceView) {- if (!view.status) return "Switched.";+function switchedNotice(view: ModelSourceView, t: Translate) {+ if (!view.status) return t(m.switched);const updated = view.updated_agent_count ?? 0;const ended = view.terminated_run_count ?? 0;- const parts = [`Agents now use ${activeSourceLabel(view.status)}.`];- if (updated)- parts.push(- `${updated} ${updated === 1 ? "Agent was" : "Agents were"} moved.`,- );- if (ended)- parts.push(`${ended} ${ended === 1 ? "task was" : "tasks were"} ended.`);- return parts.join(" ");+ const parts = [+ t(m.agentsNowUse, { source: activeSourceLabel(view.status, t) }),+ ];+ if (updated) parts.push(t(m.agentsMoved, { count: updated }));+ if (ended) parts.push(t(m.tasksEnded, { count: ended }));+ return parts.reduce((first, second) => t(m.sentences, { first, second }));}function TerminateTasksDialog({@@ -184,24 +188,32 @@ function TerminateTasksDialog({onClose: () => void;onConfirm: () => void;}) {- const names = agents.length ? agents.join(", ") : "Some Agents";+ const t = useT();return (<ModalDialog- description={`${names} ${agents.length === 1 ? "is" : "are"} working on tasks on ${computerName}. Switching now ends those tasks; they can't be resumed.`}+ description={+ agents.length+ ? t(m.terminateDescription, {+ computer: computerName,+ count: agents.length,+ names: joinList(agents, t),+ })+ : t(m.terminateDescriptionSome, { computer: computerName })+ }footer={<>- <Button onClick={onClose}>Cancel</Button>+ <Button onClick={onClose}>{t(commonMessages.cancel)}</Button><Button onClick={onConfirm} tone="danger">- Terminate tasks & Switch+ {t(m.terminateConfirm)}</Button></>}onClose={onClose}size="md"- title="End running tasks?"+ title={t(m.terminateTitle)}><p className="px-5 py-4 text-sm text-muted-foreground">- To keep them, wait until they finish and switch then.+ {t(m.terminateBody)}</p></ModalDialog>);@@ -217,9 +229,10 @@ export function ModelSourceTabs({onChange: (mode: ModelSourceMode) => void;value: ModelSourceMode;}) {+ const t = useT();return (<div- aria-label="Model source"+ aria-label={t(m.modelSource)}className="mt-6 inline-flex self-start rounded-lg bg-muted p-0.5"role="tablist">@@ -240,16 +253,16 @@ export function ModelSourceTabs({>{mode === active ? (<span- aria-label="In use"+ aria-label={t(m.inUse)}className="size-1.5 rounded-full bg-app-success"role="img"/>) : null}- {modelSourceModeLabels[mode]}+ {t(modelSourceModeLabels[mode])}</button>);return mode === "byok" ? (- <Hint key={mode} placement="top" text={byokExplanation}>+ <Hint key={mode} placement="top" text={t(m.byokExplanation)}>{tab}</Hint>) : (@@ -270,6 +283,7 @@ export function SwitchToLocalNotice({models: readonly LocalModel[];switcher: ModelSourceSwitcher;}) {+ const t = useT();const [selectedId, setSelectedId] = useState<string | undefined>(undefined);const chosen =(selectedId@@ -281,29 +295,36 @@ export function SwitchToLocalNotice({<div className="mt-6 flex flex-wrap items-center justify-between gap-3 rounded-xl bg-muted px-4 py-3"><p className="min-w-0 flex-1 text-sm text-muted-foreground">{single ? (- <>- <span className="text-foreground">{single.name}</span> is on this- computer and can run your Agents locally.- </>- ) : models.length > 1 ? (- "Choose a model on this computer to run your Agents locally."+ <RichMessage+ message={m.switchLocalSingle}+ tags={{+ model: (text) => <span className="text-foreground">{text}</span>,+ }}+ values={{ name: single.name }}+ />) : (- "Download a model below to run your Agents locally."+ t(models.length > 1 ? m.switchLocalChoose : m.switchLocalDownload))}</p><div className="flex shrink-0 flex-wrap items-center gap-2">{models.length > 1 && chosen ? (<Select- aria-label="Local model"+ aria-label={t(m.modeLocal)}onValueChange={setSelectedId}value={chosen.id}variant="pill">{models.map((model) => (<SelectItem key={model.id} value={model.id}>- {model.name} ·{" "}- {model.state === "loaded" ? "Loaded" : "Downloaded"} ·{" "}- {formatGigabytes(model.memory_bytes)}+ {t(+ model.state === "loaded"+ ? m.localOptionLoaded+ : m.localOptionDownloaded,+ {+ name: model.name,+ size: formatGigabytes(model.memory_bytes, t),+ },+ )}</SelectItem>))}</Select>@@ -318,7 +339,7 @@ export function SwitchToLocalNotice({size="compact"tone="primary">- Switch to Local model+ {t(m.switchToLocal)}</Button></div></div>diff --git a/apps/web/src/i18n/locales/zh-CN.json b/apps/web/src/i18n/locales/zh-CN.jsonindex e2470040..9bbd9ffc 100644--- a/apps/web/src/i18n/locales/zh-CN.json+++ b/apps/web/src/i18n/locales/zh-CN.json@@ -70,12 +70,8 @@"noMessages": "暂无消息","deleted": "已删除","deletedChat": "{name},已删除",- "unreadMentions": {- "other": "{count} 条未读提及"- },- "unreadMessages": {- "other": "{count} 条未读消息"- },+ "unreadMentions": { "other": "{count} 条未读提及" },+ "unreadMessages": { "other": "{count} 条未读消息" },"pinned": "已置顶","pin": "置顶","unpin": "取消置顶",@@ -249,12 +245,8 @@"fileUnavailable": "{name} 不可用","loadingFile": "正在加载 {name}","loadingImage": "正在加载图片…",- "fileCount": {- "other": "{count} 个文件"- },- "folderCount": {- "other": "{count} 个文件夹"- },+ "fileCount": { "other": "{count} 个文件" },+ "folderCount": { "other": "{count} 个文件夹" },"fileTypeArchive": "压缩包","fileTypeAudio": "音频","fileTypeCode": "代码",@@ -288,9 +280,7 @@"showChanges": "显示更改","instructionsUpdated": "指令已更新","viewInAgentInfo": "在 Agent 信息中查看",- "replyCount": {- "other": "{count} 条回复"- },+ "replyCount": { "other": "{count} 条回复" },"openThread": "打开话题,{replies}","messageThread": "消息话题","thread": "话题",@@ -464,9 +454,7 @@"addAppFromAccount": "从 {account} 添加 {app}","connectedAs": "已连接:{account}","unnamedAccount": "账号",- "connectedAccountsCount": {- "other": "已连接 {count} 个账号"- },+ "connectedAccountsCount": { "other": "已连接 {count} 个账号" },"unavailable": "不可用","connectionNeedsAttention": "连接需要在连接器中处理","authorizationInProgress": "授权进行中",@@ -492,18 +480,10 @@"addGitHubProfileAndRepositories": {"other": "添加 GitHub 个人资料和 {count} 个仓库"},- "addCalendars": {- "other": "添加 {count} 个日历"- },- "addNotionItems": {- "other": "添加 {count} 项 Notion 内容"- },- "addSlackChannels": {- "other": "添加 {count} 个 Slack 频道"- },- "addDiscordChannels": {- "other": "添加 {count} 个 Discord 频道"- },+ "addCalendars": { "other": "添加 {count} 个日历" },+ "addNotionItems": { "other": "添加 {count} 项 Notion 内容" },+ "addSlackChannels": { "other": "添加 {count} 个 Slack 频道" },+ "addDiscordChannels": { "other": "添加 {count} 个 Discord 频道" },"filesHint": "支持 PDF、Word 或文本文件,最多五个。","profileFiles": "个人资料文件","chooseFiles": "选择文件",@@ -611,12 +591,8 @@"newAgent": "新建 Agent {name}","changeAgent": "修改 {name}","newRoom": "新建 Room {name}",- "memberCount": {- "other": "{count} 位成员"- },- "memberCountWithNames": {- "other": "{count} 位成员 · {names}"- },+ "memberCount": { "other": "{count} 位成员" },+ "memberCountWithNames": { "other": "{count} 位成员 · {names}" },"fieldDescription": "描述","fieldName": "名称","newInstructions": "新指令",@@ -665,12 +641,8 @@"ownAnswerTo": "填写你对“{question}”的回答","ownAnswer": "填写你的回答","labelAnotherMeSetup": "Another Me 设置",- "linkCount": {- "other": "{count} 个链接"- },- "fileCount": {- "other": "{count} 个文件"- },+ "linkCount": { "other": "{count} 个链接" },+ "fileCount": { "other": "{count} 个文件" },"sharedItems": "已分享 {items}","sharedLinksAndFiles": "已分享 {links}和 {files}","nothingShared": "没有分享内容",@@ -978,14 +950,10 @@"noAgents": "这台电脑上还没有 Agent,可以在“消息”中创建。","less": "收起","more": "更多",- "tasksRunning": {- "other": "{count} 个任务运行中"- },+ "tasksRunning": { "other": "{count} 个任务运行中" },"appSignInNeeded": "需要登录 {app}","statusUnavailable": "无法获取状态",- "agentsNeedAttention": {- "other": "{count} 个需要处理"- },+ "agentsNeedAttention": { "other": "{count} 个需要处理" },"agentsOffline": "{count} 个离线","agentsStatusUnavailable": "{count} 个无法获取状态","computerOffline": "{computer} 已离线",@@ -1037,9 +1005,7 @@"removeTitle": "移除本地电脑","removeDescription": "这会撤销 <strong>{computer}</strong> 的授权,并把它从这个工作区移除。之后要重新连接,需要再设置一次。","noOtherComputer": "没有其他电脑可以接收这些 Agent,请先连接新电脑。",- "moveAndRemove": {- "other": "移动 {count} 个 Agent 并移除"- },+ "moveAndRemove": { "other": "移动 {count} 个 Agent 并移除" },"moveDeleteAndRemove": "移动、删除并移除","deleteAndRemove": "删除并移除","deleteAgentHint": "这会把这个 Agent 从所有 Room 中移除,并删除你和它的私聊。",@@ -1108,6 +1074,331 @@"browserConnectFailed": "这台电脑无法连接你的浏览器,请稍后重试。","browserConnectUnavailable": "暂时无法连接浏览器,请稍后重试。"},+ "localModels": {+ "title": "模型",+ "noComputersTitle": "还没有电脑",+ "noComputersBody": "先在<link>电脑</link>设置中连接一台电脑,就能在上面下载和运行模型。",+ "thisComputer": "这台电脑",+ "computerPicker": "电脑",+ "computerOffline": "{name} · 离线",+ "agentsUse": "{computer} 上 Agent 的模型来源:{source}",+ "memoryInUse": "内存已用 {used},共 {total}",+ "gpuMemoryInUse": "显存已用 {used},共 {total}",+ "memoryFree": "可用 {free}",+ "memoryFreeChecked": "可用 {free} · {time}检测",+ "recheckMemory": "重新检测内存",+ "details": "详情",+ "retrying": "正在重试…",+ "switchingComputer": "正在切换 {computer}。首次切换可能需要几分钟。",+ "offlineByok": "<strong>{name} 已离线。</strong>请在<link>电脑</link>设置中重新连接,再测试或更改它的模型来源。",+ "offlineByokLastSeen": "<strong>{name} 已离线(上次在线:{time})。</strong>请在<link>电脑</link>设置中重新连接,再测试或更改它的模型来源。",+ "offlineLibrary": "<strong>{name} 已离线。</strong>以下是它上次报告的内容。请在<link>电脑</link>设置中重新连接,再管理它的模型。",+ "offlineLibraryLastSeen": "<strong>{name} 已离线(上次在线:{time})。</strong>以下是它上次报告的内容。请在<link>电脑</link>设置中重新连接,再管理它的模型。",+ "offlineReadOnly": "<strong>{name} 已离线。</strong>以下是它上次报告的内容。",+ "offlineReadOnlyLastSeen": "<strong>{name} 已离线(上次在线:{time})。</strong>以下是它上次报告的内容。",+ "readOnlyNotice": "只有连接 {name} 的人才能下载、加载或移除它的模型。",+ "openComputer": "打开 {name}",+ "openMyComputers": "打开我的电脑",+ "loadFailedTitle": "无法读取 {name} 的模型",+ "loadFailedTitleThisComputer": "无法读取这台电脑的模型",+ "loadingModels": "正在读取模型列表",+ "modelFailure": "{name}:{reason}",+ "assignFailed": "无法把 Agent 切换到这个模型,请重试。",+ "assignBusy": "{agents} 正在工作,无法切换到 {model}。等这一轮结束后再切换。",+ "assignFailedNamed": "无法把 {agents} 切换到 {model},请重试。",+ "willSwitch": "{model} 加载完成后,会把 {agents} 切换过去。",+ "memoryGuidance": "内存提示",+ "noModelsTitle": "没有可用的本地模型",+ "noModelsBody": "{name} 还没有列出适合这套硬件的模型。",+ "sentences": "{first}{second}",+ "listSeparator": "、",+ "gigabytes": "{value} GB",+ "poolSystem": "系统内存",+ "poolUnified": "统一内存",+ "gpuIndex": "GPU {index}",+ "gpuIndexNamed": "GPU {index} · {name}",+ "placeSystem": "系统内存",+ "placeMemory": "统一内存",+ "placeMemoryTitle": "内存",+ "contextTokens": "{tokens} tokens",+ "contextKiloTokens": "{thousands}K tokens",+ "agentCount": { "other": "{count} 个 Agent" },+ "activeParameters": "{parameters} 激活",+ "parametersWithArchitecture": "{scale}({architecture})",+ "secondsLeft": "剩余 {seconds} 秒",+ "minutesLeft": "剩余 {minutes} 分钟",+ "hoursMinutesLeft": "剩余 {hours} 小时 {minutes} 分钟",+ "hoursLeft": "剩余 {hours} 小时",+ "checkingFile": "正在校验文件",+ "percent": "{percent}%",+ "perSecond": "{size}/s",+ "tokensPerSecond": "{speed} tokens/s",+ "promptTokensPerSecond": "提示词 {speed} tokens/s",+ "statusAvailable": "未下载",+ "statusDownloading": "下载中",+ "statusFailed": "加载失败",+ "statusIdle": "已下载",+ "statusLoaded": "已加载",+ "statusLoading": "加载中",+ "statusUnavailable": "无法下载",+ "statusDownloadStopped": "下载已停止",+ "endingCancel": "正在取消",+ "endingRemove": "正在移除",+ "endingUnload": "正在卸载",+ "endingDiscard": "正在放弃",+ "openChat": "打开对话",+ "recommended": "推荐",+ "runsSlower": "运行较慢",+ "noRoomYet": "内存暂时不够加载",+ "loadToAnswer": "加载后才能回复",+ "usedByNames": "{names} 正在使用",+ "actionDownload": "下载",+ "actionResumeDownload": "继续下载",+ "actionLoad": "加载",+ "actionUnload": "卸载",+ "downloadModel": "下载 {name}",+ "cancelModel": "取消下载 {name}",+ "resumeDownloadModel": "继续下载 {name}",+ "removeModel": "移除 {name}",+ "retryModel": "重试加载 {name}",+ "loadModel": "加载 {name}",+ "unloadModel": "卸载 {name}",+ "useForAgentsNamed": "让 Agent 使用 {name}",+ "useForAgents": "用于 Agent",+ "useWithNamed": "让 {agent} 使用 {model}",+ "useWith": "让 {agent} 使用",+ "waitForTurn": "等 {agent} 完成这一轮",+ "downloadProgress": "{name} 下载进度",+ "detailsOf": "{name} 详情",+ "removeFromComputer": "从电脑中移除",+ "discardDownload": "放弃下载",+ "copyEndpointOf": "复制 {name} 的端点",+ "copiedEndpointOf": "已复制 {name} 的端点",+ "copyEndpoint": "复制端点",+ "gatewayPiNotInstalled": "Bifrost · 未安装 Pi",+ "gatewayReady": "就绪 · Bifrost(Pi)",+ "gatewayRegistering": "Bifrost · 正在向 Pi 注册…",+ "gatewaySettingUp": "Bifrost · 正在设置 Pi…",+ "gatewayPiUnavailable": "Bifrost · Pi 不可用",+ "factLastDownload": "上次下载",+ "factLastLoad": "上次加载",+ "factWhyNot": "不可用原因",+ "factNote": "说明",+ "factCapabilities": "能力",+ "factPublisher": "发布者",+ "factParameters": "参数量",+ "factMemory": "内存",+ "factOnDisk": "磁盘占用",+ "factDownload": "下载大小",+ "factContext": "上下文",+ "factVersion": "版本",+ "factSpeed": "速度",+ "factLicense": "许可证",+ "factUsedBy": "使用者",+ "factSource": "来源",+ "factGateway": "网关",+ "factEndpoint": "端点",+ "factFreeDisk": "可用磁盘空间",+ "memoryOn": "{size}({place})",+ "idleUsedWarning": { "other": "{names} 在使用这个模型,加载后才能回复。" },+ "downloadNeedsRoom": "这个模型现在可以下载,不过可用内存只有 {free}({pool})。加载前请关闭占用内存多的应用,再重新检测内存。",+ "noAgentYet": "暂无 Agent",+ "switchAgentTo": "把 Agent 切换到 {name}",+ "switchingAgent": "正在切换…",+ "switchAgent": "切换 Agent…",+ "agentWorking": "{name} · 工作中",+ "finishTurnToSwitch": "这一轮结束后才能切换",+ "poolInUse": "{pool}:已用 {used},共 {total}",+ "otherApps": "其他应用",+ "otherAppsSize": "其他应用 · {size}",+ "hardware": "硬件",+ "affectedUnload": {+ "other": "{names} 在使用这个模型,重新加载前无法回复。"+ },+ "affectedRemove": {+ "other": "{names} 在使用这个模型,换用其他模型前无法回复。"+ },+ "noAgentUses": "没有 Agent 使用这个模型。",+ "makeRoomTitle": "腾出内存再加载",+ "makeRoomDescription": "{name} 需要 {need}({pool}),目前可用 {free}。",+ "unloadAndLoad": "卸载并加载",+ "roomFreeNow": "现在内存够用了(可用 {free})。点击“加载”开始。",+ "unloadTheseLegend": "卸载这些模型来释放内存:",+ "notUsed": "未使用",+ "tooBig": "{name} 需要的内存超过总量 {total}({pool}),无法在这里加载。",+ "alsoUsingMemory": "同样占用这部分内存",+ "closeOtherAppsRecheck": "请关闭其他占用内存的应用({place}),然后点击“重新检测内存”。",+ "closeOtherAppsRetry": "请关闭其他占用内存的应用({place}),然后重试。",+ "otherAppsCloseRecheck": "其他应用占用了 {size}。请关闭其他占用内存的应用({place}),然后点击“重新检测内存”。",+ "otherAppsCloseRetry": "其他应用占用了 {size}。请关闭其他占用内存的应用({place}),然后重试。",+ "unloadNotEnough": "卸载这里的模型也腾不出足够内存,请选择更小的模型。",+ "otherAppsOnPool": "其他应用占用了 {size}({pool})。请关闭不需要的应用,然后点击“重新检测内存”,腾出还差的内存。",+ "selectMore": "至少再选 {size} 的模型卸载,才能加载 {name}。",+ "affectedUntilReload": "{names} 在模型重新加载前无法回复。",+ "switchOnceLoaded": "加载完成后把 {agents} 切换到 {model}",+ "unloadTitle": "卸载 {name}?",+ "unloadDescription": "将释放 {size} 内存。模型文件仍保留在磁盘上,之后可以再次加载。",+ "unloadDescriptionPool": "将释放 {size} 内存({pool})。模型文件仍保留在磁盘上,之后可以再次加载。",+ "removeTitle": "移除 {name}?",+ "removeDescription": "将删除模型文件,在 {computer} 上释放 {size} 磁盘空间。之后可以重新下载。",+ "removeDescriptionLoaded": "将卸载模型并删除文件,在 {computer} 上释放 {size} 磁盘空间。之后可以重新下载。",+ "modeByok": "BYOK",+ "modeLocal": "本地模型",+ "modeSubscription": "订阅",+ "sourceByok": "BYOK · {model}",+ "sourceSubscription": "订阅 · {runtime}",+ "byokExplanation": "BYOK 即自带密钥:使用你自己的 OpenAI 兼容或 Anthropic API 端点,由这台电脑上的网关提供给你的 Agent。",+ "switched": "已切换。",+ "agentsNowUse": "Agent 现在使用:{source}。",+ "agentsMoved": { "other": "已迁移 {count} 个 Agent。" },+ "tasksEnded": { "other": "已结束 {count} 个任务。" },+ "terminateTitle": "结束正在运行的任务?",+ "terminateDescription": {+ "other": "{names} 正在 {computer} 上执行任务。现在切换会结束这些任务,且无法恢复。"+ },+ "terminateDescriptionSome": "有 Agent 正在 {computer} 上执行任务。现在切换会结束这些任务,且无法恢复。",+ "terminateBody": "想保留这些任务,就等它们完成后再切换。",+ "terminateConfirm": "结束任务并切换",+ "modelSource": "模型来源",+ "inUse": "使用中",+ "switchLocalSingle": "<model>{name}</model> 已在这台电脑上,可以在本地运行你的 Agent。",+ "switchLocalChoose": "选择这台电脑上的一个模型,在本地运行你的 Agent。",+ "switchLocalDownload": "在下方下载一个模型,在本地运行你的 Agent。",+ "localOptionLoaded": "{name} · 已加载 · {size}",+ "localOptionDownloaded": "{name} · 已下载 · {size}",+ "switchToLocal": "切换到本地模型",+ "aiRuntime": "AI Runtime",+ "byokApiAddress": "API 地址",+ "baseUrl": "Base URL",+ "byokPath": "路径",+ "byokEndpoint": "端点",+ "byokPathHeading": "路径 · 可选",+ "byokEndpointHeading": "端点 · 可选",+ "byokShowSuggestions": "显示{label}建议",+ "byokSuggestions": "{label}建议",+ "byokDefaultOption": "{label} · 默认",+ "byokPathMostProviders": "大多数服务商",+ "byokPathZhipu": "智谱 GLM(Base URL 为 {url})",+ "byokPathVolcano": "火山引擎方舟",+ "byokPathNone": "不加路径。Base URL 里已经带了。",+ "byokEndpointRuntimeDefault": "{protocol} · {runtime} 默认",+ "byokEndpointNone": "不加端点。Base URL 就是完整地址。",+ "byokAddressHint": "Base URL 以服务商的文档为准。路径和端点是可选的:可以选一个、自己输入,或者清空。",+ "byokAddressInvalid": "路径和端点要写成 /v1 这样的分段,不能有空格、?、# 或 \\。",+ "byokSendsTo": "会向 <url>{url}</url> 发送 {protocol} 请求",+ "byokSendsToRuntimeFormat": "会向 <url>{url}</url> 发送 {protocol} 请求({runtime} 使用的格式)",+ "keySavedHint": "这台电脑上已保存密钥,留空则继续使用。",+ "keyOptionalHint": "端点在这台电脑或你的局域网内时可以不填。",+ "apiKey": "API 密钥",+ "model": "模型",+ "listModels": "获取模型列表",+ "byokListingFrom": "正在从 {url} 获取模型列表…",+ "byokModelsListedFrom": { "other": "已从 {url} 列出 {count} 个模型。" },+ "byokModelHint": "获取端点的模型列表,或者直接输入模型 ID。",+ "byokContextTokens": "{tokens} token 上下文",+ "byokContextKilo": "{thousands}K 上下文",+ "byokTest": "测试",+ "byokConnected": "已连接",+ "byokCouldNotConnect": "连接失败",+ "byokDismiss": "关闭",+ "saveAndSwitch": "保存并切换到 BYOK",+ "refusalOffline": "这台电脑已离线。请在“电脑”设置中重新连接,然后重试。",+ "refusalActionFailed": "这台电脑没能开始执行,请重试。",+ "refusalUnconfirmed": "这台电脑没有及时确认。下方的模型状态显示它正在做什么。",+ "refusalForbidden": "只有连接这台电脑的人才能管理它的模型。",+ "refusalDiskInsufficient": "这台电脑的可用磁盘空间不足以存放这个模型。",+ "refusalInvalidState": "模型在这台电脑上的状态变了。请查看状态后重试。",+ "refusalJobRunning": "这台电脑还在处理这个模型,请等它完成。",+ "refusalMemoryInsufficient": "这台电脑的内存不足以运行这个模型。",+ "refusalNoRoom": "可用内存不足,无法加载。请关闭占用内存多的应用或卸载其他模型,然后重新检测内存。",+ "refusalPlatformUnsupported": "这个模型无法在这台电脑上运行。",+ "refusalModelUnknown": "这台电脑上已经没有这个模型了。",+ "refusalServiceUnavailable": "Linger 暂时连接不到这台电脑,请重试。",+ "refusalToolsUnavailable": "这台电脑上的本地模型工具无法正常工作。",+ "refusalComputerNotFound": "找不到这台电脑,它可能已被移除。",+ "somethingWentWrong": "出了点问题,请重试。",+ "errorCancelled": "加载已停止。",+ "errorChecksumMismatch": "下载的文件已损坏。请移除模型后重新下载。",+ "errorDiskInsufficient": "可用磁盘空间不足。",+ "errorDownloadFailed": "下载没有完成。",+ "errorEngineStartFailed": "模型引擎没有启动。",+ "errorGatewayRegistrationFailed": "模型已加载,但没能让 Agent 访问它。",+ "errorHealthCheckFailed": "模型已启动,但没有响应。",+ "errorInvalidState": "模型当时正在执行另一个步骤。",+ "errorJobRunning": "另一个步骤当时还在进行。",+ "errorLoadNoRoom": "可用内存不足,无法加载。",+ "errorMemoryInsufficient": "这台电脑的内存不足以运行它。",+ "errorModelFilesMissing": "模型文件缺失。请移除模型后重新下载。",+ "errorModelUnknown": "这台电脑上已经找不到这个模型了。",+ "errorNetworkUnavailable": "这台电脑连接不到网络。",+ "errorOutOfMemory": "加载时内存耗尽。",+ "errorGatewayHomeNotPrivate": "模型已加载,但没能让 Agent 访问它:这台电脑上的某个 Linger 文件夹属于另一个系统账号。",+ "errorGatewayHomeNotPrivatePath": "模型已加载,但没能让 Agent 访问它:文件夹 {path} 属于另一个系统账号。请退出 Linger,重命名这个文件夹,然后重新打开 Linger 并再次加载模型。",+ "shortCancelled": "加载已停止",+ "shortChecksumMismatch": "文件已损坏",+ "shortDiskInsufficient": "磁盘空间不足",+ "shortEngineStartFailed": "引擎未启动",+ "shortGatewayRegistrationFailed": "Agent 无法访问",+ "shortHealthCheckFailed": "模型没有响应",+ "shortBusy": "正在执行其他步骤",+ "shortLoadNoRoom": "可用内存不足",+ "shortMemoryInsufficient": "内存不足",+ "shortModelFilesMissing": "文件缺失",+ "shortModelUnknown": "已不在这台电脑上",+ "shortNetworkUnavailable": "网络不可用",+ "shortOutOfMemory": "内存耗尽",+ "shortNotForComputer": "不适用于这台电脑",+ "noteNoRoomToLoad": "已下载,但可用内存不足({place}),无法加载。内存够用时再加载。",+ "shortNeedsDisk": "需要更多磁盘空间",+ "shortNeedsMemory": "需要更多内存",+ "shortNeedsDiskSize": "需要 {need} 磁盘空间",+ "shortNeedsSize": "需要 {need}",+ "unavailableMemory": "这台电脑的内存不足以运行它。",+ "unavailableMemoryReclaimable": "这台电脑的内存不足以运行它。请关闭占用内存多的应用,然后重新检测内存。",+ "unavailableMemorySizes": "需要 {need} 内存,这台电脑可用于模型的内存为 {have}。",+ "unavailableMemorySizesReclaimable": "需要 {need} 内存,这台电脑可用于模型的内存为 {have}。请关闭占用内存多的应用,然后重新检测内存。",+ "unavailableDisk": "可用磁盘空间不足。",+ "unavailableDiskSizes": "需要 {need} 磁盘空间,目前可用 {have}。",+ "libraryNotReportedTitle": "{computer} 还没有报告本地模型",+ "libraryNotReportedBody": "用最新版 Linger 应用连接后,它就会报告。",+ "libraryToolFailedTitle": "无法读取 {computer} 上的本地模型",+ "libraryToolFailedBody": "这台电脑上的本地模型工具没有响应。请确认它们已安装并能正常工作,然后重新打开这个页面。",+ "libraryToolNotInstalledTitle": "{computer} 上还没有设置本地模型",+ "libraryToolNotInstalledBody": "在那台电脑的 Linger 桌面应用中运行“Quick Install”即可添加。",+ "capabilityCoding": "编程",+ "capabilityMultilingual": "多语言",+ "capabilityReasoning": "推理",+ "capabilityToolUse": "工具调用",+ "capabilityVision": "视觉",+ "architectureDense": "Dense",+ "architectureMoe": "MoE",+ "sourceAgentsWorking": "这台电脑上的 Agent 正在执行任务。",+ "sourceByokAuthFailed": "端点拒绝了这个 API 密钥。",+ "sourceByokInvalidConfig": "这台电脑无法使用这个端点。HTTPS 端点需要 API 密钥;普通 HTTP 只能用于这台电脑或你的局域网。",+ "sourceByokNotFound": "端点的地址没有应答,或者它不提供这个模型 ID。",+ "sourceByokUnreachable": "这台电脑连接不到端点。",+ "sourceByokUpstreamRejected": "端点拒绝了测试请求。",+ "sourceNoRoom": "这台电脑的可用内存不足,无法加载这个模型。请关闭占用内存多的应用或卸载其他模型,重新检测内存后重试。",+ "sourceSwitchFailed": "这台电脑没能完成切换,请重试。",+ "sourceForbidden": "只有连接这台电脑的人才能更改它的模型。",+ "sourceUnavailable": "这台电脑无法切换模型。请先更新它上面的 Linger,然后重试。",+ "sourceUnconfirmed": "这台电脑没有及时响应。它可能仍在切换,请一分钟后再查看。",+ "sourceRuntimeNotEnabled": "这台电脑上还没有设置这个 AI Runtime。",+ "sourceReadUnconfirmed": "这台电脑没有及时响应,请重试。",+ "sourceReadFailed": "无法读取这台电脑上 Agent 的模型来源,请重试。",+ "guidanceBlockedLoadTitle": "加载前先释放内存",+ "guidanceBlockedLoadTitleGpu": "加载前先释放显存",+ "guidanceBlockedLoadBody": "其他应用占用了 {other} 内存(可用 {free},共 {total})。内存紧张时强行加载模型可能让电脑卡死。请关闭视频播放器、游戏、浏览器等占用内存多的应用,然后点击“重新检测内存”再加载。",+ "guidanceBlockedLoadBodyGpu": "其他应用占用了 {other} 显存(可用 {free},共 {total})。内存紧张时强行加载模型可能让电脑卡死。请关闭视频播放器、游戏、浏览器等占用内存多的应用,然后点击“重新检测内存”再加载。",+ "guidanceBlockedDownloadTitle": "释放内存后可安装更大的模型",+ "guidanceBlockedDownloadTitleGpu": "释放显存后可安装更大的模型",+ "guidanceBlockedDownloadBody": "其他应用占用了 {other} 内存(可用 {free},共 {total}),所以更大的模型暂时显示为不可用。请关闭不需要的应用(如视频播放器、游戏、浏览器),然后点击“重新检测内存”,检测出全部可用内存后再安装。",+ "guidanceBlockedDownloadBodyGpu": "其他应用占用了 {other} 显存(可用 {free},共 {total}),所以更大的模型暂时显示为不可用。请关闭不需要的应用(如视频播放器、游戏、浏览器),然后点击“重新检测内存”,检测出全部可用内存后再安装。",+ "guidanceConstrainedTitle": "其他应用正在占用内存",+ "guidanceConstrainedTitleGpu": "其他应用正在占用显存",+ "guidanceConstrainedBody": "其他应用占用了 {other} 内存(可用 {free},共 {total})。为避免加载失败或系统卡死,请关闭不需要的应用,然后点击“重新检测内存”,这样可以加载更好的模型。",+ "guidanceConstrainedBodyGpu": "其他应用占用了 {other} 显存(可用 {free},共 {total})。为避免加载失败或系统卡死,请关闭不需要的应用,然后点击“重新检测内存”,这样可以加载更好的模型。"+ },"runtimeStatus": {"stateCanceled": "已取消","stateCompleted": "已完成",@@ -1142,9 +1433,7 @@"nothingToResend": "没有需要重新发送的消息","resendFailed": "重新发送失败,请重试。","backgroundTasks": "后台任务",- "backgroundTasksRunning": {- "other": "{count} 个任务正在后台运行"- },+ "backgroundTasksRunning": { "other": "{count} 个任务正在后台运行" },"openTask": "打开任务 {title}","cancelTask": "取消 {title}","cancelTaskNotConfirmed": "取消 {title} 未确认,点击重试",@@ -1210,9 +1499,7 @@"workingWithImages": "正在处理图片","recoveringTask": "正在恢复任务","reviewingResults": "正在检查结果",- "workingThroughSteps": {- "other": "正在完成 {count} 个步骤"- },+ "workingThroughSteps": { "other": "正在完成 {count} 个步骤" },"workingThroughTask": "正在逐步完成任务","phraseRead": "正在读取文件","phraseEdit": "正在编辑文件",