I am working in bot framework and enabled speech in it.
When testing the speech functionality it is not recognizing few words like "HR".
I tried with different region's subscription key (Westus, eastus, common). In all the cases it is not recognizing word "HR".
How to make it recognize that word?
Is there any option?
speechOptions = {
speechRecognizer: new CognitiveServices.SpeechRecognizer({
subscriptionKey:
'*******************'
}),
speechSynthesizer: new CognitiveServices.SpeechSynthesizer({
gender: CognitiveServices.SynthesisGender.Female,
subscriptionKey: '***********************',
voiceName: 'Microsoft Server Speech Text to Speech Voice (en-US, JessaRUS)'
})
};
Unfortunately, I don't believe this is possible at the moment. There is currently an issue on the Web Chat repo to add support for Biased Word Lists for Speech. Hopefully, it should be prioritized in the 4.6 release. I know the development is beginning to focus on creating a better user experience for speech in Web Chat.
In the meantime, you could prompt your use to phrases like "Human Resources" instead of "HR."
Hope this helps!
Related
I have a bot client and in which I have enabled speech functionality.
Everything works fine when I open the bot client in new window.
Recently we have added this bot client site url in a page as IFrame.
In this all the functionalities are working fine except speech functionality.
When we are clicking on microphone icon nothing is happening.
Have tried in multiple browsers and devices, same issue in all the devices.
Windows - Chrome, IE
IPad,
IPhone
Is it the expected behavior? or Do i need to update anything?
Please let me know if you want me to share any code.
Code.
speechOptions = {
speechRecognizer: new CognitiveServices.SpeechRecognizer({
subscriptionKey:
'xxx'
}),
speechSynthesizer: new CognitiveServices.SpeechSynthesizer({
gender: CognitiveServices.SynthesisGender.Female,
subscriptionKey: 'xxx'
voiceName: 'Microsoft Server Speech Text to Speech Voice (en-US, ZiraRUS)'
})
};
BotChat.App({
botConnection: botConnection,
user: { id: model.userId, Username: LoginUser,},
bot: { id: model.botId, name: model.botName },
resize: 'window',
speechOptions: speechOptions,
locale: 'en',
sendTypingIndicator: true
}, document.getElementById('BotChatElement'));
botConnection
.postActivity({
from: user,
name: 'requestWelcomeDialog',
type: 'event',
value: ''
})
.subscribe(function (id) {
console.log('"trigger requestWelcomeDialog" sent');
});
There's a few things you need to do in order to get speech working with WebChat.
Ensure that you are not using the version of WebChat with the embed code from the Azure Portal. You must use one of the WebChat bundles (use one of the es5 bundles if you want it to work in IE)
Speech Services are not supported on many version of major browsers. Ensure that you and your users are only using supported browsers or use Bing Speech
Chrome (and likely in the future, other browsers) blocks microphone access until certain interactions occur first on the page/iFrame. You should be able to get around this with <iframe allow="microphone *">
I am developing a Bot using Microsoft Bot Framework. I am using Adaptive Cards for displaying flights to users but they have a lot of limitations on their appearance. I am trying to render the adaptive card from one of the dialogs within my bot framework by creating a adaptive card renderer using my own hostconfig.json and then attaching the Html of my adaptive card back to the chat window. But its not working :(
public static Attachment CreateFlight(Flight flight)
{
var renderedAdaptiveCard = AdaptiveCardRenderer
.RenderCard(new AdaptiveCard
{
Body = new List<AdaptiveElement>
{
new AdaptiveContainer {Items = CreateFlightAdaptiveElements(flight)}
},
Actions = new List<AdaptiveAction>
{
new AdaptiveShowCardAction
{
Card = new AdaptiveCard
{
Body = new List<AdaptiveElement>
{
},
Actions = new List<AdaptiveAction>
{
new AdaptiveSubmitAction
{
Title = "Select",
Data = flight.Segments.Select(x => $"{x.Airline} {x.FlightNo}")
.Aggregate((i, j) => i + "/" + j),
}
},
BackgroundImage = new Uri($"{DomainUrl}/Images/ac_background.jpg")
},
Title = "Select"
},
},
BackgroundImage = new Uri($"{DomainUrl}/Images/ECEFF1.png")
});
var attachment = new Attachment
{
ContentType = "application/html",
Content = renderedAdaptiveCard.Html
};
return attachment;
}
Am I trying something that is impossible here ? How to change the default grey looks of my bot ? My primary channels would be Skype, Slack etc so I don't have plans to integrate this to a Web Chat. Kindly help me with this regard.
The idea behind Adaptive Cards is to allow each channel to render the cards in a way that's specific to that channel. A card "adapts" to any environment that might support it. While Adaptive Cards offer a lot of flexibility, the bot can only do so much because it's ultimately the channel that's in charge of rendering the card.
Card Authors describe their content as a simple JSON object. That
content can then be rendered natively inside a Host Application,
automatically adapting to the look and feel of the Host.
For example, Contoso Bot can author an Adaptive Card through the Bot
Framework, and when delivered to Skype, it will look and feel like a
Skype card. When that same payload is sent to Microsoft Teams, it will
look and feel like Microsoft Teams. As more host apps start to support
Adaptive Cards, that same payload will automatically light up inside
these applications, yet still feel entirely native to the app.
Users win because everything feels familiar. Host apps win because
they control the user experience. And Card Authors win because their
content gets broader reach without any additional work.
As you probably know, the RenderedAdaptiveCard type is meant to be used in client-side code. That means it can help you if you want to make your own channel for example, but it's not really meant to be used in a bot. Your code isn't working because there is no HTML attachment type and most channels don't support HTML at all. You can find more information in this question and this GitHub issue.
Hopefully you can achieve the appearance you're looking for using the tools available to you, such as images and links.
I'm coding a bot in two languages (en, es) which will always be accessed via DirectLine API.
The documentation says that:
The localization language is determined by the current thread's CurrentUICulture and CurrentCulture.
What is the proper way to pass the language to the BOT from the DirectLine API, so can be getted by CurrentCulture?
I haven't found out a proper way to do it, but I use a workaround.
When you give your user an ID, add the culture. Like this:
id: 'en-'+ idGeneratedByYou
Then from the controller:
var culture = activity.From.Id.Split('-')[0];
Finally, do a switch and depending it is en or es:
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("es-ES");
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("es-ES");
I know this is not the best way, but maybe it will work out for you.
I built a bot and it's working well, I'm using FormFlow to complete a questionnaire. I need the commands working in Spanish, but it only works in English (help, quit, reset...), except in the emulator.
Using the emulator and changing the Locale to "es" is working:
When I type "ayuda", the help is showed. It's ok.
In the Bot profile page, the bot was published in spanish (using "es"):
The bot was published in Skype, Facebook Messenger, Slack and Telegram.
When I use the bot in Android with language in "Estados Unidos - Español" or "España - Español" and type "ayuda" or other command in spanish, the bot answers the input in english with "'Ayuda' is not a [field] option" message, but when the input is "Help" it's working well.
Is there something I'm missing?
I use ngrok for review the messages exchanged between Emulator and the bot, using the Locale field (with es, es-US, es-PA, es-ES, etc) the messages in spanish is working.
After this, I write a little command in the bot for get the Locale, this field return an empty value ever (with es, en, etc).
Finally, I set the locale in the MessagesController in the Post method.
activity.Locale = "es-US";
The bot is working in spanish like I want.
Is this the best solution?
I had the same problem. Fixed it by changing the thread's culture in the form builder:
public static IForm<YourDialogForm> BuildForm()
{
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("es-AR");
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("es-AR");
return new FormBuilder<YourDialogForm>()
//your code
.Build();
}
disclaimer: not sure if it's the best place to change the culture
I am creating a firefox OS application, I want the user to be able to share a link through any application installed and eligible (facebook, twitter etc). I saw android has this kind of feature and firefox OS has it as well, as I saw it in one of it's built in applications. Went through Web API, didn't find a suitable match,
Any ideas how to do it?
This is the intended use of the Web Activity API . The idea is that applications register to handle activities like share. The Firefox OS Boiler Plate app has several examples of using Web Activities. In that example a user could share a url using code like:
var share = document.querySelector("#share");
if (share) {
share.onclick = function () {
new MozActivity({
name: "share",
data: {
number: 1,
url: "http://robertnyman.com"
}
});
};
}
Any app that handles the share activity will be shown allowing the user to pick the proper app to handle the share.