policy.go 624 B

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