Эти варианты отображения сделаны из-за ограничений / рекомендаций по используемым каналам.
Если вы загляните на страницу разработчика Facebook Messenger о Quick replies
здесь , она гласит:
Быстрые ответы предоставляют способ представления набора из до 11 кнопок в разговоре, которые содержат заголовок и дополнительное изображение и расположены заметно над композитором.Вы также можете использовать быстрые ответы, чтобы запросить местоположение человека, адрес электронной почты и номер телефона.
Как следствие, в коде BotBuilder, доступном на Github, у вас будет метод Determine if a number of Suggested Actions are supported by a Channel
здесь :
/// <summary>
/// Determine if a number of Suggested Actions are supported by a Channel.
/// </summary>
/// <param name="channelId">The Channel to check the if Suggested Actions are supported in.</param>
/// <param name="buttonCnt">(Optional) The number of Suggested Actions to check for the Channel.</param>
/// <returns>True if the Channel supports the buttonCnt total Suggested Actions, False if the Channel does not support that number of Suggested Actions.</returns>
public static bool SupportsSuggestedActions(string channelId, int buttonCnt = 100)
{
switch (channelId)
{
// https://developers.facebook.com/docs/messenger-platform/send-messages/quick-replies
case Connector.Channels.Facebook:
case Connector.Channels.Skype:
return buttonCnt <= 10;
// ...
}
}
Затем в используемом вами ChoiceFactory
выбран экран (см. Код здесь ):
public static IMessageActivity ForChannel(string channelId, IList<Choice> list, string text = null, string speak = null, ChoiceFactoryOptions options = null)
{
channelId = channelId ?? string.Empty;
list = list ?? new List<Choice>();
// Find maximum title length
var maxTitleLength = 0;
foreach (var choice in list)
{
var l = choice.Action != null && !string.IsNullOrEmpty(choice.Action.Title) ? choice.Action.Title.Length : choice.Value.Length;
if (l > maxTitleLength)
{
maxTitleLength = l;
}
}
// Determine list style
var supportsSuggestedActions = Channel.SupportsSuggestedActions(channelId, list.Count);
var supportsCardActions = Channel.SupportsCardActions(channelId, list.Count);
var maxActionTitleLength = Channel.MaxActionTitleLength(channelId);
var hasMessageFeed = Channel.HasMessageFeed(channelId);
var longTitles = maxTitleLength > maxActionTitleLength;
if (!longTitles && !supportsSuggestedActions && supportsCardActions)
{
// SuggestedActions is the preferred approach, but for channels that don't
// support them (e.g. Teams, Cortana) we should use a HeroCard with CardActions
return HeroCard(list, text, speak);
}
else if (!longTitles && supportsSuggestedActions)
{
// We always prefer showing choices using suggested actions. If the titles are too long, however,
// we'll have to show them as a text list.
return SuggestedAction(list, text, speak);
}
else if (!longTitles && list.Count <= 3)
{
// If the titles are short and there are 3 or less choices we'll use an inline list.
return Inline(list, text, speak, options);
}
else
{
// Show a numbered list.
return List(list, text, speak, options);
}
}
Вот почему вы получили список, если вы предоставили более 10 наименований.
Как правило, рекомендуется ограничить количество кнопок, более 10 - это огромно.Вы можете адаптировать свое поведение (например, группировка элементов / добавление дополнительного уровня выбора по группам)