Skip to content

fix: volcengine claude DoResponse - #2295

Merged
Calcium-Ion merged 1 commit into
QuantumNous:mainfrom
seefs001:fix/adapter-missing
Nov 25, 2025
Merged

fix: volcengine claude DoResponse#2295
Calcium-Ion merged 1 commit into
QuantumNous:mainfrom
seefs001:fix/adapter-missing

Conversation

@seefs001

@seefs001 seefs001 commented Nov 25, 2025

Copy link
Copy Markdown
Collaborator

fix #2288

Summary by CodeRabbit

  • Refactor
    • Optimized Claude response handling in the relay channel to route requests through dedicated handlers earlier in the processing pipeline, improving response handling efficiency without affecting public API interfaces.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai

coderabbitai Bot commented Nov 25, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

Adds an early Claude-format detection branch in DoResponse for the Volcengine channel adaptor. When RelayFormat is Claude, the handler routes to Claude-specific handlers (ClaudeStreamHandler for streaming or ClaudeHandler otherwise) before subsequent response processing, bypassing the prior unified flow.

Changes

Cohort / File(s) Summary
Claude format routing
relay/channel/volcengine/adaptor.go
Adds conditional branch in DoResponse to detect Claude format and dispatch to dedicated Claude handlers early, prior to standard RelayMode-based handling

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant DoResponse
    participant ClaudeHandler as Claude<br/>Handlers
    participant OtherHandler as Other<br/>Handlers

    Client->>DoResponse: Response with RelayFormat
    alt RelayFormat == Claude
        DoResponse->>ClaudeHandler: Route to ClaudeStreamHandler<br/>(streaming) or ClaudeHandler
        ClaudeHandler-->>Client: Process Claude response
    else Other formats
        DoResponse->>OtherHandler: Process via standard flow
        OtherHandler-->>Client: Process response
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Focus on the conditional logic placement and ensure Claude-format requests are correctly intercepted before other handlers
  • Verify that early return prevents unintended side effects in the standard response flow

Possibly related PRs

  • PR #1833: Implements identical Claude-format early-branch routing in different channel adaptor, suggesting a consistent pattern being applied across multiple channel types

Suggested reviewers

  • Calcium-Ion

Poem

🐰 Hop, skip, and Claude—a path made clear,
Early routing brings the handlers near,
In Volcengine's streams, a branch takes flight,
Claude's own way shines bright!

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: volcengine claude DoResponse' directly references the main change: adding Claude-format handling logic to the DoResponse function in the volcengine adaptor, which aligns with the summary of changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 393c2b6 and 5060904.

📒 Files selected for processing (1)
  • relay/channel/volcengine/adaptor.go (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
relay/channel/volcengine/adaptor.go (3)
types/relay_format.go (2)
  • RelayFormat (3-3)
  • RelayFormatClaude (7-7)
relay/channel/claude/relay-claude.go (2)
  • ClaudeStreamHandler (703-725)
  • ClaudeHandler (771-793)
relay/channel/claude/adaptor.go (1)
  • RequestModeMessage (21-21)
🔇 Additional comments (1)
relay/channel/volcengine/adaptor.go (1)

344-349: LGTM! This fix properly routes Claude format responses to Claude-specific handlers.

The early return correctly prevents Claude requests from falling through to the OpenAI adaptor (line 387). The placement before audio handling (line 351) is appropriate since RelayFormat is a higher-level distinction than RelayMode. The use of claude.RequestModeMessage is consistent with all other channel adaptors that proxy Claude (zhipu_4v, moonshot, vertex, deepseek, ali, aws), confirming this is the correct mode for Volcengine Claude requests.


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.

@Calcium-Ion
Calcium-Ion merged commit 4866b3d into QuantumNous:main Nov 25, 2025
1 check passed
@coderabbitai coderabbitai Bot mentioned this pull request Dec 7, 2025
ennnnny pushed a commit to ennnnny/new-api that referenced this pull request Mar 17, 2026
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.

火山coding plan下doubao-seed-coding模型无法接入使用claude code

2 participants