# 功能变更实现方案文档(20260419_2344) ## 实现方案 A:切换模板时重置 AI 对话 ### 变更点 `ReportEditor.tsx` line 1240-1251(模板应用 useEffect 中)。 ### 具体实现 在 `setCapturedFrames([])` 之后、`updatePageHeight()` 之前,添加: ```tsx setChatMessages([]); setChatInput(''); setAiUploadedImages([]); setAiSelectedFrames([]); stateRef.current = { ...stateRef.current, chatMessages: [], chatInput: '', videos: [], capturedFrames: [] }; ``` 同时更新 `stateRef.current`,确保草稿保存时不会残留旧 AI 数据。 --- ## 实现方案 B:修复 diff modal 段落间距 ### 变更点 `ReportEditor.tsx` line 835-838 的 `stripHtml` 函数。 ### 具体实现 从: ```ts tmp.innerHTML = html.replace(/<\/p>/gi, '
\n').replace(/` 元素之间自动插入换行,无需手动添加。去掉手动插入后,段落间距恢复正常。
---
## 实现方案 C:API 密钥 DOM 暴露修复
### 变更点
`src/pages/SystemSettings.tsx` line 362-377 的 API Key input。
### 具体实现
1. 导入 `useRef`
2. 创建 `apiKeyInputRef = useRef