![]() Here we need to take a pit stop and take a look at how the MessageParser and ActionProvider interacts to make our bot take action. Now we have the chatbot rendered to the screen and we can write in the input field and submit it to send a message to the chat. You should now see this on localhost:3000: Import MessageParser from './MessageParser' Import ActionProvider from './ActionProvider' When that's done, go back to your App.js file and add this code: import React from 'react' Put the config code in a file called config.js.Put the ActionProvider code in a file called ActionProvider.js.Put the MessageParser code in a file called MessageParser.js.For now, go here to get the boilerplate code to get started. Thirdly, it needs an ActionProvider class which will implement actions that we want to take based on parsing the message. Secondly, it needs a MessageParser class that must implement a parse method. First, it needs a config which must include an initialMessages property with chatbot message objects. The chatbot takes three props that must be included for it to work. You should see this in your development server now: Next head over to App.js and make these changes: import Chatbot from 'react-chatbot-kit' This should install the npm package and open the development server at localhost:3000. Initial setup // Run these commands from your command line I'm going to assume that you have Node installed, and access to the npx command. Or, if you are a visual learner, I created a tutorial on YouTube. If you want to take on this challenge on your own, you can go directly to the documentation (which is actually a chatbot). Something that makes you excited to get started when you sit down in front of your keyboard. Things you can show you friends and be proud of. One thing I've noticed on this journey is that it's a lot more fun to build things that are interesting, and that look good. I used the same philosophy to get good at programming. You need to do it again, and again and again. To become good at something, you need to do it a lot.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |