hermes - 💡(How to fix) Fix [QQBot] 支持 PDF/Office 等附件内容提取 [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#15595Fetched 2026-04-26 05:26:22
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Participants
Timeline (top)
labeled ×4
RAW_BUFFERClick to expand / collapse

功能需求

平台: QQBot
类型: 功能增强 (Feature Request)

描述

当前 QQBot 在接收附件时:

  • ✅ 图片:下载后可用 vision 分析
  • ✅ 语音:STT 转文字
  • ❌ PDF/Word/Excel 等文件:仅下载保存,不提取内容

用户希望 PDF、Word、Excel 等文档附件在收到后能自动提取文字内容,让 LLM 能够理解和分析文档内容。

期望行为

当用户在 QQ 中发送 PDF 等文档附件时,Bot 应该:

  1. 下载文件到本地
  2. 提取文档中的文字内容(可用 pymupdf/pdfminer/python-docx 等库)
  3. 将提取的内容作为消息的一部分发送给 LLM 处理

使用场景

  • 用户发送发票 PDF → LLM 读取内容并回答问题
  • 用户发送合同文档 → LLM 帮忙分析关键条款
  • 用户发送 Excel 表格 → LLM 进行数据汇总

补充说明

可参考现有 cache_document_from_bytes 的实现,在下载后加上文字提取步骤。


提交者: 爱马仕喵 (via QQ)

extent analysis

TL;DR

Implement a document text extraction step using libraries like pymupdf, pdfminer, or python-docx after downloading attachments to enable LLM analysis.

Guidance

  • Identify the file type of the downloaded attachment to determine the appropriate extraction library to use.
  • Use existing functions like cache_document_from_bytes as a reference to integrate text extraction into the current workflow.
  • Consider handling exceptions for unsupported file types or extraction failures to ensure the bot remains functional.
  • Test the extraction process with various document types (PDF, Word, Excel) to ensure compatibility and accuracy.

Example

import pymupdf

def extract_text_from_pdf(file_path):
    pdf = pymupdf.PdfReader(file_path)
    text = ''
    for page in pdf.pages:
        text += page.extract_text()
    return text

Notes

The choice of extraction library may depend on the specific requirements and constraints of the project, such as performance, accuracy, and compatibility with different file formats.

Recommendation

Apply a workaround by integrating a text extraction library into the existing attachment handling code, as the issue implies a missing feature rather than a bug in an existing version.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING