feat: publish v1.0.0-rc.36-custom.1
Publish Docker image (Multi-arch) / Build & push (amd64) (push) Failing after 9m20s
Release (Linux, macOS, Windows) / Linux Release (push) Failing after 55m7s
Publish Docker image (Multi-arch) / Build & push (arm64) (push) Canceled after 0s
Release (Linux, macOS, Windows) / macOS Release (push) Canceled after 0s
Release (Linux, macOS, Windows) / Windows Release (push) Canceled after 0s
Publish Docker image (Multi-arch) / Create multi-arch manifests (push) Canceled after 0s
Publish Docker image (Multi-arch) / Build & push (amd64) (push) Failing after 9m20s
Release (Linux, macOS, Windows) / Linux Release (push) Failing after 55m7s
Publish Docker image (Multi-arch) / Build & push (arm64) (push) Canceled after 0s
Release (Linux, macOS, Windows) / macOS Release (push) Canceled after 0s
Release (Linux, macOS, Windows) / Windows Release (push) Canceled after 0s
Publish Docker image (Multi-arch) / Create multi-arch manifests (push) Canceled after 0s
This commit is contained in:
commit
bb7968b612
2381 files changed
+551494
No files matched your search
@@ -0,0 +1,37 @@
|
||||
package tencent
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/QuantumNous/new-api/constant"
|
||||
"github.com/QuantumNous/new-api/relay/channel"
|
||||
"github.com/QuantumNous/new-api/relay/channel/openai"
|
||||
relaycommon "github.com/QuantumNous/new-api/relay/common"
|
||||
)
|
||||
|
||||
const tokenHubBaseURL = "https://tokenhub.tencentmaas.com"
|
||||
|
||||
// DispatchAdaptor 按密钥格式分流:三段式 ak/sk 走原生 TC3,单段 TokenHub key 走 OpenAI 兼容。
|
||||
type DispatchAdaptor struct {
|
||||
channel.Adaptor
|
||||
}
|
||||
|
||||
func (a *DispatchAdaptor) Init(info *relaycommon.RelayInfo) {
|
||||
if strings.Contains(info.ApiKey, "|") {
|
||||
a.Adaptor = &Adaptor{}
|
||||
} else {
|
||||
a.Adaptor = &openai.Adaptor{}
|
||||
if info.ChannelBaseUrl == "" || info.ChannelBaseUrl == constant.ChannelBaseURLs[constant.ChannelTypeTencent] {
|
||||
info.ChannelBaseUrl = tokenHubBaseURL
|
||||
}
|
||||
}
|
||||
a.Adaptor.Init(info)
|
||||
}
|
||||
|
||||
func (a *DispatchAdaptor) GetModelList() []string {
|
||||
return ModelList
|
||||
}
|
||||
|
||||
func (a *DispatchAdaptor) GetChannelName() string {
|
||||
return ChannelName
|
||||
}
|
||||
Reference in new issue
Block a user