feat: add --brief flag to rag_query.py to reduce output verbosity

- New --brief flag for semantic/search subcommands outputs one-line-per-result
  (title + link + 80-char snippet) instead of full 500-char excerpts
- Reduces output from ~60 lines to ~7 lines per query (3 results)
- /compare-masters now uses --brief by default (multiple queries no longer
  flood the terminal with long excerpts)
- Full output (default) preserved for single-master /ask and debugging
This commit is contained in:
xianren
2026-04-05 09:32:55 +08:00
parent 16cbda8e50
commit 9873d0514d
2 changed files with 52 additions and 8 deletions
+4 -2
View File
@@ -118,11 +118,13 @@ PROJECT_ROOT="$(dirname "$(dirname "$(dirname "$SKILL_FILE")")")"
2. **加载法师角色内容**`$PROJECT_ROOT/prebuilt/{slug}/teaching.md` 和 `voice.md`
3. **执行语义检索**
3. **执行语义检索**(使用 `--brief` 减少输出冗余)
```bash
python3 "$PROJECT_ROOT/tools/rag_query.py" semantic "<问题>" --top_k 3
python3 "$PROJECT_ROOT/tools/rag_query.py" semantic "<问题>" --top_k 3 --brief
```
`--brief` 模式每条结果只显示 2 行(经名+链接+80字摘要),避免 60+ 行的完整经文内容刷屏。
4. **过滤结果**:根据该法师 meta.json 的 `search_scope.primary_cbeta_ids` 过滤检索结果
5. **降级处理**:若 `rag_query.py` 不可达(路径解析失败或 FoJin API 不可用),改用 teaching.md 中已验证的 FoJin 链接作为出处,并在回答开头提示"本次检索基于预置内容"