【问题标题】:MS BOT Framework: AttachmentsMS BOT 框架:附件
【发布时间】:2018-08-28 13:13:40
【问题描述】:

我正在尝试使用站点中的示例在 MS Bot Framework 中处理附件:

function(session) {
  console.log('here')
  builder.Prompts.text(session, "Please upload the latest report now")
},
function(session, results) {
  console.log(session)
  var msg = session.message;
  if (msg.attachments && msg.attachments.length > 0) {
    // Echo back attachment
    var attachment = msg.attachments[0];
    session.send({
      text: "You sent:",
      attachments: [{
        contentType: attachment.contentType,
        contentUrl: attachment.contentUrl,
        name: attachment.name
      }]
    });
  } else {
    // Echo back users text
    session.send("You said: %s", session.message.text);
  }
}

这在您输入文本时有效,但在您附加(通过机器人模拟器中的选项)图像或电子表格时无效。我不知道为什么这不起作用:(

编辑 1:因此,当您添加图像时,控制台会记录

/ - Session.beginDialog(siteOwnerRefresh:/)

.siteOwnerRefresh:/ - 瀑布()第 1 步,共 2 步

.siteOwnerRefresh:/ - Session.beginDialog(BotBuilder:prompt-text)

..BotBuilder:prompt-text - Session.send()

..BotBuilder:prompt-text - Session.sendBatch() 发送 1 条消息

警告:ChatConnector:接收 - 模拟器在未启用安全性的情况下运行。

ChatConnector:收到消息。

UniversalBot("*") 从“模拟器”路由 1 个附件

Library("BotBuilder").findRoutes() 解释:

ActiveDialog(0.1)

..BotBuilder:prompt-text - WARN: Prompt - no intent handler found for null

..BotBuilder:prompt-text - Session.send()

..BotBuilder:prompt-text - Session.sendBatch() 发送 1 条消息

【问题讨论】:

  • 显示有错误吗?
  • 尝试重启机器人模拟器。有时这可以解决问题。

标签: node.js bots


【解决方案1】:

事实证明,该机器人无法从级联的第二步开始工作。我把它移了出来,这是级联的第一步,现在可以工作了。

【讨论】:

    【解决方案2】:

    在 builder.Prompts.text() 之后它只收到一条短信。 使用 builder.Prompts.attachment 接收附件。 https://docs.microsoft.com/en-us/azure/bot-service/nodejs/bot-builder-nodejs-dialog-prompt

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-07-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-02-13
      相关资源
      最近更新 更多