feat(channels): add local media file sending support for QQ channel#1521
feat(channels): add local media file sending support for QQ channel#1521howyoungchen wants to merge 3 commits intoagentscope-ai:mainfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the QQ channel's ability to handle rich media by allowing agents to send local files and a wider array of media types. Previously limited to remote image URLs, the channel can now process and transmit local images, videos, audio, and general files, improving the expressiveness and utility of agent communications within QQ C2C and group chats. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request is a significant feature enhancement, adding local media file sending support for the QQ channel. The implementation correctly handles various media types, infers them from file extensions, and supports both remote URLs and local file paths, with corresponding documentation updates. My review includes a high-severity security recommendation to prevent potential arbitrary file reads by sandboxing local file access, and a medium-severity suggestion to refactor the media type inference logic for better maintainability. Overall, this is a well-executed pull request.
Description
Add local media file sending support for QQ channel. Previously, the QQ channel could only send remote HTTP image URLs; video, audio, and file types were unsupported, and local file paths were not accepted at all.
This PR extends the QQ rich media pipeline to:
file://or absolute path) and remote HTTP URLs for all media typesfile_type(1–4) from file extension; unsupported image formats (svg, gif, etc.) fall back to file typebase.pyaudio content part to include the data path in the[Audio: ...]tag so downstream channels can pick it upRelated Issue: Fixes #981
Security Considerations: Local file reads are limited to paths explicitly provided by the agent reply content. No path traversal beyond what the agent constructs.
Type of Change
Component(s) Affected
Checklist
pre-commit run --all-fileslocally and it passespytestor as relevant) and they passTesting
Test matrix:
file:///path/to/img.png/path/to/audio.mp3/path/to/video.mp4/path/to/doc.pdfLocal Verification Evidence
Additional Notes
Rich media sending is only available in C2C and group chat; guild messages are not supported by the QQ Rich Media API. Receiving video / audio / file attachments from users is not yet verified (🚧).