I wiuld like to create a chatbot from this tutorial, but it seems that the Rasa version is too old and suddenly the commands do not work.
I know how to recover and respond to messages through Slack, but I do not know how to do it from a web application that I develop with a chat interface.
With Slack, I launched the following script:
from rasa_core.channels import HttpInputChannel
from rasa_core.agent import Agent
from rasa_core.interpreter import RasaNLUInterpreter
#from rasa_slack_connector import SlackInput
nlu_interpreter = RasaNLUInterpreter('./models/nlu/default/moodnlu')
agent = Agent.load('./models/dialogue',interpreter = nlu_interpreter)
# With Slack
# https://api.slack.com/apps/AASPDV196/oauth?
#input_channel = SlackInput('OAuth Access Token','Bot User OAuth Access Token', 'Verification Token',True)
#agent.handle_channel(HttpInputChannel(5004,'/',input_channel))
# With inner app
input_channel = SlackInput('OAuth Access Token','Bot User OAuth Access Token', 'Verification Token',True)
agent.handle_channel(HttpInputChannel(5000,'/',input_channel))
I know I have to modify input_channel
so that he hears in the right port, but I really do not know how.
Here is where HttpInputChannel comes from
If you have the dialog model and nlu model ready, you can run Rasa core like this
$python -m rasa_core.server -d <DIALOGUE_MODEL_PATH> -u <NLU_MODEL_PATH> --debug -o out.log --cors *
and then in a different terminal, do below and you will get a response
$curl -XPOST localhost:5005/conversations/default/respond -d '{"query":"Hello"}'
If sender id matters to you, then below command if you want to pass nad
as a sender id
$curl -XPOST localhost:5005/conversations/nad/respond -d '{"query":"Hello"}'
Works for NLU version 0.12.3
and Core version 0.9.0a6
UPDATE: If you are trying to build an UI around it
Run below in a terminal
$python -m rasa_core.server -d <DIALOGUE_MODEL_PATH> -u <NLU_MODEL_PATH> --debug -o out.log --cors *
In your server
import requests
import json
data = '{"query":"hello"}'
response = requests.post('http://localhost:5005/conversations/default/respond', data=data)
json_response = response.json()
print (json_response[0]['text'])
This should output the reply of hello
in your terminal.