Skip to content

Fix Feishu PDF upload handling for custom agents#498

Open
yaojin3616 wants to merge 1 commit intomainfrom
fix/feishu-pdf-upload-processing
Open

Fix Feishu PDF upload handling for custom agents#498
yaojin3616 wants to merge 1 commit intomainfrom
fix/feishu-pdf-upload-processing

Conversation

@yaojin3616
Copy link
Copy Markdown
Collaborator

Summary

  • route non-image Feishu uploads into an actual LLM processing flow instead of only saving the file and replying with a generic ack
  • auto-extract supported office files like PDF into a companion markdown file so the agent can read text immediately
  • add regression tests for Feishu PDF upload handling and the synthetic prompt builder

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 -q
  • python3 -m compileall backend/app/api/feishu.py backend/tests/test_feishu_file_uploads.py

Closes #175
Closes #176

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread backend/app/api/feishu.py
f"请先调用 `read_file(path=\"{extracted_rel_path}\")` 阅读提取文本;如需核对原始版式、表格或分页,再调用 `read_document(path=\"{workspace_rel_path}\")`。",
])
else:
lines.append(f"请直接调用 `read_document(path=\"{workspace_rel_path}\")` 读取文件内容。")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant