Skip to content

Codex/qq local file upload#1726

Open
xiang33 wants to merge 3 commits intosipeed:mainfrom
xiang33:codex/qq-local-file-upload
Open

Codex/qq local file upload#1726
xiang33 wants to merge 3 commits intosipeed:mainfrom
xiang33:codex/qq-local-file-upload

Conversation

@xiang33
Copy link

@xiang33 xiang33 commented Mar 18, 2026

📝 Description

This PR improves QQ channel support for local file attachments.

Previously, the QQ channel could only send media when the attachment reference was already an http/https URL. Locally generated files such as PDF, HTML, and other attachments could not be sent correctly through QQ. In addition, even after adding local upload support, uploaded files could appear as unnamed attachments because the filename was not forwarded to the QQ upload request.

This PR updates the QQ channel to:

  • upload local attachments before sending QQ rich media messages
  • return explicit errors when upload or send fails, instead of silently pretending success
  • preserve attachment filenames during local upload, so files such as conversation.pdf are displayed with the expected name on the receiving side

🗣️ Type of Change

  • 🐞 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 📖 Documentation update
  • ⚡ Code refactoring (no functional changes, no api changes)

🤖 AI Code Generation

  • 🤖 Fully AI-generated (100% AI, 0% Human)
  • 🛠️ Mostly AI-generated (AI draft, Human verified/modified)
  • 👨‍💻 Mostly Human-written (Human lead, AI assisted or none)

🔗 Related Issue

N/A

📚 Technical Context (Skip for Docs)

  • Reference URL: QQ Bot rich media / file upload API behavior

  • Reasoning:
    The previous QQ implementation only supported direct rich media sending when the attachment reference was already a remote URL. Local files resolved from the media store could not be delivered correctly.

    This PR updates the QQ channel to:

    1. resolve local media references from the media store
    2. upload the local file to QQ first
    3. send the uploaded file as a QQ rich media message
    4. return explicit errors when upload or send fails
    5. preserve the original attachment filename in the QQ upload payload

    This keeps the existing direct-send behavior for remote http/https URLs, while adding support for locally generated files such as PDF and other attachments.

🧪 Test Environment

  • Hardware: PC (Apple Silicon)
  • OS: macOS
  • Model/Provider: N/A
  • Channels: QQ

📸 Evidence (Optional)

Click to view Logs/Screenshots
go test ./pkg/channels/qq -v -count=1

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@yinwm
Copy link
Collaborator

yinwm commented Mar 18, 2026

@xiang33 plz sign CLA

@xiang33
Copy link
Author

xiang33 commented Mar 19, 2026

@xiang33 plz sign CLA

image done

@xiang33
Copy link
Author

xiang33 commented Mar 19, 2026

fixed lint error, plz rerun the ci

@yinwm
Copy link
Collaborator

yinwm commented Mar 19, 2026

@xiang33 still should sign CLA, you'd better check your email which sign CLA should in you github email list

@yinwm yinwm mentioned this pull request Mar 19, 2026
10 tasks
@yinwm
Copy link
Collaborator

yinwm commented Mar 19, 2026

🔔 PR #1722 has been merged

QQ local file upload support has been implemented in #1722 which was just merged to main.

What's already covered:

  • Local file → base64 upload via /files API
  • max_base64_file_size_mib config option
  • Inbound attachment download and storage
  • Two-step upload flow (upload → send with file_info)
  • Comprehensive test coverage

Potential follow-ups:

If you'd like to contribute additional features, can rebase onto latest main and focus on:

Would you like to close this PR or rebase and contribute the file name preservation feature?

@sipeed-bot sipeed-bot bot added type: bug Something isn't working domain: channel labels Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: channel type: bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants