Giter VIP home page Giter VIP logo

chatbot's Introduction

Watson Assistant Basic starter kit

This Node.js app demonstrates the Watson Assistant service in a simple chat interface simulating a cognitive car dashboard.

Getting started

Running locally

The following steps are for running locally with Node.js. You can also run locally with Docker.

  1. To develop locally, first install Node.js (LTS supported versions).

  2. At the command line, go to your project directory.

  3. Install the dependencies:

    npm install
  4. Start the app:

    npm start
  5. Point your browser to localhost:3000.

Testing the app

After your app is installed and running, experiment with it to see how it responds.

The chat interface is on the left, and the JSON that the JavaScript code receives from the Watson Assistant service is on the right. Your questions and commands are interpreted using a small set of sample data trained with the following intents:

turn_on
turn_off
turn_up
turn_down
traffic_update
locate_amenity
weather
phone
capabilities
greetings
goodbyes

Type a request, such as music on or I want to turn on the windshield wipers. The system understands your intent and responds. You can see the details of how your input was understood by examining the JSON data in the Watson understands section on the right side.

For example, if you type Turn on some music, the JSON data shows that the system understood the turn_on intent with a high level of confidence, along with the appliance entity with a value of music.

  • Visit the documentation to learn more about intents and entities

  • Go to the tool to learn more about the Car Dashboard's intents, entities, and dialog.

    1. To launch the tool you need to return to your Project List and select your Watson Assistant Basic Project.
    2. Click on Train Service from the Service List, next to Watson Assistant.
    3. Log into the tool with your IBM Cloud login and password
    4. Click on the Car Dashboard workspace
    5. You will land on the Intents tab. Here you can view the intents such as turn_on, to modify these visit the documentation for the service.
    6. The next tab is where you can modify entities such as appliance. View the documentation to learn how to modify.
    7. The third tab is for modifying the dialog. You can learn more about modifying dialog in the documentation.

Modifying the app

After you have the app deployed and running, you can explore the source files and make changes. Try the following:

  • Modify the .js files to change the app logic.
  • Modify the .html file to change the appearance of the app page.
  • Use the Watson Assistant tool to train the service for new intents, or to modify the dialog flow. For more information, see the Watson Assistant service documentation.
  • Try creating your own bot with the tool:
    1. To launch the tool you need to return to your App List and select your Watson Assistant Basic Project.
    2. Click on Train Service from the Service List, next to Watson Assistant.
    3. Log into the tool.
    4. Follow the Getting started guide to create your own Watson Assistant workspace

Deploying to IBM Cloud as a CloudFoundry application

  1. To deploy your project to IBM Cloud, you will need to install the Bluemix CLI. Open a terminal and run the command that corresponds with your operating system:

    • MacOS

      sh <(curl -fsSL https://clis.ng.bluemix.net/install/osx)
    • Linux

      sh <(curl -fsSL https://clis.ng.bluemix.net/install/linux)
    • Windows Powershell

      Copy and paste the following command into a Windows PowerShell terminal console and execute it.

      iex(New-Object Net.WebClient).DownloadString('https://clis.ng.bluemix.net/install/powershell')
  2. Set your API endpoint. Check the top right corner of your IBM Cloud dashboard to determine which of the following Regions your account is set to, then run the corresponding command to set your API Endpoint.

    • US South:

      bx api https://api.ng.bluemix.net
    • Germany:

      bx api https://api.eu-de.bluemix.net
    • Sydney:

      bx api https://api.au-syd.bluemix.net
    • United Kingdom:

      bx api https://api.eu-gb.bluemix.net
  3. In your terminal go to your Project folder and run the following command to login to your IBM Cloud account with your IBM Cloud username and password.

    bx login
  4. Push the app to IBM Cloud:

    bx app push

    The app will be deployed using the settings in your project's manifest.yml file.

  5. Access your app at the URL specified in the command output.

    After your app is deployed, you can manage it from your IBM Cloud dashboard.

Managing your project in the Watson Console

Select your project from the Projects list in the Watson developer console. From the project page, you can do the following:

- Add additional services to your project
- View documentation and credentials for your project's services
- Configure a DevOps toolchain

Running locally with Docker

  1. Run the command that corresponds with your operating system to install the IBM Cloud Developer Tools CLI:

    • MacOS or Linux:

      curl -sL https://ibm.biz/idt-installer | bash
    • Windows 10:

      Set-ExecutionPolicy Unrestricted; iex(New-Object Net.WebClient).DownloadString('http://ibm.biz/idt-win-installer')
  2. Download and install Docker.

  3. If you installed any node dependencies into your project folder, remove them. Open a terminal and run the following command from your project folder, where your starter kit code is:

    rm -rf node_modules
  4. Build the Docker container:

    bx dev build

    The build may take a few minutes to complete.

  5. Run the Docker container:

    bx dev run
  6. Point your browser to localhost:3000.

License

This sample code is licensed under Apache 2.0.

Open Source @ IBM

Find more open source projects on the IBM Github Page

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.