mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-04-19 09:58:38 +00:00
31 lines
905 B
Go
31 lines
905 B
Go
package minimax
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
channelconstant "github.com/QuantumNous/new-api/constant"
|
|
relaycommon "github.com/QuantumNous/new-api/relay/common"
|
|
"github.com/QuantumNous/new-api/relay/constant"
|
|
"github.com/QuantumNous/new-api/types"
|
|
)
|
|
|
|
func GetRequestURL(info *relaycommon.RelayInfo) (string, error) {
|
|
baseUrl := info.ChannelBaseUrl
|
|
if baseUrl == "" {
|
|
baseUrl = channelconstant.ChannelBaseURLs[channelconstant.ChannelTypeMiniMax]
|
|
}
|
|
switch info.RelayFormat {
|
|
case types.RelayFormatClaude:
|
|
return fmt.Sprintf("%s/anthropic/v1/messages", info.ChannelBaseUrl), nil
|
|
default:
|
|
switch info.RelayMode {
|
|
case constant.RelayModeChatCompletions:
|
|
return fmt.Sprintf("%s/v1/text/chatcompletion_v2", baseUrl), nil
|
|
case constant.RelayModeAudioSpeech:
|
|
return fmt.Sprintf("%s/v1/t2a_v2", baseUrl), nil
|
|
default:
|
|
return "", fmt.Errorf("unsupported relay mode: %d", info.RelayMode)
|
|
}
|
|
}
|
|
}
|