I am working on a rasa chatbot. For training the chatbot, I added all the training data to the nlu.md
file. I added the stories to the stories.md
file. I configured the domain.yml
file and I also created a few custom actions that the bot should run when the user asks a particular question. Now I trained the chatbot using the rasa train command. This created a zipped file inside the models folder.
I started the NLU server with the following command
rasa run --enable-api -m models/nlu-20190919-171124.tar.gz
For the front end, I am using django to create a web appication for the chatbot.
This is the index.html
file
<form class="" action="" method="post">
{% csrf_token %}
<input type="text" name="message">
<button type="submit" name="button">Send</button>
</form>
When the user types a message in the input area and clicks send, this view should run
def index(request):
if request.method == 'POST':
user_message = request.POST['message']
response = requests.get("http://localhost:5005/model/parse",params={"q":user_message})
print(response)
return redirect('home')
else:
return render(request, 'index.html')
But when I click the send button, I get a 405 error
. This is the complete error message from the NLU-server
Traceback (most recent call last):
File "/Users/sashaanksekar/anaconda3/lib/python3.7/site-packages/sanic/app.py", line 893, in handle_request
handler, args, kwargs, uri = self.router.get(request)
File "/Users/sashaanksekar/anaconda3/lib/python3.7/site-packages/sanic/router.py", line 407, in get
return self._get(request.path, request.method, "")
File "/Users/sashaanksekar/anaconda3/lib/python3.7/site-packages/sanic/router.py", line 446, in _get
raise method_not_supported
sanic.exceptions.MethodNotSupported: Method GET not allowed for URL /model/parse
This is the message from my django server.
<Response [405]>
Not sure what I am doing wrong. I am following the steps indicated in the rasa documentation.