rasa - Rasa:创建自定义通道以通过 API 训练数据
问题描述
我现在有一个 rasa 应用程序,它运行得非常好。但是,我想使用 API(可能使用自定义通道)为我的聊天机器人训练更多数据。具体来说,我将通过 API 发送如下文件:nlu、story、domain,并将替换旧的数据文件。然后再次调用 API 激活 train 命令。
现在我有一个这样的自定义频道:
class MyBOT(InputChannel):
def name(cls) -> Text:
"""Name of your custom channel."""
return "mybot"
def blueprint(
self, on_new_message: Callable[[UserMessage], Awaitable[None]]
) -> Blueprint:
custom_webhook = Blueprint(
"custom_webhook_{}".format(type(self).__name__),
inspect.getmodule(self).__name__,
)
@custom_webhook.route("/", methods=["GET"])
async def health(request: Request) -> HTTPResponse:
return response.json({"status": "ok"})
@custom_webhook.route("/webhook", methods=["POST"])
async def receive(request: Request) -> HTTPResponse:
...
return response.json(collector.messages)
return custom_webhook
@custom_webhook.route("/custom/train", methods=["POST"])
async def health(request: Request) -> HTTPResponse:
# This is where I want to receive training data files from client side and replace existing data files.
return response.json({"status": "ok"})
但 rasa 似乎不知道我的 API /custom/train
。
有人有什么想法吗?
还是有另一种方法可以调用 API 来触发 rasa 命令?请帮我。
解决方案
推荐阅读
- python - 用python为分类树创建一个类
- android - 在递增之前等待下载图像
- java - Spring @value 不设置属性
- codeigniter - codeigniter 路由大体理解
- php - WooCommerce 产品列表过滤使用多个属性
- ios - Swift ARC 困惑
- mainframe - Quickjob MOVZON X'FF' 到 OFA1
- git - Implement Branching strategy in DevOps for Multi-Tenant application
- java - 在 tomcat 实时生产服务器上重新部署战争
- r - 如何在R中制作修剪直方图?