我正在浏览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;
};
注意它所说的键=== merge并且记录器打印已弃用的部分。这是否意味着合并操作已弃用?如果是,那么处理多个故事的替代方法是什么?
答案 0 :(得分:0)
根据https://wit.ai/docs/http/20160526#post--converse-link,自2017年7月27日不推荐使用故事时,不推荐使用merge。 (https://wit.ai/blog/2017/07/27/sunsetting-stories)由于故事被弃用,因此无法处理多个故事;任何国家都必须由你保存,例如数据库。