one-api/providers/azureSpeech/base.go
Miraz Hossain a76b3f6ac2
🔖 chore: English translation and other improvements (#163)
* chore: improve english translation

* fix: typo of error message

* chore: improve frontend icon

* chore: improve English translation

* chore: update PaperProps width to minWidth in TableRow.js files

* chore: Add Docker image workflow for one-api in English

---------

Co-authored-by: Martial BE <me@xiao5.info>
2024-04-23 16:25:40 +08:00

39 lines
959 B
Go

package azureSpeech
import (
"one-api/common/requester"
"one-api/model"
"one-api/providers/base"
)
// 定义供应商工厂
type AzureSpeechProviderFactory struct{}
// 创建 AzureSpeechProvider
func (f AzureSpeechProviderFactory) Create(channel *model.Channel) base.ProviderInterface {
return &AzureSpeechProvider{
BaseProvider: base.BaseProvider{
Config: base.ProviderConfig{
AudioSpeech: "/cognitiveservices/v1",
},
Channel: channel,
Requester: requester.NewHTTPRequester(*channel.Proxy, nil),
},
}
}
type AzureSpeechProvider struct {
base.BaseProvider
}
// 获取请求头
func (p *AzureSpeechProvider) GetRequestHeaders() (headers map[string]string) {
headers = make(map[string]string)
headers["Ocp-Apim-Subscription-Key"] = p.Channel.Key
headers["Content-Type"] = "application/ssml+xml"
headers["User-Agent"] = "OneAPI"
// headers["X-Microsoft-OutputFormat"] = "audio-16khz-128kbitrate-mono-mp3"
return headers
}