Skip to content

feat(web): add Custom Model Hub tab (Variant C), Chat badge, and EN/ZH i18n - #807

Draft
oldwinter53 wants to merge 1 commit into
oldwinter53/feat-custom-models-pr1from
oldwinter53/feat-custom-models-web-pr2
Draft

oldwinter53 wants to merge 1 commit into
oldwinter53/feat-custom-models-pr1from
oldwinter53/feat-custom-models-web-pr2

Conversation

@oldwinter53

Copy link
Copy Markdown

Summary

Stacked on top of #802 (oldwinter53/feat-custom-models-pr1), this PR ships the production Web UI for Variant C (Custom Hub Tab), the Chat / Agent model selector Custom badge, and complete English + Simplified Chinese localization.

What Changed

  • Settings > Models Sub-Tabs & Layout (apps/web/src/features/local-models/local-models-page.tsx)
    • Preserves top-level ModelSourceTabs (Local model | BYOK).
    • Adds segmented sub-tabs inside Local model: Official Curated (default, filtering model.origin !== "custom") and Custom · HF / ModelScope with an installed count badge.
    • Dynamically widens <main> from max-w-(--app-settings-width) (832px) to max-w-[1200px] when the Custom Hub tab is active, preserving ?tab=custom alongside ?computer= in URL search params.
    • Lazy-loads CustomModelHubTab (React.lazy) so Official Curated and BYOK pay zero initial bundle cost.
  • Custom Model Hub Tab & Preflight Workspace (custom-model-hub-tab.tsx, custom-model-blocks.tsx, custom-model-rules.ts, custom-models-queries.ts, local-model-brand.ts)
    • Extracted shared modelBrand / familyBrand into local-model-brand.ts so curated and custom entries share identical brand styling.
    • Pure omnibox parser (parseOmniboxInput for HF URLs, ModelScope URLs, owner/repo, plain search), preflight evaluator (1.1x disk hard-stop, transparent GGUF-header / 1.2x + 0.8 GB memory comfort tiers, incomplete metadata escape hatch), sweet-spot quant selection, and real byte headroom derived from LocalModelsView.
    • Wired to PR feat(local-models): custom hub model backend plumbing, contracts, and redaction (PR 1) #802 TeamHub endpoints (POST .../local-models/custom/search, .../custom/probe, .../custom/download, plus extended act with smoke_test, force, and context_tokens).
    • Security-first gated token flow: <input type="password"> held strictly in React state (zero localStorage, cleared on repo switch/unmount, no demo token button).
    • Incompatible repo card (raw_safetensors, mlx_unsupported, no_runnable_files) with 1-click community GGUF search escape.
    • Live sharded download progress card + cancel .part cleanup notice; Standby-First installed custom model cards with Custom · Untested / Verified / Failed badges, Quick Smoke Test (ctx=4096), OOM Retry at ctx=2048, corrupt Re-download Clean Copy, collapsible redacted diagnostic log, Use for Agents / Return to Standby reusing MakeRoomDialog / UnloadModelDialog, and 1-click Delete reusing RemoveModelDialog when Agents use the model.
    • Clean upgrade notice when older Computers return LOCAL_MODELS_CUSTOM_UNSUPPORTED.
  • Chat & Agent Model Selectors (apps/web/src/features/rooms/)
    • Updated use-agent-model-selection.ts (useResolvedAgentModelMeta, customLocalModelIds), direct-agent-model-switch.tsx, edit-agent-runtime-dialog.tsx, and quick-create-local-agent-dialog.tsx to cross-reference localModelsQueryOptions by pi_model (model.origin === "custom") and render a localized Custom badge.
  • Bilingual EN + ZH i18n (custom-models.messages.ts, local-models.messages.ts, local-models-copy.ts, zh-CN.json)
    • Added full English messages and Simplified Chinese translations under customModels and new localModels error codes, passing catalog.test.ts and voice-risk-markers.test.ts.

Verification

  • pnpm --filter @linger/web typecheck — passed (0 errors)
  • pnpm --filter @linger/web lint — passed (--max-warnings=0)
  • pnpm --filter @linger/web test src/features/local-models/ src/i18n/catalog.test.ts src/features/rooms/chat/voice-mode/voice-risk-markers.test.ts src/features/rooms/members/ src/features/rooms/chat/ — 99/99 test files passed, 1155/1155 tests passed
  • pnpm --filter @linger/web run build:assets — passed (592.37 kB minified / 203.11 kB gzip / 176.45 kB Brotli, within all budgets)
  • scripts/ci/check-changed-files.sh origin/oldwinter53/feat-custom-models-pr1 --worktree — passed (English-only + Prettier)
  • pnpm react:doctor --base origin/oldwinter53/feat-custom-models-pr1 — passed (0 errors)
  • Headless Chromium visual verification against vite preview (Desktop 1440x900 curated, custom probed, gated 401, incompatible + smoke-failed; Mobile 375x812 custom tab) — 0 console/page errors, 0 horizontal overflow (scrollWidth === clientWidth).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants