Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions relay/channel/deepseek/adaptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,17 @@ func (a *Adaptor) DoRequest(c *gin.Context, info *relaycommon.RelayInfo, request
}

func (a *Adaptor) DoResponse(c *gin.Context, resp *http.Response, info *relaycommon.RelayInfo) (usage any, err *types.NewAPIError) {
if info.IsStream {
usage, err = openai.OaiStreamHandler(c, info, resp)
} else {
usage, err = openai.OpenaiHandler(c, info, resp)
switch info.RelayFormat {
case types.RelayFormatClaude:
if info.IsStream {
return claude.ClaudeStreamHandler(c, resp, info, claude.RequestModeMessage)
} else {
return claude.ClaudeHandler(c, resp, info, claude.RequestModeMessage)
}
default:
adaptor := openai.Adaptor{}
return adaptor.DoResponse(c, resp, info)
Comment on lines +103 to +104

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.

⚠️ Potential issue

🧩 Analysis chain

Confirm OpenAI adaptor doesn’t need fields initialized.

openai.Adaptor has ChannelType/ResponseFormat fields. If DoResponse uses them, passing a zero-value struct may alter formatting/routing. Initialize if required.

Run:


🏁 Script executed:

#!/bin/bash
# Check how openai.Adaptor.DoResponse uses its fields
rg -nP -C3 'type\s+Adaptor\s+struct\b' relay/channel/openai
rg -nP -C5 'func\s+\(a\s*\*Adaptor\)\s*DoResponse\(' relay/channel/openai
rg -nP -C2 '\bResponseFormat\b|\bChannelType\b' relay/channel/openai

Length of output: 6900


Initialize openai.Adaptor before calling DoResponse.

openai.Adaptor has ChannelType and ResponseFormat that Init/ConvertAudioRequest set and that DoResponse/handlers (e.g., OpenaiSTTHandler, GetModelList) read — constructing a zero-value adaptor can break audio/STT or channel-specific logic.

Action (relay/channel/deepseek/adaptor.go:103-104): call adaptor.Init(info) before adaptor.DoResponse(...) and ensure adaptor.ResponseFormat is set for audio/transcription (e.g., via ConvertAudioRequest or assign from the audio request).

🤖 Prompt for AI Agents
In relay/channel/deepseek/adaptor.go around lines 103 to 104, the adaptor is
constructed as a zero-value and used immediately; call adaptor.Init(info) before
calling adaptor.DoResponse(c, resp, info) so ChannelType and other fields are
initialized, and ensure adaptor.ResponseFormat is set for audio/transcription
(either by invoking the existing ConvertAudioRequest flow or explicitly
assigning ResponseFormat from the audio request) so DoResponse and STT/audio
handlers have the correct configuration.

}
return
}

func (a *Adaptor) GetModelList() []string {
Expand Down