fix: auto default codex to /v1/responses without overriding user-selected endpoint
This commit is contained in:
parent
0c0b69a31a
commit
4455058754
@ -42,6 +42,20 @@ type testResult struct {
|
|||||||
newAPIError *types.NewAPIError
|
newAPIError *types.NewAPIError
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func normalizeChannelTestEndpoint(channel *model.Channel, modelName, endpointType string) string {
|
||||||
|
normalized := strings.TrimSpace(endpointType)
|
||||||
|
if normalized != "" {
|
||||||
|
return normalized
|
||||||
|
}
|
||||||
|
if strings.HasSuffix(modelName, ratio_setting.CompactModelSuffix) {
|
||||||
|
return string(constant.EndpointTypeOpenAIResponseCompact)
|
||||||
|
}
|
||||||
|
if channel != nil && channel.Type == constant.ChannelTypeCodex {
|
||||||
|
return string(constant.EndpointTypeOpenAIResponse)
|
||||||
|
}
|
||||||
|
return normalized
|
||||||
|
}
|
||||||
|
|
||||||
func testChannel(channel *model.Channel, testModel string, endpointType string, isStream bool) testResult {
|
func testChannel(channel *model.Channel, testModel string, endpointType string, isStream bool) testResult {
|
||||||
tik := time.Now()
|
tik := time.Now()
|
||||||
var unsupportedTestChannelTypes = []int{
|
var unsupportedTestChannelTypes = []int{
|
||||||
@ -77,6 +91,8 @@ func testChannel(channel *model.Channel, testModel string, endpointType string,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
endpointType = normalizeChannelTestEndpoint(channel, testModel, endpointType)
|
||||||
|
|
||||||
requestPath := "/v1/chat/completions"
|
requestPath := "/v1/chat/completions"
|
||||||
|
|
||||||
// 如果指定了端点类型,使用指定的端点类型
|
// 如果指定了端点类型,使用指定的端点类型
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user