Giter Site home page Giter Site logo

debopriyobasu / wolframbot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from debopriyobasu-zz/wolframbot

0.0 0.0 0.0 270 KB

A chat-bot using Dialogflow and ReactJS that connects to the Wolfram Short Answers API to fetch main results of a query

JavaScript 64.48% Python 19.97% CSS 0.51% HTML 9.51% Dockerfile 5.53%

wolframbot's Introduction

WolframBot

What is it?

WolframBot is a chat-bot that connects to the Wolfram Short Answers API to fetch the main results of a query
This is the WolframBot in action

WolframBot.-.Hasura.Hub.mp4

How does it work?

Workflow

  • User opens the webpage.
  • User selects the Toggle Chat button.
  • The chat window pops up.
  • The bot is invoked when the user begins with a greeting to the Wolfram Alpha bot. It responds back with a simple greeting of its own.
  • To start the search query, the user must enter in one of the following prompts:

* The bot follows the prompt with one of the below responses:

* The user can now send in their query. As the bot makes a call to the Short Answers API, the user query must be such that a direct question is asked where the response is expected to be a direct answer. As such, queries such as the following are encouraged:
‘What is the distance to the moon?’
‘How much does the Earth weigh?’

Internal Implementation

The above query is recorded by the bot as a parameter and a specific action is tied to it. Here, the action is set to ‘query’. When the bot receives a query, the parameter is set as the question which user has asked. This action and parameter is sent to a web service which will receive a POST request from Dialogflow in the form of the response to a user query matched by intents with webhook enabled.
The web service is backed by Python code with Flask micro framework. A sample request from DialogFlow:

The program then extracts the request and processes it. The action is obtained and if the action matches ‘query’, then the program moves on to extract the parameters. The parameter consists of the user query, which is converted to a string and modified to be used in an URL. The base URL contains the base path to Wolfram Alpha’s services as well as the API ID. The user query is appended to the URL and the final URL sent to Wolfram Alpha. The response is recorded and then modified to be sent back to DialogFlow in a way that is understandable by the bot. A sample response looks like:
The bot is then able to extract the response and the plain text answer is conveyed to the user. The user can then wrap up the conversation by either thanking the bot or by sending in a goodbye prompt.

What does it use?

  1. ReactJS
  • react-detect-offline
  1. Dialogflow
  2. Python/Flask
  3. Wolfram Short Answers API
  4. Node Package Manager
  5. Material-UI v1 beta

Steps to clone

To clone and run the application in your system, follow the instructions below:

  • Open git bash on the directory you wish to install. You can right click on the directory in file explorer and select Git Bash Here or open the git bash and type
cd <your-directory-name-here-without-the-angled-brackets>

for example,if I want to go to the desktop,then I will type

cd desktop

the default directory opened when you open Git Bash is the root directory.

  • Now,you can proceed to clone the application using the following command:
git clone https://github.com/debopriyobasu/WolframBot.git
  • After the cloning is complete,traverse to the cloned app directory using the following command:
cd WolframBot/microservices/ui/app
  • Now, install the dependencies using the following command:
npm install

Please wait for a while as it will take some time to download all the dependencies depending on the speed of your internet connection.

  • Now, you are ready to start the application!
npm start

  • The app will be running at localhost:3000 unless it is being used by any other app.

Feedback and additional information

This project is a part of the HPDF group task for team 62. The participants are:
Debopriyo Basu - front-end dev
Chaitri S Mohan - back-end dev
Suraj Bhor - back-end dev
In case of any feedback or queries, feel free to mail me at [email protected]

wolframbot's People

Contributors

debopriyobasu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.