gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 04:09:28 24 4
gpt4 key购买 nike

重现步骤:

第 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 步:

在本地运行技能。

第四步:

连接到技能:

enter image description here

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

第 5 步:

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

错误:

解除技能面的错误。调试技能后,我发现问题出在回调中,该回调将 404 错误返回给发送事件的技能。

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 机器人会将请求路由到以 api/skills 开头的路由所以这就是您应该放入服务 URL 的内容。

关于python - BotFramework Composer,技能回调时出现 404 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62002526/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com