mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-15 23:22:59 +08:00
fix(groups): merge main and resolve model allowlist conflicts
This commit is contained in:
@@ -1530,7 +1530,7 @@ func TestOpenAIResponsesWebSocket_PassthroughTracksModelPerTurn(t *testing.T) {
|
||||
"each turn must be billed with its own channel-mapped model")
|
||||
}
|
||||
|
||||
func TestOpenAIResponsesWebSocket_UnchangedChannelTargetOutsideAccountMappingKeysRemainsValid(t *testing.T) {
|
||||
func TestOpenAIResponsesWebSocket_ChannelMappedTargetSelectsAccountWithoutRequestedAlias(t *testing.T) {
|
||||
got := runOpenAIResponsesWebSocketUsageLogCase(t, openAIResponsesWSUsageLogCase{
|
||||
firstPayload: `{"type":"response.create","model":"public-alias","stream":false}`,
|
||||
secondPayload: `{"type":"response.create","stream":false}`,
|
||||
@@ -1538,7 +1538,7 @@ func TestOpenAIResponsesWebSocket_UnchangedChannelTargetOutsideAccountMappingKey
|
||||
"public-alias": "gpt-5.6-sol",
|
||||
},
|
||||
accountModelMapping: map[string]any{
|
||||
"public-alias": "gpt-5.6-terra",
|
||||
"gpt-5.6-sol": "gpt-5.6-sol",
|
||||
},
|
||||
})
|
||||
|
||||
@@ -1710,6 +1710,40 @@ func TestOpenAIAccountScheduleModelUsesActualOrSharedResolver(t *testing.T) {
|
||||
require.Equal(t, "attempt-actual", openAIAccountScheduleModel(c, account, "public", true, nil))
|
||||
}
|
||||
|
||||
func TestOpenAIChannelForwardModelForScheduler(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
mapping service.ChannelMappingResult
|
||||
requested string
|
||||
want string
|
||||
}{
|
||||
{
|
||||
name: "mapped model is used for capability filtering",
|
||||
mapping: service.ChannelMappingResult{Mapped: true, MappedModel: " gpt-forward "},
|
||||
requested: "client-alias",
|
||||
want: "gpt-forward",
|
||||
},
|
||||
{
|
||||
name: "unmapped request preserves client model",
|
||||
mapping: service.ChannelMappingResult{MappedModel: "client-model"},
|
||||
requested: "client-model",
|
||||
want: "client-model",
|
||||
},
|
||||
{
|
||||
name: "empty mapped model safely preserves client model",
|
||||
mapping: service.ChannelMappingResult{Mapped: true, MappedModel: " "},
|
||||
requested: "client-model",
|
||||
want: "client-model",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
require.Equal(t, tt.want, openAIChannelForwardModel(tt.mapping, tt.requested))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestShouldReportOpenAIWSProxyAccountFailure(t *testing.T) {
|
||||
t.Run("unsupported client model switch does not penalize account", func(t *testing.T) {
|
||||
err := fmt.Errorf("wrapped ingress turn: %w", newOpenAIWSUnsupportedModelSwitchError("gpt-unsupported"))
|
||||
|
||||
Reference in New Issue
Block a user