add feature to download image or video file created locally
Pull Request Description
Create an image or video
- kubectl -n envoy-gateway-system port-forward service/envoy-aibrix-system-aibrix-eg-903790dc 8888:80
- curl -v "http://localhost:8888/v1/video/generations" \
-H "Content-Type: application/json" \
-d '{
"prompt": "a cute rabbit",
"model": "hunyuan-dit",
"save_disk_path": "/shared/2026"
}'
* Host localhost:8888 was resolved.
* IPv6: ::1
* IPv4: 127.0.0.1
* Trying [::1]:8888...
* Connected to localhost (::1) port 8888
> POST /v1/video/generations HTTP/1.1
> Host: localhost:8888
> User-Agent: curl/8.9.1
> Accept: */*
> Content-Type: application/json
> Content-Length: 101
>
* upload completely sent off: 101 bytes
< HTTP/1.1 200 OK
< date: Thu, 25 Sep 2025 20:01:14 GMT
< server: uvicorn
< content-type: application/json
< x-went-into-req-headers: true
< request-id: eb618df8-9260-46e8-870a-9b81e6032412
< target-pod: **10.0.1.147**:6000
< transfer-encoding: chunked
<
* Connection #0 to host localhost left intact
{"message":"Video generated successfully","elapsed_time":"111.93 sec","output":"/shared/2026/generated_video_20250925-200306.mp4","save_to_disk":true}
- ip is from the target-pod return in the response. port is aibrix-runtime running as a side car container.
- curl -X POST http://localhost:8888/view \
-H "Content-Type: application/json" \
--data '{
"ip": "10.0.1.147",
"port": "8080",
"path": "//shared/2026/generated_video_20250925-200306.mp4"
}' \
-o generated_video_20250925-200306.mp4
Related Issues
Resolves: #[Insert issue number(s)]
Important: Before submitting, please complete the description above and review the checklist below.
Contribution Guidelines (Expand for Details)
We appreciate your contribution to aibrix! To ensure a smooth review process and maintain high code quality, please adhere to the following guidelines:
Pull Request Title Format
Your PR title should start with one of these prefixes to indicate the nature of the change:
[Bug]: Corrections to existing functionality[CI]: Changes to build process or CI pipeline[Docs]: Updates or additions to documentation[API]: Modifications to aibrix's API or interface[CLI]: Changes or additions to the Command Line Interface[Misc]: For changes not covered above (use sparingly)
Note: For changes spanning multiple categories, use multiple prefixes in order of importance.
Submission Checklist
- [ ] PR title includes appropriate prefix(es)
- [ ] Changes are clearly explained in the PR description
- [ ] New and existing tests pass successfully
- [ ] Code adheres to project style and best practices
- [ ] Documentation updated to reflect changes (if applicable)
- [ ] Thorough testing completed, no regressions introduced
By submitting this PR, you confirm that you've read these guidelines and your changes align with the project's contribution standards.
Summary of Changes
Hello @varungup90, I'm Gemini Code Assist[^1]! 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 enhances the system by enabling the download of locally created media files. It establishes a new /view endpoint in both the Go backend and the Python FastAPI application. The Go endpoint acts as a proxy, allowing clients to request files from internal services, while the FastAPI endpoint directly serves files from the local filesystem with proper content handling. Additionally, the gateway logic has been updated to intelligently route image generation requests based on the presence of a save_disk_path parameter, and necessary Python dependencies have been added.
Highlights
- File Download Feature: Introduced a new capability to download locally generated image or video files through dedicated endpoints.
- Go Backend Endpoint: Added a
/viewPOST endpoint in the Go service (pkg/metadata/handlers.go) to proxy file download requests from specified IP, port, and path. - Python Frontend Endpoint: Implemented a
/view/{file_path:path}GET endpoint in the Python FastAPI application (python/aibrix/aibrix/app.py) to serve local files securely, handling content types and disposition. - Image Generation Routing Logic: Modified the gateway's request body validation to detect and apply random routing for image generation requests that include a
save_disk_path. - Dependency Update: Integrated
aiofilesinto the Python project dependencies to support asynchronous file operations.
Using Gemini Code Assist
The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in pull request comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.
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 :thumbsup: and :thumbsdown: 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.
[^1]: Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.
@varungup90 @zhangjyr
- Technically, this is good for debugging but has too many limitations. I suggest we hold this one at this moment and see other ways. I think ask user to decode to image/video is still acceptable or we support object storage later.
- If we plan to use it, is it possible to move such logics to new created metadata service? let gateway just play the role of forwarding.