Add demo mode factory reset

- Align the backend seeded default surgery template with the report editor's default report content.

- Add backend demo defaults for the default template, Kimi provider, and Xunfei speech proxy configuration.

- Change system reset into a super-admin demo mode factory reset that clears reports, audit logs, files, custom templates, and non-default users.

- Keep only the default admin, manager, doctor, and default surgery template after demo reset.

- Replace the old local-only reset all data button with a two-confirmation backend reset flow.

- Add tests covering demo default alignment and database-backed demo reset behavior.

- Update docs to describe demo mode reset semantics and production credential cautions.
This commit is contained in:
2026-05-02 02:52:30 +08:00
parent bc235b2358
commit 911b96b883
17 changed files with 361 additions and 85 deletions

View File

@@ -50,11 +50,12 @@
超级管理员可执行:
- 恢复系统设置出厂设置:优先调用 `POST /api/settings/system/reset`只有本地回退开启时失败才重置本地 `systemSettings`
- 重置全部数据:仅本地回退开启时执行 `localStorage.clear()` 并刷新;生产构建默认阻止把本地清空误认为后端数据重置。
- 恢复演示出厂设置:调用 `POST /api/settings/system/reset`前端做二次确认后由后端恢复 demo mode
当前 demo mode reset 会清空报告、报告历史、报告媒体、文件资源和审计日志;用户只保留 `admin``manager``0001` 三个默认账号模板只保留“腹腔镜胆囊切除术报告”系统设置恢复默认抽帧策略、默认模板、Kimi Provider 和讯飞语音代理配置。该能力用于演示环境快速回到可演示状态,不是生产备份/恢复方案。
## 注意事项
- `systemSettings` 的本地混淆不等于安全加密;当前仅作为开发/显式本地回退模式下 API 不可用时的兼容缓存。
- 初始化、类型和系统设置页面已统一使用 `xfSpeechConfig`;当前由后端语音代理使用。
- 默认 API Key 或语音密钥不应留在生产前端代码中
- demo mode 内置第三方服务演示凭据,生产部署前必须替换或移除,并通过正式密钥管理流程维护