mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-07-19 21:07:28 +08:00
fix(desktop): bundle document parsing libs
This commit is contained in:
@@ -16,7 +16,7 @@ class Read(BaseTool):
|
|||||||
"""Tool for reading file contents"""
|
"""Tool for reading file contents"""
|
||||||
|
|
||||||
name: str = "read"
|
name: str = "read"
|
||||||
description: str = f"Read or inspect file contents. For text/PDF files, returns content (truncated to {DEFAULT_MAX_LINES} lines or {DEFAULT_MAX_BYTES // 1024}KB). For images/videos/audio, returns metadata only (file info, size, type). Use offset/limit for large text files."
|
description: str = f"Read or inspect file contents. For text/PDF/Word/Excel/PPT files, returns content (truncated to {DEFAULT_MAX_LINES} lines or {DEFAULT_MAX_BYTES // 1024}KB). For images/videos/audio, returns metadata only (file info, size, type). Use offset/limit for large text files."
|
||||||
|
|
||||||
params: dict = {
|
params: dict = {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
|||||||
@@ -73,6 +73,21 @@ hiddenimports += [
|
|||||||
'tiktoken_ext.openai_public',
|
'tiktoken_ext.openai_public',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Document parsing libs. The read / web_fetch tools import these lazily inside
|
||||||
|
# functions (e.g. `from pypdf import PdfReader`), so PyInstaller's static
|
||||||
|
# analysis misses them and they'd be dropped from the bundle — leaving the
|
||||||
|
# desktop client unable to read PDF/Word/Excel/PPT. List them explicitly.
|
||||||
|
hiddenimports += [
|
||||||
|
'pypdf',
|
||||||
|
'docx', # python-docx
|
||||||
|
'pptx', # python-pptx
|
||||||
|
'openpyxl',
|
||||||
|
]
|
||||||
|
hiddenimports += collect_submodules('pypdf')
|
||||||
|
hiddenimports += collect_submodules('docx')
|
||||||
|
hiddenimports += collect_submodules('pptx')
|
||||||
|
hiddenimports += collect_submodules('openpyxl')
|
||||||
|
|
||||||
# --- Data files -----------------------------------------------------------
|
# --- Data files -----------------------------------------------------------
|
||||||
# Runtime-read files/dirs that must travel with the executable. Paths are
|
# Runtime-read files/dirs that must travel with the executable. Paths are
|
||||||
# (source, dest_dir_in_bundle).
|
# (source, dest_dir_in_bundle).
|
||||||
@@ -92,6 +107,12 @@ datas = [
|
|||||||
# Some libraries (tiktoken encodings, etc.) ship data files.
|
# Some libraries (tiktoken encodings, etc.) ship data files.
|
||||||
datas += collect_data_files('tiktoken_ext', include_py_files=False)
|
datas += collect_data_files('tiktoken_ext', include_py_files=False)
|
||||||
|
|
||||||
|
# python-docx / python-pptx bundle template files (default.docx / default.pptx,
|
||||||
|
# content-type XML) inside their packages; they're loaded at import/parse time,
|
||||||
|
# so ship them or document parsing fails in the frozen build.
|
||||||
|
datas += collect_data_files('docx')
|
||||||
|
datas += collect_data_files('pptx')
|
||||||
|
|
||||||
# --- Excludes -------------------------------------------------------------
|
# --- Excludes -------------------------------------------------------------
|
||||||
# Keep the bundle lean: drop Feishu's heavy SDK, plugins (disabled in desktop
|
# Keep the bundle lean: drop Feishu's heavy SDK, plugins (disabled in desktop
|
||||||
# mode), tests/docs, and dev-only packages.
|
# mode), tests/docs, and dev-only packages.
|
||||||
|
|||||||
Reference in New Issue
Block a user