feat(frontend): settings 页接 /api/settings(13 设置 + 主题/语言持久化)— Stage 5 (Vue 重构)#507
feat(frontend): settings 页接 /api/settings(13 设置 + 主题/语言持久化)— Stage 5 (Vue 重构)#507Cmochance wants to merge 1 commit into
Conversation
SettingsPage 从 stub 升级为综合设置页,逐字复刻旧 renderSettings 的读写: - 13 项设置(autoApplyOnStart/restoreCodexOnExit/autoUnlockCodexPlugins/autoWakeCodexPet/ codexQuotaEnabled/codexNetworkAccess/exposeAllProviderModels/showGrayProviders/ mcpCredentialsPortableStore + webFetchBackend + proxyPort/adminPort + updateUrl) - 默认值语义复刻(!==false / ===true);partial PUT 浅合并;乐观更新 + 失败回滚 - theme/language 双向持久化(改后 PUT /api/settings);App 启动从后端 hydrate(无 echo) - 新增 api/settings.ts + stores/settings.ts;webFetchBackend 默认 auto(对齐后端 schema) 注:删旧 app.js 推迟 — 新前端尚有 4 个 stub 页(Dashboard/Guide/CodexSkin/Desktop) + settings 三复杂子 UI(residual scan/snapshot/diagnostic)未迁,需保留旧代码作移植参考。 Refs MOC-254
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 58cb1baca6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // 默认 auto(对齐后端 schema DEFAULT_WEB_FETCH_BACKEND + 旧前端;key 缺失时运行时实为 auto) | ||
| const webFetchBackend = computed<string>({ | ||
| get: () => store.str('webFetchBackend', 'auto'), | ||
| set: (v) => void persist({ webFetchBackend: v }), |
There was a problem hiding this comment.
Require Chrome checks before saving headless backend
When a user selects auto or headless on a machine without Chrome/headless-shell, this setter now immediately persists webFetchBackend and never runs the existing readiness flow; the old UI gated these choices through /api/system-proxy/status, /api/chrome/detect, and /api/chrome/ensure in frontend/js/app.js around the web-fetch handler, and the current i18n hint still promises first selection will detect/download Chrome. This can leave the saved backend unusable so web_fetch calls fail until the user manually changes the setting; add the same proxy/Chrome gate before calling persist.
Useful? React with 👍 / 👎.
| setAppearance(v) | ||
| void persist({ theme: v }) |
There was a problem hiding this comment.
Roll back theme and locale after failed saves
If /api/settings rejects while saving the theme, setAppearance has already changed the DOM and localStorage before persist({ theme: v }); persist only rolls back the Pinia settings object and shows a toast, so the UI keeps showing a value that the backend did not save and the next hydrate can revert it. The language setter below has the same ordering via setLocale; either save first or restore the previous appearance/locale in the failure path.
Useful? React with 👍 / 👎.
Stage 5 of the Vue 3 frontend rewrite (stacked on #506). Wires the settings page to
/api/settings.内容
!==false/===true);partial PUT 浅合并;乐观更新 + 失败回滚验证
本 PR 不删 app.js/css/vendor —— 新前端尚有 4 个 stub 页(Dashboard/Guide/CodexSkin/Desktop)+ settings 三复杂子 UI(residual scan/snapshot/diagnostic)未迁,需保留旧代码作移植参考。删旧留作全部迁完后的最终清理。
合并策略
stacked,不单独 merge — 全部 stage 完成 + e2e 验收后逐个合并。
Refs MOC-254