|
1 | | -<h1 align="center" style="border-bottom: none;">🚀 Watson Assistant Demo Sample Application</h1> |
| 1 | +<h1 align="center" style="border-bottom: none;">🚀 Watson Assistant Duo Demo</h1> |
| 2 | + |
| 3 | +[](https://travis-ci.org/watson-developer-cloud/assistant-demo) |
| 4 | + |
| 5 | +In this sample application, you're engaging with a banking virtual assistant. The assistant simulates a few scenarios, such as making a credit card payment, booking an appointment with a banker and choosing a credit card. Watson can understand your entries and respond accordingly. |
| 6 | + |
| 7 | + |
| 8 | +[](https://watson-assistant-demo.ng.bluemix.net) |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | +## Prerequisites |
| 13 | + |
| 14 | +1. Sign up for an [IBM Cloud account](https://cloud.ibm.com/registration). |
| 15 | +1. Download the [IBM Cloud CLI](https://cloud.ibm.com/docs/cli/index.html#overview). |
| 16 | +1. Create an instance of the Watson Assistant service and get your credentials: |
| 17 | + - Go to the [Watson Assistant][service_url] page in the IBM Cloud Catalog. |
| 18 | + - Log in to your IBM Cloud account. |
| 19 | + - Click **Create**. |
| 20 | + - Click **Show** to view the service credentials. |
| 21 | + - Copy the `apikey` value. |
| 22 | + - Copy the `url` value. |
| 23 | + |
| 24 | +## Configuring the application |
| 25 | + |
| 26 | +1. In the application folder, copy the *.env.example* file and create a file called *.env* |
| 27 | + |
| 28 | + ``` |
| 29 | + cp .env.example .env |
| 30 | + ``` |
| 31 | +
|
| 32 | +2. Open the *.env* file and add the service credentials that you obtained in the previous step. |
| 33 | +
|
| 34 | + Example *.env* file that configures the `apikey` and `url` for a Watson Assistant service instance hosted in the US East region: |
| 35 | +
|
| 36 | + ``` |
| 37 | + ASSISTANT_IAM_APIKEY=X4rbi8vwZmKpXfowaS3GAsA7vdy17Qh7km5D6EzKLHL2 |
| 38 | + ASSISTANT_URL=https://gateway-wdc.watsonplatform.net/assistant/api |
| 39 | + ``` |
| 40 | +
|
| 41 | +## Running locally |
| 42 | +
|
| 43 | +1. Install the dependencies |
| 44 | +
|
| 45 | + ``` |
| 46 | + npm install |
| 47 | + ``` |
| 48 | +
|
| 49 | +1. Run the application |
| 50 | +
|
| 51 | + ``` |
| 52 | + npm start |
| 53 | + ``` |
| 54 | +
|
| 55 | +1. View the application in a browser at `localhost:3000` |
| 56 | +
|
| 57 | +## Deploying to IBM Cloud as a Cloud Foundry Application |
| 58 | +
|
| 59 | +1. Login to IBM Cloud with the [IBM Cloud CLI](https://cloud.ibm.com/docs/cli/index.html#overview) |
| 60 | +
|
| 61 | + ``` |
| 62 | + ibmcloud login |
| 63 | + ``` |
| 64 | +
|
| 65 | +1. Target a Cloud Foundry organization and space. |
| 66 | +
|
| 67 | + ``` |
| 68 | + ibmcloud target --cf |
| 69 | + ``` |
| 70 | +
|
| 71 | +1. Edit the *manifest.yml* file. Change the **name** field to something unique. |
| 72 | + For example, `- name: my-app-name`. |
| 73 | +1. Deploy the application |
| 74 | +
|
| 75 | + ``` |
| 76 | + ibmcloud app push |
| 77 | + ``` |
| 78 | +
|
| 79 | +1. View the application online at the app URL. |
| 80 | +For example: https://my-app-name.mybluemix.net |
| 81 | +
|
| 82 | +
|
| 83 | +## Codebase Structure |
| 84 | +
|
| 85 | +```s |
| 86 | +Root |
| 87 | + /src |
| 88 | + index.js (React frontend index) |
| 89 | + /components |
| 90 | + /ExampleComponentDirectory |
| 91 | + ExampleComponent.js |
| 92 | + ExampleComponent.test.js |
| 93 | + /public |
| 94 | + index.html (served at the root route) |
| 95 | + /styles |
| 96 | + duo-grid.min.css (Duo grid styles) |
| 97 | + /js |
| 98 | + bundle.js (imports the root react component) |
| 99 | + /config |
| 100 | + Configuration files for Express backend |
| 101 | + /test |
| 102 | + Backend unit and integration tests |
| 103 | +index.js (express backend) |
| 104 | +server.js (main backend entry point) |
| 105 | +.config files |
| 106 | +package.json |
| 107 | +``` |
| 108 | + |
| 109 | +## License |
| 110 | + |
| 111 | +This sample code is licensed under Apache 2.0. |
| 112 | +Full license text is available in [LICENSE](LICENSE). |
| 113 | + |
| 114 | +## Contributing |
| 115 | + |
| 116 | +See [CONTRIBUTING](CONTRIBUTING.md). |
| 117 | + |
| 118 | +## Open Source @ IBM |
| 119 | + |
| 120 | +Find more open source projects on the |
| 121 | +[IBM Github Page](http://ibm.github.io/). |
| 122 | + |
| 123 | +[service_url]: https://www.ibm.com/cloud/watson-assistant/ |
| 124 | +[docs]: https://cloud.ibm.com/docs/services/assistant/index.html#about |
0 commit comments