Fix report draft save and microphone startup
- Allow draft reports to be saved without patient name or hospital ID while keeping completed reports strictly validated. - Preserve completed-report identity validation when updating existing reports by checking merged old and new values. - Show real API save errors in the report editor and send expired sessions back to login instead of reporting a generic backend outage. - Guard speech startup for missing getUserMedia or AudioContext support and explain localhost/HTTPS microphone requirements. - Add report schema tests covering draft identity fields and completed-report validation. - Update AGENTS and docs for report editor behavior, feature status, progress, and testing coverage.
This commit is contained in:
@@ -85,6 +85,7 @@ AI 面板支持两种模式:
|
||||
|
||||
- 前端连接 `/api/speech/iat`,不再生成讯飞鉴权 URL,也不读取 APPID/APIKey/APISecret。
|
||||
- 浏览器采集麦克风音频,转换为 16k PCM 后发送音频帧。
|
||||
- 启动前会检查浏览器是否支持 `navigator.mediaDevices.getUserMedia` 和 `AudioContext`;如果不是 `localhost` 或 HTTPS 等安全上下文,浏览器会禁止麦克风能力,页面会提示切换访问方式。
|
||||
- 后端读取 Settings API 中的 `xfSpeechConfig`,连接讯飞 IAT,上游首帧由后端补齐 `common.app_id` 和默认 `business` 参数。
|
||||
- 识别结果由后端转发回前端,并追加到 AI 输入框。
|
||||
|
||||
@@ -92,6 +93,7 @@ AI 面板支持两种模式:
|
||||
|
||||
- 保存草稿不强制患者姓名和住院号。
|
||||
- 完成报告要求患者姓名和住院号。
|
||||
- 保存失败时会优先展示后端返回的真实错误;如果 Session 失效,会提示重新登录并返回登录页。
|
||||
- 保存时优先调用 `POST /api/reports` 或 `PATCH /api/reports/:id`;后端会先做 HTML 白名单清洗,再写入 PostgreSQL 并维护历史版本。
|
||||
- 编辑已有已完成报告时,后端会把旧内容追加到历史记录并递增 `revision`。
|
||||
- 只有本地回退开启时,API 不可用才保留原有本地 `localStorage.reports` 保存逻辑;生产构建默认关闭这条路径。
|
||||
|
||||
Reference in New Issue
Block a user