Repository navigation
Conversation
WalkthroughModified the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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 |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
controller/channel-test.go (1)
433-439: Extract ResponsesInputconstant and reconsiderStream: truedefault for testThe hard-coded
json.RawMessageliteral is duplicated across lines 437 and 476, creating a maintenance risk. Additionally, forcingStream: truein test payloads contradicts the OpenAI Responses API default (stream=false) and may hide edge cases where streaming is not supported—a more conservative test strategy would default toStream: false.Proposed refactor
+var defaultResponsesTestInput = json.RawMessage( + `[{"type":"message","role":"user","content":[{"type":"input_text","text":"hi"}]}]`, +) + func buildTestRequest(model string, endpointType string, channel *model.Channel) dto.Request { // 根据端点类型构建不同的测试请求 if endpointType != "" { switch constant.EndpointType(endpointType) { ... case constant.EndpointTypeOpenAIResponse: // 返回 OpenAIResponsesRequest return &dto.OpenAIResponsesRequest{ Model: model, - Input: json.RawMessage(`[{"type":"message","role":"user","content":[{"type":"input_text","text":"hi"}]}]`), - Stream: true, + Input: defaultResponsesTestInput, + Stream: false, } ... // Responses-only models (e.g. codex series) if strings.Contains(strings.ToLower(model), "codex") { return &dto.OpenAIResponsesRequest{ Model: model, - Input: json.RawMessage(`[{"type":"message","role":"user","content":[{"type":"input_text","text":"hi"}]}]`), - Stream: true, + Input: defaultResponsesTestInput, + Stream: false, } }
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
controller/channel-test.go
🧰 Additional context used
🧬 Code graph analysis (1)
controller/channel-test.go (1)
dto/openai_request.go (1)
Input(904-908)
|
单字符串在input是官方最小案例,你不支持或许只是你的供应商不支持,但是responses接口格式支持的,这里测试的原则是尽可能发送最少token |
|
我在考虑把参数覆盖功能也给套到这个上面,这样就可以改配置实现你这个了 |
好的,感谢大佬! 等您好消息 🤝 |
|
可以看一下这个PR #2627 配置参数覆盖,下面的效果是当是渠道测试请求时,模型名包含codex,则设置input为你前面要的内容 |
好的,感谢大佬! |
这个之前就是有的吧,可以试试 |
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.