Skip to content

Commit a3a1c97

Browse files
authored
fix(outline): copy all headings when user queries hidden and level 0 (#659)
## Summary Fixes the issue where copying the outline returns empty results when user queries are hidden and expand level is set to 0, even though AI response headings are visible in the panel. ## Problem When `showUserQueries = false` and `expandLevel = 0`: 1. `getConversationCopyHeadingLevel(0, false)` returned `Math.max(1, 0) = 1` 2. This set `maxHeadingLevel = 1`, filtering out H2+ headings in `formatAssistantHeadings` 3. But the outline panel displays these H2+ headings when `expandLevel = 0` 4. Result: User sees headings in the panel but gets empty results when copying ## Solution When `expandLevel = 0` and user queries are hidden, set `maxHeadingLevel = 6` to copy all heading levels (H1-H6), matching what's visible in the panel. ## Changes - Modified `getConversationCopyHeadingLevel()` to return 6 when `!showUserQueries && expandLevel === 0` - Updated CHANGELOG.md and CHANGELOG.zh-CN.md ## Test plan - [ ] Set outline expand level to 0 - [ ] Disable "Show user queries" - [ ] Verify AI response headings are visible in the outline panel - [ ] Click "Copy outline" button - [ ] Verify all visible headings are copied successfully
1 parent b4c07be commit a3a1c97

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ versioning follows [Semantic Versioning](https://semver.org/).
1515

1616
### 🐛 Bug Fixes
1717

18+
- **Outline copy at level 0** — Fixed issue where copying the outline returned empty results when user queries were hidden and expand level was set to 0, even though AI response headings were visible in the panel. Now copies all heading levels (H1-H6) in this scenario to match what's displayed.
1819
- **Prompt queue keyboard shortcuts** — Prompt queue input now respects the user's send shortcut setting (Enter vs Ctrl+Enter) instead of hardcoding Enter behavior. The expanded queue panel uses capture-phase event handling to prevent keyboard events from being blocked by the editable guard, so Enter and Ctrl+Enter shortcuts work correctly on all platforms including Mac.
1920
- **Prompt queue text alignment** — Queue item text now displays left-aligned instead of center-aligned for better readability.
2021
- **ChatGLM generation detection** — Fixed false-positive generation status detection caused by historical "answer terminated" messages. The `isGenerating()` method now excludes `.stop-answer-default` selector which matches static text from previous responses rather than the current generation state.

CHANGELOG.zh-CN.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
### 🐛 问题修复
1616

17+
- **层级为 0 时的大纲复制** — 修复当未开启展示用户问题且大纲层级设为 0 时,复制大纲返回空内容的问题,虽然面板上显示了 AI 回复的标题。现在该场景下会复制所有层级(H1-H6)的标题,与面板显示一致。
1718
- **提示词队列键盘快捷键** — 提示词队列输入框现在遵守用户的发送快捷键设置(Enter 或 Ctrl+Enter),不再硬编码 Enter 行为。展开的队列面板使用捕获阶段事件处理,避免键盘事件被可编辑元素保护机制拦截,确保 Enter 和 Ctrl+Enter 快捷键在所有平台(包括 Mac)上正常工作。
1819
- **提示词队列文本对齐** — 队列项文本现在左对齐显示,而不是居中对齐,提升可读性。
1920
- **ChatGLM 生成状态检测** — 修复由历史消息中"本次回答已被终止"静态文本导致的生成状态误判。`isGenerating()` 方法现在排除 `.stop-answer-default` 选择器,该选择器匹配的是历史回复中的静态文本,而非当前生成状态。

src/components/OutlineTab.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,14 @@ const buildVisibilityMaps = (
193193
return { parentMap, visibleMap }
194194
}
195195

196-
const getConversationCopyHeadingLevel = (expandLevel: number, showUserQueries: boolean): number =>
197-
showUserQueries ? expandLevel : Math.max(1, expandLevel)
196+
const getConversationCopyHeadingLevel = (expandLevel: number, showUserQueries: boolean): number => {
197+
// When user queries are hidden and expandLevel is 0, we should still copy all visible headings
198+
// because the panel shows AI response headings even when expandLevel is 0
199+
if (!showUserQueries && expandLevel === 0) {
200+
return 6 // Copy all heading levels (H1-H6)
201+
}
202+
return showUserQueries ? expandLevel : Math.max(1, expandLevel)
203+
}
198204

199205
// 递归渲染大纲树节点
200206
// 使用 outline-hidden 类而非条件渲染

0 commit comments

Comments
 (0)