[英]Integrating Cognitive Speech Service for both Text-to-Speech and Speech-to-Text in Microsoft BotFramework WebChat
I want to integrate both speech-to-text and text-to-speech with the BotFramework WebChat 我想将语音转文字和文字转语音与BotFramework WebChat集成
I have integrated the Speech-to-Text part of the code, but I am not able to add the Text-to-Speech 我已经集成了代码的“语音转文字”部分,但是无法添加“文字转语音”
Also, I tested it in the Azure Portal "Test in WebChat" option and the speech output works 另外,我在Azure门户的“在WebChat中测试”选项中对其进行了测试,并且语音输出有效
public async ngOnInit() {
const directLine = window.WebChat.createDirectLine({
secret: "<<webchat secret>>", // from azure portal under channel webchat
webSocket: false
});
var ponyfillFactory = await window.WebChat.createCognitiveServicesSpeechServicesPonyfillFactory({ subscriptionKey: '<<subscriptionKey>>', region: "westus" });
window.WebChat.renderWebChat(
{
directLine: directLine,
userID: "USER_ID",
locale: "en-IN",
styleSet,
webSpeechPonyfillFactory : ponyfillFactory
},
this.botWindowElement.nativeElement
);
directLine
.postActivity({
from: { id: "USER_ID", name: "USER_NAME" },
name: "requestWelcomeDialog",
type: "event",
value: "token"
})
.subscribe(
id => console.log(`Posted activity, assigned ID ${id}`),
error => console.log(`Error posting activity ${error}`)
);
}
This is my data response from the bot has both speak and text field 这是我从机器人获得的数据响应,同时具有语音和文本字段
{
"CalendarWelcomeMessage": {
"replies": [
{
"text": "Welcome to Calendar Skill! I can provide you an overview of your meetings today, read out your upcoming meeting, or create a new meeting for you.",
"speak": "Welcome to Calendar Skill! I can provide you an overview of your meetings today, read out your upcoming meeting, or create a new meeting for you."
}
],
"suggestedActions": [
"What are my meetings today?",
"What is my next meeting",
"I want to set up a meeting ",
"Can you update a meeting ",
"Can you cancel my event"
],
"inputHint": "expectingInput"
},
"HelpMessage": {
"replies": [
{
"text": "I can provide you an overview of your meetings today, read out your upcoming meeting, or create a new meeting for you.",
"speak": "I can provide you an overview of your meetings today, read out your upcoming meeting, or create a new meeting for you."
}
],
"suggestedActions": [
"What are my meetings today?",
"What is my next meeting",
"I want to set up a meeting",
"Can you update a meeting",
"Can you cancel my event"
],
"inputHint": "expectingInput"
},
"GreetingMessage": {
"replies": [
{
"text": "Hi!",
"speak": "Hi!"
},
{
"text": "Hi there!",
"speak": "Hi there!"
},
{
"text": "Hello!",
"speak": "Hello!"
}
],
"inputHint": "acceptingInput"
},
"GoodbyeMessage": {
"replies": [
{
"text": "Goodbye!",
"speak": "Goodbye!"
}
],
"inputHint": "acceptingInput"
},
"LogOut": {
"replies": [
{
"text": "Your sign out was successful.",
"speak": "Your sign out was successful."
},
{
"text": "You have successfully signed out.",
"speak": "You have successfully signed out."
},
{
"text": "You have been logged out.",
"speak": "You have been logged out."
}
],
"inputHint": "acceptingInput"
},
"FeatureNotAvailable": {
"replies": [
{
"text": "This feature is not yet available in the Calendar Skill. Please try asking something else.",
"speak": "This feature is not yet available in the Calendar Skill. Please try asking something else."
}
],
"inputHint": "acceptingInput"
},
"CancelMessage": {
"replies": [
{
"text": "Ok, let's start over.",
"speak": "Ok, let's start over."
}
],
"inputHint": "acceptingInput"
}
}
如果您已集成语音-文本,你的机器人会自动尝试使用文本到语音回复,但你必须确保你的机器人侧您提供一个speak
除了在你的活动值text
价值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.