I am building a Coratana skill by first building a bot, using FormFlow. I detect my intents and entities using LUIS and pass the entities to my FormFlow dialog. If one or more FormFlow fields is not filled in, FormFlow dialog prompts the user to fill in the missing information, but this prompt is not spoken, only shows on the cortana screen. Is there any way for FormFlow to speak the prompts?
In the screenshot shown below, the prompt "Do you need airport shuttle?" was just displayed and not spoken:
My formFlow definition looks like this:
[Serializable]
public class HotelsQuery
{
[Prompt("Please enter your {&}")]
[Optional]
public string Destination { get; set; }
[Prompt("Near which Airport")]
[Optional]
public string AirportCode { get; set; }
[Prompt("Do you need airport shuttle?")]
public string DoYouNeedAirportShutle { get; set; }
}
I don't think Speak is currently supported in FormFlow
.
What you could do, as a workaround is adding an IMessageActivityMapper
that basically promote text to speak automatically.
namespace Code
{
using Microsoft.Bot.Builder.Dialogs;
using Microsoft.Bot.Builder.Dialogs.Internals;
using Microsoft.Bot.Connector;
/// <summary>
/// Activity mapper that automatically populates activity.speak for speech enabled channels.
/// </summary>
public sealed class TextToSpeakActivityMapper : IMessageActivityMapper
{
public IMessageActivity Map(IMessageActivity message)
{
// only set the speak if it is not set by the developer.
var channelCapability = new ChannelCapability(Address.FromActivity(message));
if (channelCapability.SupportsSpeak() && string.IsNullOrEmpty(message.Speak))
{
message.Speak = message.Text;
}
return message;
}
}
}
Then to use it, you need to register it in your Global.asax.cs
file as:
var builder = new ContainerBuilder();
builder
.RegisterType<TextToSpeakActivityMapper>()
.AsImplementedInterfaces()
.SingleInstance();
builder.Update(Conversation.Container);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With