【问题标题】:alternative to wit.ai merge since it is deprecated nowwit.ai merge 的替代品,因为它现在已被弃用
【发布时间】:2016-11-22 16:17:46
【问题描述】:

我在浏览node-wit的代码时遇到了这个

const validateActions = (logger, actions) => {
  if (typeof actions !== 'object') {
    throw new Error('Actions should be an object. ' + learnMore);
  }
  if (!actions.send) {
    throw new Error('The \'send\' action is missing. ' + learnMore);
  }

  Object.keys(actions).forEach(key => {
    if (typeof actions[key] !== 'function') {
      logger.warn('The \'' + key + '\' action should be a function.');
    }

    if (key === 'say' && actions[key].length > 2 ||
      key === 'merge' && actions[key].length > 2 ||
      key === 'error' && actions[key].length > 2
    ) {
      logger.warn('The \'' + key + '\' action has been deprecated. ' + learnMore);
    }

    if (key === 'send') {
      if (actions[key].length !== 2) {
        logger.warn('The \'send\' action should accept 2 arguments: request and response. ' + learnMore);
      }
    } else if (actions[key].length !== 1) {
      logger.warn('The \'' + key + '\' action should accept 1 argument: request. ' + learnMore);
    }
  });

  return actions;
};

注意它说 key===merge 和记录器打印已弃用的部分。这是否意味着不推荐使用合并操作?如果是,处理多个故事的替代方法是什么?

【问题讨论】:

    标签: bots chatbot wit.ai


    【解决方案1】:

    根据https://wit.ai/docs/http/20160526#post--converse-link,自 2017 年 7 月 27 日起,合并已被弃用,故事已被弃用。 (https://wit.ai/blog/2017/07/27/sunsetting-stories) 而且由于故事已被弃用,因此无法处理多个故事;任何状态都必须由您保存,例如通过一个数据库。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-05-11
      • 1970-01-01
      • 1970-01-01
      • 2022-12-14
      • 1970-01-01
      • 2017-02-13
      • 1970-01-01
      相关资源
      最近更新 更多