Skip to content

feat(web): configure and preview provider affinity (3/3) - #898

Draft
renaesop wants to merge 3 commits into
BaaRai:mainfrom
renaesop:codex/maas-cache-affinity-ui
Draft

renaesop wants to merge 3 commits into
BaaRai:mainfrom
renaesop:codex/maas-cache-affinity-ui

Conversation

@renaesop

@renaesop renaesop commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

The LLM settings drawer needs to show the affinity policy a profile will use before it is saved. This adds independent mode controls, a read-only draft preview, and translations for all five shipped locales.

Dependency draft: blocked by #897, which depends on #750. The base is main; the contributor cannot create an upstream base branch for a cross-fork stack. The current PR therefore includes the provider and configuration commits: 28 cumulative files. The UI/preview subsystem itself is 13 files, +547/-21 lines: review only this layer.

Keep this draft until the preceding PRs merge, then rebase onto main and drop the inherited commits before requesting review. That leaves only the settings UI and preview subsystem within the repository's review-size limit.

Behavior

  • Configure automatic/custom/off session headers, automatic/off recovery and automatic/session/off body cache keys.
  • Preview the resolved platform, header, cache-key and recovery behavior while editing. Debounce requests and ignore outdated responses.
  • Register POST /api/llm/policy through main's new perm.Authenticated route mechanism. Previewing requires a session but no saved profile, credentials, database access, DNS resolution or provider request.
  • Keep disabled and unsupported behavior distinct. Previewing does not save changes or promise cache hits.
  • Include Chinese, Turkish, Vietnamese, Brazilian Portuguese and French translations.

Validation

Rebased onto main 2f065a958e4bc84e300ece4af501a5cdd3ed08cd; resolved the route registration conflict using the new authenticated registration API.

  • Complete-stack database/server regression run: 205 tests/subtests passed with -race, including preview behavior and the production authentication chain (401 without a session, 200 with a valid session).
  • go build ./... and go vet ./... passed.
  • TypeScript checking, all locale key/placeholder checks, 11 i18n tests, 67 reducer/UI-utility tests and the production static frontend build passed.
  • Scoped Biome checks passed with warnings. No browser automation, live provider calls or deployment were used.

The upstream Norma #15 release prerequisite inherited through #750 remains.

@renaesop

renaesop commented Dec 3, 2026

Copy link
Copy Markdown
Contributor Author

This is the settings UI and preview layer of the split requested on #750. Dependency order: #750 → #897 → #898.

Its own change is commit 2acac665: 13 files, +547/-21 (layer-only diff). The GitHub PR currently shows 28 cumulative files because it targets main and carries both predecessors. It remains Draft; after those changes merge, rebase only this layer onto updated main before requesting review. The 13-file count is this layer's scope, not today's complete PR diff.

The preview endpoint stays with the UI because it answers questions about unsaved form inputs. It uses the same resolver as the runtime, but does not load credentials, query the database, resolve DNS, contact a provider or persist settings. Persistence and legacy-client compatibility are owned by #897. The UI debounces requests and ignores outdated results.

File Responsibility
web/src/app/(main)/system/llm/page.tsx Policy controls and save/connection-test integration.
web/src/app/(main)/system/llm/_components/cache-policy-preview.tsx Debounced draft preview and stale-response handling.
web/src/lib/api.ts Preview request and policy fields in existing requests.
web/src/lib/types.ts Profile mode and preview request/response types.
server/llm_policy_preview.go Normalize draft inputs and resolve their policy without side effects.
server/llm_policy_preview_test.go Resolution, disabled/unsupported cases, SDK defaults, no provider requests and authenticated-route behavior.
server/server.go Register the preview route using s.handle(..., perm.Authenticated, ...).
web/src/i18n/locales/zh-CN.json Chinese translations.
web/src/i18n/locales/tr.json Turkish translations.
web/src/i18n/locales/vi.json Vietnamese translations.
web/src/i18n/locales/pt-BR.json Brazilian Portuguese translations.
web/src/i18n/locales/fr.json French translations, including the locale added on main during this split.
docs/maas-cache-affinity.md Document preview behavior and the completed integration.

The rebase onto main 2f065a95 resolved the route-permission refactor conflict using the new registration API. A test through the production handler verifies 401 without a session and 200 with a valid session.

Local validation passed: 205 complete-stack database/server tests and subtests under -race, build/vet, TypeScript checking, all locale key/placeholder checks, 11 i18n tests, 67 reducer/UI-utility tests and the production static build. Scoped Biome checks passed with warnings. Tests remain with the preview implementation so its authorization and read-only behavior can be reviewed in the same change.

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.

1 participant