Google Nest枢纽未显示链接按钮,但Actions Console模拟器为

时间:2019-07-28 18:19:05

标签: actions-on-google dialogflow-fulfillment

dialogflow模拟器正在按Google助手模拟器的预期显示基本卡对象的所有内容;但是Google Nest中心会显示除提供希望用户看到的链接的按钮以外的所有内容。我的回复正常,只是此按钮没有显示,这使我无法获得理想的结果。

我一直在尝试寻找为什么嵌套集线器可能不会显示卡片按钮,但它可能不是一个经过全面研究的区域。

    const functions = require('firebase-functions');
    const {dialogflow,BasicCard, Button,Image} = require('actions-on-google');
    const WELCOME_INTENT = 'Default Welcome Intent';
    const FALLBACK_INTENT = 'Default Fallback Intent';
    const CKD_MEALS_INTENT = 'ckdMealsIntent';
    const CKD_MEALS_TYPE_ENTITY = 'ckdMeals';
    
    
    
    
    
    
    const app = dialogflow();
    
    app.intent(WELCOME_INTENT, (conv) => {
        conv.ask("Welcome to the quote generator! Ask for a quote about happinness, friendship, or inspiration");
    });
    app.intent(FALLBACK_INTENT, (conv) => {
        conv.ask("I didn't understand your request");
    });
    app.intent(CKD_MEALS_INTENT, (conv) => {
        const meal_type = conv.parameters[CKD_MEALS_TYPE_ENTITY].toLowerCase();
        if (meal_type == "vegetarian") {
                   conv.ask("Here's a suggestion for a vegetarian meal:"); // this Simple Response is necessary
                   conv.ask(new BasicCard({
                        image: new Image({
                         url: 'https://user-images.githubusercontent.com/41710701/62001145-0ddf1580-b0af-11e9-84cf-607f6ef980c7.png', //url of your image.
                         alt: 'Image alternate text',
                     }),
             }));
        }
        else if (meal_type == "budget"){
                  conv.ask("Here's a suggestion for a budget meal:");
                  conv.ask(new BasicCard({
                  subtitle: 'This is a subtitle',
                  title: 'Beef Burritos',
                  buttons: new Button({
                    title: 'This is a button',
                    url: 'https://www.davita.com/diet-nutrition/recipes/beef-lamb-pork/beef-burritos',
                  }),
                  image: new Image({
                    url: 'https://user-images.githubusercontent.com/41710701/62010589-715e5700-b132-11e9-96e5-730b30d55d7e.jpg',
                    alt: 'Image alternate text',
                  }),
               
                }));
    
    
    
        }
        else if (meal_type == "easy"){
        conv.ask("Here's a suggestion for a easy-to-make meal:");
        }
        else{
        conv.ask("Life can only be understood backwards, but it must be lived forwards.");
        }
    });
    exports.dialogflowFirebaseFulfillment = functions.https.onRequest(app);

enter image description here

我希望不仅在动作调用模拟器上看到该按钮(该按钮上的链接起作用,并且在sim卡上的所有内容),在Google Nest Hub上也是如此。 嵌套集线器显示除按钮之外的所有内容,就这么简单。在模拟器中没有任何错误消息。

2 个答案:

答案 0 :(得分:4)

之所以显示该按钮,是因为您正在以电话查看模拟器。 使用代码时,模拟器会切换到智能显示视图。您将获得智能显示的响应,并且不显示该按钮。这意味着此阶段不支持智能显示器的按钮。

enter image description here

创建链接到URL的按钮的另一种方法是linkOut建议,但是正如Prisoner所述,由于智能显示器目前尚不完全支持浏览器,因此这些方法将不起作用。

答案 1 :(得分:0)

我面临着一个同样的问题,那就是Nest中心不显示按钮,也没有寻找答案。我的基本卡在DialogFlow中定义。根据Google的文档,基本卡应该可以像Nest Hub这样的智能显示器正常工作。您可以在此链接https://developers.google.com/actions/assistant/responses#nodejs中查看示例代码,并希望它对您的工作有所帮助。

关于, 徐彦祖