policy.go 562 B

123456789101112131415161718
  1. package openaicompat
  2. import "github.com/QuantumNous/new-api/setting/model_setting"
  3. func ShouldChatCompletionsUseResponsesPolicy(policy model_setting.ChatCompletionsToResponsesPolicy, channelID int, model string) bool {
  4. if !policy.IsChannelEnabled(channelID) {
  5. return false
  6. }
  7. return matchAnyRegex(policy.ModelPatterns, model)
  8. }
  9. func ShouldChatCompletionsUseResponsesGlobal(channelID int, model string) bool {
  10. return ShouldChatCompletionsUseResponsesPolicy(
  11. model_setting.GetGlobalSettings().ChatCompletionsToResponsesPolicy,
  12. channelID,
  13. model,
  14. )
  15. }