|
@@ -10,6 +10,7 @@ import (
|
|
|
"one-api/relay/channel"
|
|
"one-api/relay/channel"
|
|
|
"one-api/relay/channel/openai"
|
|
"one-api/relay/channel/openai"
|
|
|
relaycommon "one-api/relay/common"
|
|
relaycommon "one-api/relay/common"
|
|
|
|
|
+ "one-api/relay/constant"
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
type Adaptor struct {
|
|
type Adaptor struct {
|
|
@@ -29,7 +30,12 @@ func (a *Adaptor) Init(info *relaycommon.RelayInfo) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (a *Adaptor) GetRequestURL(info *relaycommon.RelayInfo) (string, error) {
|
|
func (a *Adaptor) GetRequestURL(info *relaycommon.RelayInfo) (string, error) {
|
|
|
- return fmt.Sprintf("%s/v1/chat/completions", info.BaseUrl), nil
|
|
|
|
|
|
|
+ switch info.RelayMode {
|
|
|
|
|
+ case constant.RelayModeCompletions:
|
|
|
|
|
+ return fmt.Sprintf("%s/beta/completions", info.BaseUrl), nil
|
|
|
|
|
+ default:
|
|
|
|
|
+ return fmt.Sprintf("%s/v1/chat/completions", info.BaseUrl), nil
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (a *Adaptor) SetupRequestHeader(c *gin.Context, req *http.Header, info *relaycommon.RelayInfo) error {
|
|
func (a *Adaptor) SetupRequestHeader(c *gin.Context, req *http.Header, info *relaycommon.RelayInfo) error {
|