feat: make channel test follow global OpenAI completions via responses rules#4888
feat: make channel test follow global OpenAI completions via responses rules#4888layou233 wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThe ChangesEndpoint auto-detection refactoring
🎯 2 (Simple) | ⏱️ ~10 minutes
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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. Comment |
1808840 to
9ca25e1
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@controller/channel-test.go`:
- Around line 122-124: When the branch that calls
channel.ShouldChatCompletionsUseResponsesGlobal(...) sets requestPath =
"/v1/responses", also set the endpointType variable to the responses routing
value so relay mode and request construction stay in sync; update the same
branch that sets requestPath to assign endpointType = "responses" (or the
enum/const your code uses for responses) so buildTestRequest(...) creates a
responses-shaped request and avoids the invalid response request type assertion
in buildTestRequest / later request handling.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 223e7a82-1105-4dc2-9990-7c7ae0d5ec26
📒 Files selected for processing (1)
controller/channel-test.go
| } else if service.ShouldChatCompletionsUseResponsesGlobal(channel.Id, channel.Type, testModel) { | ||
| // follow the global setting for using responses instead of completions | ||
| requestPath = "/v1/responses" |
There was a problem hiding this comment.
Keep endpointType in sync when global responses routing is selected.
This branch sets requestPath to /v1/responses but leaves endpointType empty. At Line 214, buildTestRequest(...) then builds a chat/completions-shaped request, while relay mode is responses; that later fails the type assertion at Lines 323-331 (invalid response request type).
Suggested fix
} else if service.ShouldChatCompletionsUseResponsesGlobal(channel.Id, channel.Type, testModel) {
// follow the global setting for using responses instead of completions
requestPath = "/v1/responses"
+ endpointType = string(constant.EndpointTypeOpenAIResponse)
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| } else if service.ShouldChatCompletionsUseResponsesGlobal(channel.Id, channel.Type, testModel) { | |
| // follow the global setting for using responses instead of completions | |
| requestPath = "/v1/responses" | |
| } else if service.ShouldChatCompletionsUseResponsesGlobal(channel.Id, channel.Type, testModel) { | |
| // follow the global setting for using responses instead of completions | |
| requestPath = "/v1/responses" | |
| endpointType = string(constant.EndpointTypeOpenAIResponse) | |
| } |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@controller/channel-test.go` around lines 122 - 124, When the branch that
calls channel.ShouldChatCompletionsUseResponsesGlobal(...) sets requestPath =
"/v1/responses", also set the endpointType variable to the responses routing
value so relay mode and request construction stay in sync; update the same
branch that sets requestPath to assign endpointType = "responses" (or the
enum/const your code uses for responses) so buildTestRequest(...) creates a
responses-shaped request and avoids the invalid response request type assertion
in buildTestRequest / later request handling.
当前渠道测试代码里,自动检测部分对 Codex 模型自动使用 Responses API,但是仍有其他模型(并且未来可能会有更多)仍只通过 Responses API 提供,如 gpt-5.4-pro。
为了使其与系统其他部分更加直观统一,可以在自动检测逻辑中应用全局设置里的 Chat Completions API -> Responses API 转换规则,按规则直接改为使用 Responses API。
另:我们是否需要给 gpt-pro 系列也如同 codex 系列一样,硬编码使用 Responses API?
📝 变更描述 / Description
🚀 变更类型 / Type of change
✅ 提交前检查项 / Checklist
Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。📸 运行证明 / Proof of Work
(请在此粘贴截图、关键日志或测试报告,以证明变更生效)
Summary by CodeRabbit