我现在有一个 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 命令吗?请帮帮我。