Fix Feishu PDF upload handling for custom agents#498
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4ceb9c0234
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| f"请先调用 `read_file(path=\"{extracted_rel_path}\")` 阅读提取文本;如需核对原始版式、表格或分页,再调用 `read_document(path=\"{workspace_rel_path}\")`。", | ||
| ]) | ||
| else: | ||
| lines.append(f"请直接调用 `read_document(path=\"{workspace_rel_path}\")` 读取文件内容。") |
There was a problem hiding this comment.
Use read_file for non-document uploads
The fallback branch always instructs the model to call read_document for any non-extracted file, but read_document only supports a limited set of extensions (PDF/DOCX/XLSX/PPTX/TXT/MD/JSON/CSV/LOG). For common uploads like .py, .yaml, .xml, .js, etc., this new auto-processing path will immediately hit “Unsupported file format”, so the file flow regresses into a failed first tool call instead of reliably reading content. Please branch the prompt by extension (or direct unknown/text-like files to read_file).
Useful? React with 👍 / 👎.
Summary
Root cause
Feishu file uploads were saved to
workspace/uploads/, but non-image files stopped there. The agent never entered a document-processing path, so PDF uploads were not actually handled after arrival.Validation
PYTHONPATH=backend pytest backend/tests/test_feishu_service_api.py backend/tests/test_feishu_file_uploads.py -qpython3 -m compileall backend/app/api/feishu.py backend/tests/test_feishu_file_uploads.pyCloses #175
Closes #176