docs: add Prompt content rendering strategy for system-injected XML tags

Add section 3.2.4 to define how system-injected XML tags (ide_opened_file,
system-reminder, gitStatus, etc.) in prompts should be rendered: collapsible
blocks with tag name shown, click to expand/collapse. List previews skip
XML tags and extract user-input text only.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-06-26 14:49:29 +08:00
parent b1b025983b
commit 83ae0bfe74
+30
View File
@@ -433,6 +433,36 @@ builder_sessions N──1 prompts (via claude_session_id, 可选关联)
- **分页**:Prompt 列表默认每页 20 条,支持加载更多或翻页
- **搜索**:支持按 Prompt 内容关键词搜索(在 prompts 表的 prompt 字段上 LIKE 查询)
#### 3.2.4 Prompt 内容渲染
`prompts` 表的 `prompt` 字段中会混入 IDE 和系统自动注入的 XML 标签(如 `<ide_opened_file>`、`<system-reminder>`、`<gitStatus>` 等)。这些内容直接展示会影响阅读体验,需要做折叠处理。
**渲染规则**:
- 识别 prompt 中所有 XML 标签包裹的内容块
- 所有系统注入的标签块统一折叠,只显示一个可点击的展开行(显示标签名称)
- 用户点击后展开查看完整内容,再次点击收起
- 用户实际输入的文本正常展示,保留原始格式
**渲染示例**:
```
┌──────────────────────────────────────────────────┐
│ ▶ ide_opened_file │
├──────────────────────────────────────────────────┤
│ │
│ 我感觉信息都挺全面的,不过你可以自己检查一下, │
│ 有没有什么遗漏 │
│ │
├──────────────────────────────────────────────────┤
▶ system-reminder │
├──────────────────────────────────────────────────┤
▶ gitStatus │
└──────────────────────────────────────────────────┘
```
**列表预览**:在 Prompt 列表中显示截断预览时,自动跳过 XML 标签内容,只提取用户实际输入的文本作为预览摘要(前 150 字符)。
---
### 3.3 智能建议(优先级 P2)