@lobehub/ui 1.109.1 → 1.110.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -11,7 +11,7 @@ export var postAzureSpeech = /*#__PURE__*/function () {
|
|
|
11
11
|
case 0:
|
|
12
12
|
speechConfig = SpeechConfig.fromSubscription(env.SPEECH_KEY, env.SPEECH_REGION);
|
|
13
13
|
speechConfig.setProperty(PropertyId.SpeechServiceResponse_RequestSentenceBoundary, 'true');
|
|
14
|
-
speechConfig.speechSynthesisOutputFormat = SpeechSynthesisOutputFormat.
|
|
14
|
+
speechConfig.speechSynthesisOutputFormat = SpeechSynthesisOutputFormat.Webm24Khz16BitMonoOpus;
|
|
15
15
|
audioConfig = AudioConfig.fromDefaultSpeakerOutput();
|
|
16
16
|
synthesizer = new SpeechSynthesizer(speechConfig, audioConfig);
|
|
17
17
|
completeCb = function completeCb(result, resolve, reject) {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
-
import { SpeechSynthesisOutputFormat } from 'microsoft-cognitiveservices-speech-sdk';
|
|
4
3
|
import { v4 as uuidv4 } from 'uuid';
|
|
5
4
|
import { genSSML } from "../utils/genSSML";
|
|
6
5
|
export var postMicrosoftSpeech = /*#__PURE__*/function () {
|
|
@@ -15,8 +14,7 @@ export var postMicrosoftSpeech = /*#__PURE__*/function () {
|
|
|
15
14
|
SpeakTriggerSource: 'AccTuningPagePlayButton'
|
|
16
15
|
},
|
|
17
16
|
ssml: genSSML(text, options),
|
|
18
|
-
|
|
19
|
-
ttsAudioFormat: SpeechSynthesisOutputFormat.Webm16Khz16BitMonoOpus
|
|
17
|
+
ttsAudioFormat: 'audio-24khz-160kbitrate-mono-mp3'
|
|
20
18
|
});
|
|
21
19
|
DEFAULT_HEADERS = {
|
|
22
20
|
'accept': '*/*',
|
|
@@ -29,7 +27,7 @@ export var postMicrosoftSpeech = /*#__PURE__*/function () {
|
|
|
29
27
|
'sec-ch-ua-mobile': '?0',
|
|
30
28
|
'sec-ch-ua-platform': '"Windows"',
|
|
31
29
|
'sec-fetch-dest': 'empty',
|
|
32
|
-
'sec-fetch-mode': 'cors',
|
|
30
|
+
'sec-fetch-mode': 'no-cors',
|
|
33
31
|
'sec-fetch-site': 'same-site',
|
|
34
32
|
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36'
|
|
35
33
|
};
|
|
@@ -39,6 +37,7 @@ export var postMicrosoftSpeech = /*#__PURE__*/function () {
|
|
|
39
37
|
body: data,
|
|
40
38
|
headers: DEFAULT_HEADERS,
|
|
41
39
|
method: 'POST',
|
|
40
|
+
mode: 'no-cors',
|
|
42
41
|
// @ts-ignore
|
|
43
42
|
responseType: 'arraybuffer'
|
|
44
43
|
});
|
|
@@ -8,8 +8,8 @@ export var genSSML = function genSSML(text, options) {
|
|
|
8
8
|
pitch: options.pitch,
|
|
9
9
|
rate: options.rate
|
|
10
10
|
});
|
|
11
|
-
|
|
12
|
-
pretty: true,
|
|
11
|
+
var result = ssml.say(text).render({
|
|
13
12
|
provider: ServiceProvider.Microsoft
|
|
14
13
|
});
|
|
14
|
+
return "<speak version=\"1.0\" xmlns=\"http://www.w3.org/2001/10/synthesis\" xmlns:mstts=\"https://www.w3.org/2001/mstts\">".concat(result, "</speak>");
|
|
15
15
|
};
|