【问题标题】:Using HeroCard Carsousel in first step of waterfall is not proceeding the further step在瀑布的第一步中使用英雄卡轮播不会进行下一步
【发布时间】:2019-11-26 18:16:02
【问题描述】:

我正在使用一种瀑布方法,它将为我创建一个服务请求。在瀑布的第一步中,我将 herocards 列表显示为用于创建服务请求的轮播。

const srCarousel = [
                CardFactory.heroCard('Application Service Request',
                    CardFactory.images(['https://www.usnews.com/dims4/USNEWS/65f1856/2147483647/thumbnail/970x647/quality/85/?url=http%3A%2F%2Fcom-usnews-beam-media.s3.amazonaws.com%2Fbe%2Fdd%2F8f25b4174b6398285139452fb7d5%2F190313-collegeapplication-stock.jpg']),
                    CardFactory.actions([
                        { type: 'postBack',
                            title: 'Application Service Request',
                            value: 'Create Application Service Request'
                        }])),
                CardFactory.heroCard('Virtual Desktop Service Request', ['https://www.usnews.com/dims4/USNEWS/65f1856/2147483647/thumbnail/970x647/quality/85/?url=http%3A%2F%2Fcom-usnews-beam-media.s3.amazonaws.com%2Fbe%2Fdd%2F8f25b4174b6398285139452fb7d5%2F190313-collegeapplication-stock.jpg'], ['Create Virtual Desktop Service Request']),
                CardFactory.heroCard('Generic Service Request', ['https://www.usnews.com/dims4/USNEWS/65f1856/2147483647/thumbnail/970x647/quality/85/?url=http%3A%2F%2Fcom-usnews-beam-media.s3.amazonaws.com%2Fbe%2Fdd%2F8f25b4174b6398285139452fb7d5%2F190313-collegeapplication-stock.jpg'], ['Create Generic Service Request'])

            ];
            const message = MessageFactory.carousel(srCarousel);
            return await stepContext.context.sendActivity(message);

上面的代码是我的瀑布方法中的第一个函数。但是,当我调用此对话框时。我在模拟器中获得了轮播卡,但机器人正在进入最后一步,而不是下一个提示。任何人都可以帮忙。我什至尝试使用动作类型作为 postback , messageBack 。对我来说没用。

更新:

我完整的瀑布对话步骤:

class CreateServiceRequestDialog extends CancelAndHelpDialog {
    constructor(id) {
        super(id || 'createServiceRequestDialog');

        // this.IncReq = new IncReq('int_user', 'Admin@123');

        this.addDialog(new TextPrompt(TEXT_PROMPT))
            .addDialog(new ConfirmPrompt(CONFIRM_PROMPT))
            .addDialog(new ChoicePrompt(CHOICE_PROMPT))
            .addDialog(new DateResolverDialog(DATE_RESOLVER_DIALOG))
            .addDialog(new WaterfallDialog(WATERFALL_DIALOG, [
                this.serviceRequestTypes.bind(this),
                this.classifySRDialog.bind(this)
                // this.incidentCreation.bind(this)
            ]));
        this.initialDialogId = WATERFALL_DIALOG;
    }

    async serviceRequestTypes(stepContext) {
        const srTypes = stepContext.options;
        console.log('INSIDE SR TYPES');
        console.log(srTypes);
        if (!srTypes.srTypes) {
            const srCarousel = [
                CardFactory.heroCard('Application Service Request',
                    CardFactory.images(['https://www.usnews.com/dims4/USNEWS/65f1856/2147483647/thumbnail/970x647/quality/85/?url=http%3A%2F%2Fcom-usnews-beam-media.s3.amazonaws.com%2Fbe%2Fdd%2F8f25b4174b6398285139452fb7d5%2F190313-collegeapplication-stock.jpg']),
                    CardFactory.actions([
                        { type: 'postBack',
                            title: 'Application Service Request',
                            value: 'Create Application Service Request'
                        }])),
                CardFactory.heroCard('Virtual Desktop Service Request', ['https://www.usnews.com/dims4/USNEWS/65f1856/2147483647/thumbnail/970x647/quality/85/?url=http%3A%2F%2Fcom-usnews-beam-media.s3.amazonaws.com%2Fbe%2Fdd%2F8f25b4174b6398285139452fb7d5%2F190313-collegeapplication-stock.jpg'], ['Create Virtual Desktop Service Request']),
                CardFactory.heroCard('Generic Service Request', ['https://www.usnews.com/dims4/USNEWS/65f1856/2147483647/thumbnail/970x647/quality/85/?url=http%3A%2F%2Fcom-usnews-beam-media.s3.amazonaws.com%2Fbe%2Fdd%2F8f25b4174b6398285139452fb7d5%2F190313-collegeapplication-stock.jpg'], ['Create Generic Service Request'])

            ];
            const message = MessageFactory.carousel(srCarousel);
            return await stepContext.context.sendActivity(message);
        }
    }

    async classifySRDialog(stepContext) {
        stepContext.values.classifiedSR = stepContext.result;
        console.log(stepContext.values.classifiedSR );
        if (stepContext.values.classifiedSR === 'Create Generic Service Request') {
            const promptOptions = { prompt: 'Can you describe your service request in short' };
            return await stepContext.prompt(TEXT_PROMPT, promptOptions);
        } else if (stepContext.values.classifiedSR === 'Create Application Service Request') {
            console.log('Inside Application SR');
            // Begin Dialog of application service request
        } else if (stepContext.values.classifiedSR === 'Create Virtual Desktop Service Request') {

            // Begin VDI dialog
        } else {

            // end Dialog
        }
    }


}

module.exports.CreateServiceRequestDialog = CreateServiceRequestDialog;

【问题讨论】:

  • 你能显示你的瀑布对话框步骤吗

标签: botframework chatbot


【解决方案1】:

更改以下代码应该解决您的问题。

更正一下:

return await stepContext.context.sendActivity(message);

到这里:

await stepContext.context.sendActivity(message);
return { status: DialogTurnStatus.waiting };

Hope of help!

【讨论】:

    猜你喜欢
    • 2023-03-14
    • 2023-03-16
    • 2016-08-19
    • 2014-10-31
    • 1970-01-01
    • 1970-01-01
    • 2016-01-20
    • 2021-08-27
    相关资源
    最近更新 更多