代码之家  ›  专栏  ›  技术社区  ›  Vrijraj Singh

如何在简单意图对话框流中添加两个数字?

  •  0
  • Vrijraj Singh  · 技术社区  · 7 年前



    问题:添加5和6
    我的答案是:结果是5+6

    enter image description here

    但我得到了回应。

    Ans逻辑:结果是$number+$number1

    1 回复  |  直到 7 年前
        1
  •  0
  •   dedman    7 年前

    https://discuss.api.ai/t/start-conversation-with-user-programatically-from-the-server-side-api-ais-side-on-a-notification/1876/2

    它是一个API,用于为 对话界面。如果您有自定义业务逻辑或 平台特定的消息格式要求

    为此,您将需要打开实现,并在这一部分中获得在 action and parameters queryResult.parameters.<nameofparam> 把你的任务

    let num1 = parseInt(queryResult.parameters.number);
    let num2 = parseInt(queryResult.parameters.number1);
    let responseText =  {
        "fulfillmentText": "",
        "fulfillmentMessages": [],
        "source": "example.com",
        "payload": {},
        "outputContexts": [],
        "followupEventInput": {}
    };
    responseText.fulfillmentText = "" + num1 + num2;
    res.status(200).send(JSON.stringify(responseText));
    
    推荐文章