Skip to content

feat: add support for Seedream image generation - #3132

Closed
feitianbubu wants to merge 5361 commits into
QuantumNous:mainfrom
feitianbubu:pr/4a000179cfe946cd91a90c12ec2e378f5d820a99
Closed

feat: add support for Seedream image generation#3132
feitianbubu wants to merge 5361 commits into
QuantumNous:mainfrom
feitianbubu:pr/4a000179cfe946cd91a90c12ec2e378f5d820a99

Conversation

@feitianbubu

@feitianbubu feitianbubu commented Mar 5, 2026

Copy link
Copy Markdown
Member

支持火山豆包渠道测试 seedream生图模型
image

Summary by CodeRabbit

  • New Features

    • Added support for the seedream- image generation model.
  • Tests

    • Enhanced image generation test handling with improved validation for model-specific image size requirements.

Calcium-Ion and others added 30 commits February 5, 2026 01:56
…x-override

feat: 支持基于Go Regex规则和全量的请求体透传
…sponses-local-usage

fix: charge local input tokens when Gemini returns empty response
- Remove claude-instant-1.2, claude-2, claude-2.0, claude-2.1 from model lists
- Remove /v1/complete endpoint support (legacy completion API)
- Remove RequestModeCompletion and related code paths
- Simplify handler functions by removing requestMode parameter
- Update all channel adaptors that referenced claude handlers
…gacy-models

remove: drop support for claude-2 and claude-1 series models
- Introduce Provider interface pattern for standard OAuth protocols
- Create unified controller/oauth.go with common OAuth logic
- Add OAuthError type for translatable error messages
- Add i18n keys and translations (zh/en) for OAuth messages
- Use common.ApiErrorI18n/ApiSuccessI18n for consistent responses
- Preserve backward compatibility for existing routes and data


- Add support for custom OAuth providers, including creation, retrieval, updating, and deletion.
- Introduce new model and controller for managing custom OAuth providers.
- Enhance existing OAuth logic to accommodate custom providers.
- Update API routes for custom OAuth provider management.
- Include i18n support for custom OAuth-related messages.
…th user creation and binding

- Improve error handling in DeleteCustomOAuthProvider to log and return errors when fetching binding counts.
- Refactor user creation and OAuth binding logic to use transactions for atomic operations, ensuring data integrity.
- Add unique constraints to UserOAuthBinding model to prevent duplicate bindings.
- Enhance GitHub OAuth provider error logging for non-200 responses.
- Update AccountManagement component to provide clearer error messages on API failures.
…ers for optional fields

- Change fields in UpdateCustomOAuthProviderRequest struct to use pointers for optional values, allowing for better handling of nil cases.
- Update UpdateCustomOAuthProvider function to check for nil before assigning optional fields, ensuring existing values are preserved when not provided.
…al file types for LF normalization and binary detection
Mitigate XSS vulnerabilities in the playground where AI-generated content
is rendered without sanitization, allowing potential script injection via
prompt injection attacks.

MarkdownRenderer.jsx:
- Replace dangerouslySetInnerHTML with a sandboxed iframe for HTML preview
- Use sandbox="allow-same-origin" to block script execution while allowing
  CSS rendering and iframe height auto-sizing
- Add SandboxedHtmlPreview component with automatic height adjustment

CodeViewer.jsx:
- Add escapeHtml() utility to encode HTML entities before rendering
- Rewrite highlightJson() to process tokens iteratively, escaping each
  token and structural text before wrapping in syntax highlighting spans
- Escape non-JSON and very-large content paths that previously bypassed
  sanitization
- Update linkRegex to correctly match URLs containing & entities

These changes only affect the playground (AI output rendering). Admin-
configured content (home page, about page, footer, notices) remains
unaffected as they use separate code paths and are within the trusted
admin boundary.
Calcium-Ion and others added 25 commits March 2, 2026 21:19
…its-length

fix: change token model_limits column from varchar(1024) to text
Return error when model price/ratio unset
* feat: add upstream model update detection with scheduled sync and manual apply flows

* feat: support upstream model removal sync and selectable deletes in update modal

