I’m new to Rasa, I have trained a bot locally and I would like to deploy it to my website. Just using PHP and nothing else, no docker, no nodejs, nothing else. I have a simple UI and so far I can call the chatbot via this function:
function processInputText($inptext)
{
//Send inptext to rasa-nlu http server and obtain the processed result.
$rasatext = file_get_contents("http://url.com/chatbot/model?q=" . urlencode($inptext));
//Decode the response text as a json array
$rasajson = json_decode($rasatext, true);
//Extract the intent
$rasa_intent = !empty($rasajson["topScoringIntent"]["intent"]) ? $rasajson["topScoringIntent"]["intent"] : '';
//Extract the entities
$rasa_entities = '';
if(!empty($rasajson["entities"]))
{
foreach ($rasajson["entities"] as $entity)
{
$rasa_entities = $rasa_entities . $entity["type"] . '=>' . $entity["entity"] . "<br>";
}
}
//Prepare a reponse text.
return '<b>Message: </b> ' . $inptext . '<br><b>Intent:</b> ' . $rasa_intent . '<br><b>Entities:</b><br>' . $rasa_entities;
}
However, no matter what I look I always find a way to deploy using something like docker or sockets or the like. Could anybody help me?
I don’t know if I need to deploy only the model or do something else and then put that online or what to do…
My folder structure is as follows:
/
├── chatbot
│ ├── assets
│ ├── chatbot.js
│ └── chatbot.css
├── chatbot.html
└── chatservice.php
I use my js to call the PHP which would then handle the call to the chatbot but no idea what I need to add there so it works. This happens by doing a simple AJAX call:
$.ajax({
url: './chatservice.php',
type: 'POST',
dataType: 'json',
contentType: 'application/json',
data: JSON.stringify({"msg":text}),
success: function (response)
{
//console.log(response.text);
insertChat("you", response.text);
},
error: function ()
{
insertChat("you", "error");
}
});
Which then inside the PHP file does:
function processInputText($inptext)
{
//Send inptext to rasa-nlu http server and obtain the processed result.
$rasatext = file_get_contents("http://url.com/chatbot/model?q=" . urlencode($inptext));
//Decode the response text as a json array
$rasajson = json_decode($rasatext, true);
.
.
.
}
It is here that I don’t know if I should upload the model or how can I get it to properly respond.