Closed s-mv closed 6 years ago
That error usually means it didn't load any replies. Run it in debug mode (new RiveScript({debug: true})
) and see if it's reading the .rive
files correctly.
Thanks, I'll check it out!
On Wed, Apr 4, 2018, 22:01 Noah Petherbridge notifications@github.com wrote:
That error usually means it didn't load any replies. Run it in debug mode (new RiveScript({debug: true})) and see if it's reading the .rive files correctly.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/aichaos/rivescript-js/issues/259#issuecomment-378663399, or mute the thread https://github.com/notifications/unsubscribe-auth/AfDeEmbfJFJgvJeNgyxk78ivf7Q86nVHks5tlPV7gaJpZM4TGbwP .
Hi! The error continues... Let's see: my index.html -
<html>
<head>
<script src="libs/rivescript.min.js" type="text/javascript"></script>
<script src="main.js" type="text/javascript"></script>
<noscript>Sorry, JavaScript is needed</noscript>
<title></title>
</head>
<body>
<header></header>
<div id="chatlogs" style="height:70vh;">
</div>
<input placeholder="Type some text" >
<button>Send</button>
</body>
</html>
main.js -
window.onload = function(){
var bot = new RiveScript({debug: true});
bot.loadFile("brain.rive", brainReady, brainError);
function brainReady() {
console.log('Chatbot ready!');
bot.sortReplies();
var reply = bot.reply('local-user', 'set ');
}
function brainError() {
console.log('Chatbot error!')
}
var button = document.querySelector('button');
var input = document.querySelector('input');
var output = document.querySelector('#chatlogs');
button.addEventListener("click",chat);
function chat() {
var reply = bot.reply("local-user", input.value);
output.textContent = reply;
}
}
The markdown doesn't work nicely on the phone!
I tried other browsers, but all show the error
It isn't working on itch.io too...
Use the browser console's Network tab and see if the ajax request to load brain.rive
went through okay. Also the browser console should log a lot of stuff as it parses brain.rive
-- listing every line it reads and what it's doing with it. If you don't see the debug logging, it may mean it isn't able to get the file (wrong file path, permission problem, etc.)
Also if you were testing it by double-clicking the index.html
to open the web page locally, that won't work, as browsers block ajax requests from local pages trying to access local files for security purposes.
I am not using any external library and pure JavaScript, but it says that the topic random was not found...