* feat: add detect-only upstream updates and show compact +/- model badges

* feat: improve upstream model update UX

* feat: improve upstream model update UX

* fix: respect model_mapping in upstream update detection

* feat: improve upstream update modal to prevent missed add/remove actions

* feat: add admin upstream model update notifications with digest and truncation

* fix: avoid repeated partial-submit confirmation in upstream update modal

* feat: improve ui/ux

* feat: suppress upstream update alerts for unchanged channel-count within 24h

* fix: submit upstream update choices even when no models are selected

* feat: improve upstream model update flow and split frontend updater

* fix merge conflict
…ream-model-tips

Fix/auto fetch upstream model tips
…1216dd9f2155c19f0556e4655bc

fix: update task billing log content to include reason
…ide-wildcard-path

Feature/param override wildcard path
…7aec3eb60f27ca33dbb4dc9610a

fix: fetch model add header passthrough rule key check
feats: repair the thinking of claude to openrouter convert
@coderabbitai

coderabbitai Bot commented Mar 5, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

The pull request adds support for the "seedream-" image generation model by registering the prefix in the recognized models list and updating the test channel controller to properly classify and handle these models with specific image dimension requirements.

Changes

Cohort / File(s) Summary
Model Registration
common/model.go
Added "seedream-" prefix to the ImageGenerationModels slice to register it as a recognized image generation model.
Test Endpoint Handling
controller/channel-test.go
Updated normalizeChannelTestEndpoint to classify seedream models as EndpointTypeImageGeneration; enforces 2048x2048 image dimensions for seedream models in the image generation test path before request conversion.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested reviewers

  • Calcium-Ion
  • seefs001

Poem

🐰 A seedream model hops into view,
With dimensions of 2048 too,
Image generation now takes flight,
Our little rabbits test with delight! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding support for Seedream image generation model, which aligns with the file changes adding 'seedream-' to ImageGenerationModels and test handling.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
controller/channel-test.go (1)

303-305: Case sensitivity mismatch with model detection logic.

strings.Contains(testModel, "seedream-") is case-sensitive, but IsImageGenerationModel() in common/model.go normalizes to lowercase before matching. If testModel (which is the upstream model name from line 247) has different casing, this check could fail while the model is still classified as image generation.

♻️ Suggested fix for consistent case handling
 		if imageReq, ok := request.(*dto.ImageRequest); ok {
-			if strings.Contains(testModel, "seedream-") {
+			if strings.Contains(strings.ToLower(testModel), "seedream-") {
 				imageReq.Size = "2048x2048" // VolcEngine Seedream-4.5 和 5.0 模型需要至少 2048x2048 的图片尺寸 见:https://www.volcengine.com/docs/82379/1824121
 			}
 			convertedRequest, err = adaptor.ConvertImageRequest(c, info, *imageReq)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@controller/channel-test.go` around lines 303 - 305, The check for seedream
model casing is inconsistent: normalize testModel to lowercase (same as
IsImageGenerationModel() in common/model.go) before testing; replace the
case-sensitive strings.Contains(testModel, "seedream-") with a lowercase-aware
check (e.g., set a local var like modelLower := strings.ToLower(testModel) and
use strings.Contains(modelLower, "seedream-")) and then set imageReq.Size =
"2048x2048" when matched so model detection and sizing logic are consistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@controller/channel-test.go`:
- Around line 303-305: The check for seedream model casing is inconsistent:
normalize testModel to lowercase (same as IsImageGenerationModel() in
common/model.go) before testing; replace the case-sensitive
strings.Contains(testModel, "seedream-") with a lowercase-aware check (e.g., set
a local var like modelLower := strings.ToLower(testModel) and use
strings.Contains(modelLower, "seedream-")) and then set imageReq.Size =
"2048x2048" when matched so model detection and sizing logic are consistent.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e708ff09-f177-4c67-adca-9a3d85e26a9d

📥 Commits

Reviewing files that changed from the base of the PR and between f0e938a and fcb99d5.

📒 Files selected for processing (2)
  • common/model.go
  • controller/channel-test.go

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.