Botframework 视频上载未被确认为Bot Framework SDK 4中的附件
我昨天就有了这个代码。上传视频文件的简单请求,验证文件是否为视频格式,然后保存 视频提示为Botframework 视频上载未被确认为Bot Framework SDK 4中的附件,botframework,facebook-messenger,facebook-messenger-bot,Botframework,Facebook Messenger,Facebook Messenger Bot,我昨天就有了这个代码。上传视频文件的简单请求,验证文件是否为视频格式,然后保存 视频提示为 var promptOptions = { prompt: 'Upload a video', retryPrompt: 'The attachment must be a video file.' }; return await step.prompt(VID_PROMPT, promptOptions); 其中,VID_
var promptOptions = {
prompt: 'Upload a video',
retryPrompt: 'The attachment must be a video file.'
};
return await step.prompt(VID_PROMPT, promptOptions);
其中,VID_提示符是一个附件提示符:
this.addDialog(新附件提示符(VID_提示符,this.videoValidator))代码>
验证器,videoValidator的代码是:
async videoValidator(promptContext) {
//for back end cheking
console.log("\n\r Message Type:" + promptContext.context._activity.type);
console.log("\n\r Message:" + JSON.stringify(promptContext.context._activity.channelData.message));
/***************************/
if (promptContext.recognized.succeeded) {
var attachments = promptContext.recognized.value;
var validImages = [];
attachments.forEach(attachment => {
if (attachment.contentType === 'video/mp4' || attachment.contentType === 'video/x-msvideo' || attachment.contentType === 'video/mpeg' || attachment.contentType === 'video/3gpp' || attachment.contentType === 'video/3gpp2') {
validImages.push(attachment);
}
});
promptContext.recognized.value = validImages;
// If none of the attachments are valid videos, the retry prompt should be sent.
return !!validImages.length;
}
else {
await promptContext.context.sendActivity('No attachments received. Please attach video file.');
return false;
}
}
同样,这在昨天(使用相同的代码)效果很好,但今天,每当我上传视频时:
它将提示未收到任何附件。请从我的验证器中附加视频文件
所以我看了看后面,看到了:
这表示收到的消息不包含附件,当然AttachmentPrompt将看到这一点,promptContext.recognized.succeed将为false,从而在我的videoValidator中执行else子句
现在,我尝试上传一张图片,只是为了检查它是否能识别附件文件类型:
消息附件必须是视频文件。当它识别我上传了附件但文件类型不是视频时显示。这是后台数据:
我该如何解决这个问题。我没有改变任何事情,只是突然不起作用。请帮忙。谢谢
另外,我使用botbuilder 4.11.0
更新:我检查了directline频道,它工作正常。我想这在Facebook频道上不起作用吧
更新:现在,即使是图像也不会被识别为附件:(此问题与FB webhooks有关(目前正在工作)请参阅此线程: