Botframework 如何在多行中询问用户的选择?
我要求用户从以下多个选项中进行选择Botframework 如何在多行中询问用户的选择?,botframework,Botframework,我要求用户从以下多个选项中进行选择 var reportData = { "Report A Traffic Violation": { intent: 'report_a_traffic_violation' }, "Report a Lost Property": { intent: 'report_a_traffic_violation' }, "Describe Incident": { intent
var reportData = {
"Report A Traffic Violation": {
intent: 'report_a_traffic_violation'
},
"Report a Lost Property": {
intent: 'report_a_traffic_violation'
},
"Describe Incident": {
intent: '/describeIncident'
}
};
builder.Prompts.choice(session, "please select from options", reportData);
但是选项以单行形式显示给用户。如何使用以下多行向用户显示选项
对于js:尽管“\n”是通用换行符。 对于c#SDK:Environment.NewLine.Node.js 根据您提供的代码,我想您使用的是node.js 您可以查看Microsoft提供的Contoso Flowers示例,在其
设置
函数中:在此处预览,列表可见
以下是他们如何处理列表:
var SettingChoice = {
Email: 'edit_email',
Phone: 'edit_phone',
Addresses: 'edit_addresses',
Cancel: 'cancel'
};
var lib = new builder.Library('settings');
lib.dialog('/', [
// Display options
function (session) {
builder.Prompts.choice(session, 'settings_intro', [
session.gettext(SettingChoice.Email),
session.gettext(SettingChoice.Phone),
session.gettext(SettingChoice.Addresses),
session.gettext(SettingChoice.Cancel)
]);
},
您是否尝试使用类似于此处的数组
C#
对于在C#中构建机器人程序的用户,只需将
PromptStyle
指定为PromptStyle.PerLine
尝试添加listStyle参数:
builder.Prompts.choice(
session,
"please select from options",
reportData,
{listStyle: builder.ListStyle.list}
);
有关Bot框架文档中列表样式的详细信息:对于C#您有PromptStyle.PerLine设置,该设置会自动为您执行此操作。如何向
reportData
对象添加新行字符?