Skip to content

fix(openai): return 400 for inline file limit#373

Merged
CJackHwang merged 1 commit intoCJackHwang:devfrom
NgoQuocViet2001:ai/ds2api-small-regression-fix
Apr 29, 2026
Merged

fix(openai): return 400 for inline file limit#373
CJackHwang merged 1 commit intoCJackHwang:devfrom
NgoQuocViet2001:ai/ds2api-small-regression-fix

Conversation

@NgoQuocViet2001
Copy link
Copy Markdown
Contributor

💻 变更类型 | Change Type

  • ✨ feat
  • 🐛 fix
  • ♻️ refactor
  • 💄 style
  • 👷 build
  • ⚡️ perf
  • 📝 docs
  • 🔨 chore

🔀 变更说明 | Description of Change

When an OpenAI-compatible request includes more than the supported number of inline files, the preprocessing path already treats it as a request-level validation failure. However, that specific limit error was returned as a plain error, so the public API surfaced it through the generic inline-file failure path as a 500.

This change wraps the inline file limit failure as an inlineFileUploadError with 400 Bad Request, matching the existing behavior for invalid inline file payloads such as malformed data URLs.

Added a regression test that sends 51 inline image blocks and verifies:

  • the response is 400 Bad Request
  • the limit message is returned to the caller
  • completion is not called after the validation failure

📝 补充信息 | Additional Information

Validation run in a clean LF checkout with Go 1.26.0 and golangci-lint v2.11.4:

  • ./scripts/lint.sh
  • ./tests/scripts/check-refactor-line-gate.sh
  • ./tests/scripts/run-unit-all.sh
  • npm ci --prefix webui
  • npm run build --prefix webui

Focused regression check:

  • go test ./internal/httpapi/openai -run InlineUpload

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 29, 2026

@NgoQuocViet2001 is attempting to deploy a commit to the cjack's projects Team on Vercel.

A member of the Team first needs to authorize it.

@CJackHwang CJackHwang merged commit 483d7af into CJackHwang:dev Apr 29, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants