5 Commits
Author SHA1 Message Date
thotam a5a853f461 feat(tools): image reference processing and native provider support (#1251)
* feat(tools): implement image reference processing and native provider support

- Support OpenAI image edits via both Multipart form-data and JSON payloads
- Automatically append reference image descriptions to prompt under [Reference Image Roles]
- Support downloading image URLs for Gemini native image generation
- Deduplicate reference images to optimize API request size
- Add unit tests for Codex, DashScope, MiniMax, BytePlus and local/remote path resolution

* fix(tools): SSRF-guard reference-image URL downloads in create_image

downloadImageBytes fetched caller-supplied ref_images[].url with a plain
http.Client and unbounded io.ReadAll — no SSRF validation, redirect
policy, or size cap, letting the gateway dial loopback/private/metadata
hosts or read arbitrarily large responses.

- Validate the URL via security.Validate and pin the resolved IP, then
  download through security.NewSafeClient (pinned dial, no redirects).
- Cap the response with a bounded read (refImageMaxBytes, 20 MB).
- Reject non-HTTP(S) reference URLs up front (file://, data:, gopher://)
  so provider-forwarded URLs stay HTTP(S)-only; document the trust
  boundary between gateway-side fetch and provider-forwarded URLs.
- Add regression tests: blocked loopback/private/metadata, unfollowed
  redirect, oversized response, and non-http(s) scheme rejection.
2026-06-21 18:27:51 +07:00
viettranx 14c375e33b fix(media): update native provider API defaults and UI schema
- OpenAI image default: dall-e-3 → gpt-image-1.5 (dall-e-3 deprecated May 12)
- DashScope: add missing 4:3 and 3:4 aspect ratio mappings
- UI: remove stale MiniMax size/prompt_optimizer params (backend uses aspect_ratio since #630)
2026-04-02 09:53:01 +07:00
viettranx bdb60de7ae chore: upgrade Go 1.25 → 1.26 and apply go fix modernizations
- Update go.mod and Dockerfile to Go 1.26
- Apply `go fix ./...` stdlib modernizations across 170+ files
- Add `go fix` to post-implementation checklist in CLAUDE.md
- Fix go fix misapplied rewrite in loop_history.go
2026-03-10 00:09:15 +07:00
viettranx 9d0af657e5 fix(tools): correct media provider params and UI fixes
- MiniMax audio: fix invalid params (sample_rate/bitrate as int, auto
  instrumental when no lyrics, pass duration_seconds)
- MiniMax/DashScope image: map aspect_ratio to provider size format
- Gemini video: read person_generation from chain params instead of hardcode
- GetParamInt: add string-to-int coercion for UI select values
- UI: fix combobox portal selection bug, dropdown overflow clipping,
  provider chain form spacing, skill dialog min-height
- Update bitrate options to numeric bps values in params schema
2026-03-08 22:32:08 +07:00
viettranx 5815437f78 feat(tools): add media provider chain with ordered fallback and retry
Refactor create_image and create_video to use a shared provider chain system.
Each tool now supports an ordered list of providers with per-entry timeout,
max retries, and provider-specific params. Includes MiniMax and DashScope
image/video generation implementations.

- New media_provider_chain.go: shared chain resolution, retry execution, limitedReadAll
- create_image: refactored to ExecuteWithChain, added MiniMax + DashScope providers
- create_video: refactored to ExecuteWithChain, added MiniMax async video generation
- Backward compatible with legacy {provider, model} settings format
2026-03-08 20:09:43 +07:00