跳到正文
Skillpedia
PDF、Word 与幻灯片37k · #7513

doc-reader

它能做什么

这项技能为智能体提供一个工具,从许多常见文件类型中提取可读的文字。适合任何需要 AI 阅读报告、合同、电子表格或扫描页面的人。

适用场景

  • ✓当你需要 AI 阅读 PDF、Word 文档、Excel 表格或 PowerPoint 文件的时候。
  • ✓当扫描页面或图片需要转换为文字的时候。
  • ✓当你想从 CSV、JSON 或代码文件中获取文字,而不想手动打开它的时候。

技能链接

https://github.com/HKUDS/Vibe-Trading/blob/main/agent/src/skills/doc-reader/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/HKUDS/Vibe-Trading/blob/main/agent/src/skills/doc-reader/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请读取这份年度报告 PDF 的第 1 至 10 页,并总结其要点。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会调用一个文档阅读器,它会根据文件类型选择合适的方法。扫描页面会经过文字识别,电子表格则以预览形式显示。出于安全考虑,压缩包和程序文件会被禁止读取。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Universal Document Reader

Purpose

Return extracted text from any supported file in a single unified JSON envelope. The tool dispatches by file extension — you always call the same tool regardless of format.

Supported formats

Category Extensions Notes
PDF .pdf Text pages extracted in ms; scanned/image pages fall back to OCR
Word .docx Paragraphs + table cells
Excel .xlsx, .xls All sheets, first 100 rows per sheet as preview
PowerPoint .pptx Slide text content
Images .png/.jpg/.jpeg/.gif/.bmp/.webp/.tiff OCR only
CSV / TSV .csv, .tsv Raw text with encoding fallback
Plain text .txt/.md/.log/.rst Encoding fallback
Config .json/.yaml/.yml/.toml/.ini/.cfg/.env Raw text
Markup .html/.htm/.xml Raw text (no HTML stripping)
Source code .py/.js/.ts/.tsx/.go/.rs/.java/.cpp/.c/.sql/.sh/... Raw text
Unknown extension anything else Best-effort read as UTF-8/GBK text

Blocked (rejected at /upload): executables (.exe/.dll/.so/...) and archives (.zip/.tar/...). Ask the user to unpack archives locally first.

Usage

Always call the tool directly — do not run Python from bash.

read_document(file_path="uploads/paper.pdf")
read_document(file_path="uploads/annual_report.pdf", pages="1-10")
read_document(file_path="uploads/contract.docx")
read_document(file_path="uploads/sales.xlsx")
read_document(file_path="uploads/deck.pptx")
read_document(file_path="uploads/chart.png")     # image → OCR
read_document(file_path="uploads/config.yaml")
read_document(file_path="uploads/notes.md")

The pages parameter only applies to PDF; other formats ignore it.

Return envelope

All formats share this shape:

{
  "status": "ok",
  "file": "paper.pdf",
  "format": "pdf",
  "char_count": 52000,
  "truncated": true,
  "text": "..."
}

Format-specific extra fields:

Format Extra keys
pdf total_pages, pages_read, ocr_pages, ocr_engine, ocr_quality, skipped_pages
docx paragraphs, tables
excel sheets (array of {name, rows, cols})
pptx slides
text encoding, size

Content longer than 15000 chars is truncated; for PDFs use the pages parameter to read slices.

Workflows

Paper / report summary

1. read_document(file_path="paper.pdf")  → full text
2. Extract abstract, methodology, conclusion → summarize

Contract review

1. read_document(file_path="contract.docx")  → paragraphs + tables
2. Flag key clauses (termination, liability, payment, IP)

Spreadsheet quick-look

1. read_document(file_path="sales.xlsx")  → all sheet previews
2. If user wants trade journal analysis specifically, pivot to
   `analyze_trade_journal` tool instead (see trade-journal skill).

Chart / screenshot / scanned PDF

1. read_document(file_path="scan.png")  → OCR text
2. If OCR returns empty, tell the user; don't fabricate.

OCR Configuration

The read_document tool automatically uses OCR for PDF pages with insufficient extractable text.

OCR Threshold

Use min_text_per_page to control when OCR is triggered (default: 50 characters):

read_document("scanned_report.pdf", min_text_per_page=10)  # More aggressive OCR
read_document("mixed_pdf.pdf", min_text_per_page=100)       # Less aggressive OCR

OCR Engine Configuration

Two OCR engines are built in — no extra packages needed beyond the engine SDK:

Engine Type Requires Install
rapid Local (offline) rapidocr_onnxruntime pip install rapidocr_onnxruntime
llm-vision Cloud A vision-capable LLM model + API key No extra install — uses your existing LLM provider config

The llm-vision engine works with any OpenAI-compatible vision model (GPT-4o, Qwen-VL, Gemini, Claude, GLM-4V, etc.). It reuses your existing LANGCHAIN_PROVIDER / LANGCHAIN_MODEL_NAME / API key configuration — no separate provider mapping needed. If you explicitly set VIBE_TRADING_OCR_ENGINE=llm-vision, your model choice is trusted; a real API error from the provider is clearer feedback than a heuristic guess.

To override the model used for OCR (without changing your agent's main model):

VIBE_TRADING_OCR_LLM_MODEL=qwen3.7-plus

Set VIBE_TRADING_OCR_ENGINE to select the engine:

  • auto (default): use local engines only, never cloud (privacy: docum
常见问题

它能读取哪些文件类型?

PDF、Word、Excel、PowerPoint、常见图片格式、CSV、纯文本、配置文件、网页标记以及许多源代码文件。

它为什么不能打开 zip 文件?

压缩包和可执行文件被禁止读取,因此你需要先在自己的电脑上解压压缩包。

它能读取扫描页面吗?

能。扫描页或仅含图像的页面会通过文字识别来读取。

详情

作者的原始描述

Read any common document/data file — PDF, Word (.docx), Excel (.xlsx/.xls), PowerPoint (.pptx), images (OCR), CSV/TSV, plain text, JSON/YAML/TOML, HTML/XML, and most source-code files. Use the `read_document` tool.

repo: HKUDS/Vibe-Trading

热度

GitHub 星标
37k
排名
#7513
许可证
MIT
更新时间
2026/11/1

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能