BotFramework Composer,技能回调时出现 404 错误

BotFramework Composer, getting 404 error on callback at the skill

重现步骤:

第 1 步:

使用 composer 创建一个机器人(v1.0.0 从 DMG 安装在 mac),选择 Echo Bot 模板。

第 2 步:

从当前 repo 克隆 echo 技能示例: https://github.com/microsoft/BotBuilder-Samples/tree/master/samples/python/80.skills-simple-bot-to-bot

第 3 步:

运行本地技能。

第 4 步:

连接到技能:

图片中的端点使用端口 3980,但在最后一次尝试时,主机器人由当前机器人上的作曲家提供服务。重点是我将回调 URL 设置为 URL,其中主要机器人 运行.

第 5 步:

未知意图对话框添加技能,回显响应后:

错误:

我解除技能方面的错误。技能调试后我发现问题出在回调 returns 404 error back to the skill on sending activity.

uring handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/victorvasiliev/PycharmProjects/BotBuilder-Samples/samples/python/80.skills-simple-bot-to-bot/echo-skill-bot/adapter_with_error_handler.py", line 71, in _send_eoc_to_parent
    await turn_context.send_activity(end_of_conversation)
  File "/usr/local/lib/python3.7/site-packages/botbuilder/core/turn_context.py", line 170, in send_activity
    result = await self.send_activities([activity_or_text])
  File "/usr/local/lib/python3.7/site-packages/botbuilder/core/turn_context.py", line 217, in send_activities
    return await self._emit(self._on_send_activities, output, logic())
  File "/usr/local/lib/python3.7/site-packages/botbuilder/core/turn_context.py", line 295, in _emit
    return await logic
  File "/usr/local/lib/python3.7/site-packages/botbuilder/core/turn_context.py", line 212, in logic
    responses = await self.adapter.send_activities(self, output)
  File "/usr/local/lib/python3.7/site-packages/botbuilder/core/bot_framework_adapter.py", line 686, in send_activities
    raise error
  File "/usr/local/lib/python3.7/site-packages/botbuilder/core/bot_framework_adapter.py", line 672, in send_activities
    activity.conversation.id, activity.reply_to_id, activity
  File "/usr/local/lib/python3.7/site-packages/botframework/connector/aio/operations_async/_conversations_operations_async.py", line 533, in reply_to_activity
    raise models.ErrorResponseException(self._deserialize, response)
botbuilder.schema._models_py3.ErrorResponseException: Operation returned an invalid status code 'Not Found'

有人遇到同样的问题吗?

您可以在 documentation 中看到您的技能主机端点需要以 api/skills 结尾,而不仅仅是 api:

Select Skills from the Composer menu. In the Skills page, if your skill is remote, enter <ngrok address>/api/skills in the Skill Host Endpoint field. If your skill is local, you should enter localhost:port/api/skills in the Skill Host Endpoint field.

技能主机端点在发送到技能的活动中用作服务 URL,这意味着它将成为技能调用的任何对话 API 方法的基础 URI。如果您的技能试图向不存在的 URL 发送请求,那么您应该会收到 404。 Composer bot 会将请求路由到以 api/skills 开头的路由,因此这就是您应该在服务中放置的内容 URL.