Files
sub2api-cn-relay-manager/internal/batch/capability_profile.go
2026-05-22 14:41:12 +08:00

35 lines
926 B
Go

package batch
import "sub2api-cn-relay-manager/internal/probe"
type ImportRoutingStrategy struct {
UseRawChatCompletions bool
SkipResponsesChecks bool
RetryInitial503 bool
TreatProbe403Advisory bool
}
func BuildImportRoutingStrategy(profile *probe.CapabilityProfile) ImportRoutingStrategy {
strategy := ImportRoutingStrategy{
RetryInitial503: true,
}
if profile == nil {
return strategy
}
if profile.TransportProfile.SupportsOpenAIChatCompletions && !profile.TransportProfile.SupportsOpenAIResponses {
strategy.UseRawChatCompletions = true
strategy.SkipResponsesChecks = true
}
for _, advisory := range profile.TransportProfile.KnownAdvisories {
switch advisory {
case "responses_unsupported_but_chat_ok":
strategy.UseRawChatCompletions = true
strategy.SkipResponsesChecks = true
case "initial_probe_race_expected":
strategy.TreatProbe403Advisory = true
}
}
return strategy
}