fix: add size-based reading strategy and ban web-search fallback

sites/tacit0924/v1/urls.md: 新增"读取警告",标注文档 853K 字
  - 禁止 get_content
  - doc.resolve_document_structure 为唯一可行方案
  - 注明超时处理方式(重试一次,不行就停)

sources/tencent-doc/v1/usage.md: 重写为"文档大小分级"
  - 顶部增加策略表(<1万/1万-50万/>50万/未知)
  - 超大文档单独标注禁止 get_content
  - 增加超时处理步骤(重试一次,禁止 web search)

SKILL.md: 优先级规则第 4 条改为"禁止降级到 web search"

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-16 18:37:56 +08:00
parent e8a6fc4ca2
commit 1a36d8119f
3 changed files with 49 additions and 28 deletions
+31 -13
View File
@@ -1,12 +1,33 @@
# 腾讯文档 — 使用
## 读取文档内容
## 文档大小分级读取策略
**读取方法由文档大小决定**,先查数据源信息确认文档大小,再选对应策略:
| 文档大小 | 推荐方法 | 说明 |
|---------|---------|------|
| < 1 万字 | `get_content` | 一次性读取全文 |
| 1万 ~ 50万字 | `doc.resolve_document_structure` | 返回全部节点(含 text_preview |
| > 50万字 | `doc.resolve_document_structure` | 超大文档,后端可能超时 |
| 未知大小 | 先 `doc.get_outline` 探测结构 → 判断大小 | 不要直接试 |
> **已知超大文档**Tacit0924 资源文档(853K 字),见 `sites/tacit0924/v1/urls.md`。禁止对其使用 `get_content`,5 秒后端超时必失败。
### 超时处理
`doc.resolve_document_structure` 对于 >50 万字的文档可能因后端不稳定而超时:
```
第一次超时 → 等待 3 秒重试一次 → 仍超时则告知"后端暂不可用"
```
**禁止降级到 web search**。告知用户稍后重试即可。
### 从 URL 提取 file_id
URL 格式`https://docs.qq.com/doc/DR2xUcFdrSVhJTkZu`
URL 格式 `https://docs.qq.com/doc/DR2xUcFdrSVhJTkZu``/doc/` 后面部分即 file_id。
提取 `DR2xUcFdrSVhJTkZu` 部分即为 file_id。
## 读取步骤
### 第一步:判断文档类型
@@ -17,7 +38,7 @@ mcporter call tencent-docs smartcanvas.read file_id=<FILE_ID> size=10
- 报错 `file is tencentdoc, not smartcanvas` → 传统文档,走第二步 A
- 返回正常 JSON → smartcanvas 文档,走第二步 B
### 第二步 Atencentdoc 类型(大文档推荐)
### 第二步 Atencentdoc 类型
```bash
# 获取完整文档结构
@@ -39,7 +60,7 @@ with open('doc_content.txt','w',encoding='utf-8') as f:
print(f'Done: {len(texts)} paragraphs')
"
# 清理中间文件(可选)
# 清理中间文件
rm doc_raw.json
```
@@ -53,19 +74,16 @@ mcporter call tencent-docs smartcanvas.read file_id=<FILE_ID> size=50
mcporter call tencent-docs smartcanvas.read file_id=<FILE_ID> next_token=<TOKEN> size=50
```
## 搜索关键字获取资源链接
## 搜索关键字
```bash
# 在导出的文本中搜索
grep -n "关键词" doc_content.txt
```
链接格式参考
- `[普通链接: https://pan.quark.cn/s/xxx]` — 夸克分享链接
- `[腾讯文档链接: https://docs.qq.com/doc/...]` — 其他腾讯文档
链接格式:`[普通链接: https://pan.quark.cn/s/xxx]` → 用中间的 URL。
## 注意事项
- **超大文档**>10万字)不要用 `get_content`,必超时
- **Windows 编码**:带 emoji 的文档必须用 `python -X utf8`
- **链接格式**:提取出的链接在 `text_preview` 中带 `[普通链接: ...]` 包裹,直接用中间的真实 URL
- **超大文档(>10万字)禁止 `get_content`**,必超时
- 后端不稳定时重试一次,不行就告知用户,**不要 web search**
- Windows 编码:带 emoji 的文档用 `python -X utf8`