🔖 chore: optimize the settings of Azure Speech

This commit is contained in:
Martial BE 2024-04-23 17:28:34 +08:00
parent 1e07b0b25f
commit f91b9856d4
No known key found for this signature in database
GPG Key ID: D06C32DF0EDB9084
3 changed files with 21 additions and 2 deletions

View File

@ -1120,5 +1120,7 @@
"开始时间": "Start Time", "开始时间": "Start Time",
"模型名称为coze-{bot_id},你也可以直接使用 coze-* 通配符来匹配所有coze开头的模型": "The model name is coze-{bot_id}, you can also directly use the coze-* wildcard to match all models starting with coze", "模型名称为coze-{bot_id},你也可以直接使用 coze-* 通配符来匹配所有coze开头的模型": "The model name is coze-{bot_id}, you can also directly use the coze-* wildcard to match all models starting with coze",
"模型名称映射, 你可以取一个容易记忆的名字来代替coze-{bot_id},例如:": "Model name mapping, you can take an easy-to-remember name to replace coze-{bot_id}, for example: ", "模型名称映射, 你可以取一个容易记忆的名字来代替coze-{bot_id},例如:": "Model name mapping, you can take an easy-to-remember name to replace coze-{bot_id}, for example: ",
",注意如果使用了模型映射那么上面的模型名称必须使用映射前的名称上述例子中你应该在模型中填入coze-translate(如果已经使用了coze-*,可以忽略)。": ", Note: If a model mapping is used, then the model name above must use the name before the mapping. In the example above, you should fill in coze-translate in the model (if coze-* has been used, it can be ignored)." ",注意如果使用了模型映射那么上面的模型名称必须使用映射前的名称上述例子中你应该在模型中填入coze-translate(如果已经使用了coze-*,可以忽略)。": ", Note: If a model mapping is used, then the model name above must use the name before the mapping. In the example above, you should fill in coze-translate in the model (if coze-* has been used, it can be ignored).",
"位置/区域": "Location/Region",
"请输入你 Speech Studio 的位置/区域例如eastasia": "Please enter the location/region of your Speech Studio, for example: eastasia"
} }

View File

@ -1,9 +1,11 @@
package azureSpeech package azureSpeech
import ( import (
"fmt"
"one-api/common/requester" "one-api/common/requester"
"one-api/model" "one-api/model"
"one-api/providers/base" "one-api/providers/base"
"strings"
) )
// 定义供应商工厂 // 定义供应商工厂
@ -26,6 +28,17 @@ type AzureSpeechProvider struct {
base.BaseProvider base.BaseProvider
} }
func (p *AzureSpeechProvider) GetFullRequestURL(requestURL string, modelName string) string {
baseURL := ""
if p.Channel.Other != "" {
baseURL = fmt.Sprintf("https://%s.tts.speech.microsoft.com", p.Channel.Other)
} else {
baseURL = strings.TrimSuffix(p.GetBaseURL(), "/")
}
return fmt.Sprintf("%s%s", baseURL, requestURL)
}
// 获取请求头 // 获取请求头
func (p *AzureSpeechProvider) GetRequestHeaders() (headers map[string]string) { func (p *AzureSpeechProvider) GetRequestHeaders() (headers map[string]string) {
headers = make(map[string]string) headers = make(map[string]string)

View File

@ -159,12 +159,16 @@ const typeConfig = {
modelGroup: 'Baichuan' modelGroup: 'Baichuan'
}, },
24: { 24: {
inputLabel: {
other: '位置/区域'
},
input: { input: {
models: ['tts-1', 'tts-1-hd'] models: ['tts-1', 'tts-1-hd']
}, },
prompt: { prompt: {
test_model: '', test_model: '',
base_url: '请输入请求地址例如https://eastasia.tts.speech.microsoft.com' base_url: '',
other: '请输入你 Speech Studio 的位置/区域例如eastasia'
} }
}, },
27: { 27: {