如何防止"建议操作"转换为文本



我正在使用Node js与Microsoft Botframework V4构建一个聊天机器人。当我用短文本向用户发送SuggestedActions时,它的工作非常完美,如图所示。但是,当按钮的文本超过appx 20个字符时,它们会转换为带文本的有序列表。按钮转换为文本有没有一种方法可以强制机器人发送按钮,即使文本很长?

// this works perfectly
let buttons = ["Red", "Blue", "Yello"];
return await step.prompt(CHOICE_PROMPT, "Please Choose One", buttons);
// this does not work as expected, the buttons are converted to text and are //shown in a list
let buttons = ["I like Red and Blue",
    "I do not like any colo ",
    "Please stop   asking questions"
];
return await step.prompt(CHOICE_PROMPT, "Please Choose One", buttons);

这很有效

 let buttons = ["I like Red and Blue",
        "I do not like any colo ",
        "Please stop   asking questions"
    ];
let suggestedActions = MessageFactory.suggestedActions([buttons], 'Please choose one')
return await step.prompt(CHOICE_PROMPT, suggestedActions);

在此处找到最佳答案:https://stackoverflow.com/a/57064662/10531724

最新更新