Я хочу интегрировать как речь в текст, так и текст в речь с BotFramework WebChat
Я интегрировал часть кода «речь в текст», но не могу добавить текст в речь
Кроме того, я протестировал его на портале Azure «Test in 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"
}
}