我想将语音到文本和文本到语音都与BotFramework WebChat集成
我已经集成了代码的“语音转文字”部分,但是我无法添加“文字转语音”
此外,我在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}`)
);
}
这是我从机器人发出的具有语音和文本字段的数据响应
{
"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"
}
}
答案 0 :(得分:0)
如果您集成了语音转文字功能,则漫游器会自动尝试使用语音转语音功能进行回复,但是您必须确保在漫游器侧 您提供{{1 }}中的值以及speak
值中的值。