relay-minimax.go 712 B

12345678910111213141516171819202122232425
  1. package minimax
  2. import (
  3. "fmt"
  4. channelconstant "github.com/QuantumNous/new-api/constant"
  5. relaycommon "github.com/QuantumNous/new-api/relay/common"
  6. "github.com/QuantumNous/new-api/relay/constant"
  7. )
  8. func GetRequestURL(info *relaycommon.RelayInfo) (string, error) {
  9. baseUrl := info.ChannelBaseUrl
  10. if baseUrl == "" {
  11. baseUrl = channelconstant.ChannelBaseURLs[channelconstant.ChannelTypeMiniMax]
  12. }
  13. switch info.RelayMode {
  14. case constant.RelayModeChatCompletions:
  15. return fmt.Sprintf("%s/v1/text/chatcompletion_v2", baseUrl), nil
  16. case constant.RelayModeAudioSpeech:
  17. return fmt.Sprintf("%s/v1/t2a_v2", baseUrl), nil
  18. default:
  19. return "", fmt.Errorf("unsupported relay mode: %d", info.RelayMode)
  20. }
  21. }