Skip to content

Commit fbf1284

Browse files
chore: merge changes from master
2 parents 936bfbf + fb0f453 commit fbf1284

6 files changed

Lines changed: 12607 additions & 33 deletions

File tree

README.md

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,15 @@
44

55
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.
66

7+
This app demonstrates the Watson Assistant service via a complete, complex interface which engages in simulated banking tasks. It utilises features such as:
8+
* Cloud Functions
9+
* Actions and UI Actions
10+
* Slots
11+
* Multi-Conditional Responses
12+
* Multi-Modal Responses
713

8-
[![Demo](./demo.gif)](https://watson-assistant-demo.ng.bluemix.net)
14+
15+
[![Demo](./readme_images/demo.gif)](https://watson-assistant-demo.ng.bluemix.net)
916

1017

1118

@@ -23,13 +30,27 @@ In this sample application, you're engaging with a banking virtual assistant. Th
2330

2431
## Configuring the application
2532

33+
1. In your IBM Cloud console, open the Watson Assistant service instance
34+
35+
1. Click the **Import workspace** icon in the Watson Assistant service tool. Specify the location of the workspace JSON file in your local copy of the app project:
36+
37+
`<project_root>/training/banking_workspace.json`
38+
39+
1. Select **Everything (Intents, Entities, and Dialog)** and then click **Import**. The car dashboard workspace is created.
40+
41+
1. Click the menu icon in the upper-right corner of the workspace tile, and then select **View details**.
42+
43+
1. Click the ![Copy](readme_images/copy_icon.png) icon to copy the workspace ID to the clipboard.
44+
45+
![Steps to get credentials](readme_images/assistant-demo.gif)
46+
2647
1. In the application folder, copy the *.env.example* file and create a file called *.env*
2748

2849
```
2950
cp .env.example .env
3051
```
3152
32-
2. Open the *.env* file and add the service credentials that you obtained in the previous step.
53+
1. Open the *.env* file and add the service credentials that you obtained in the previous step.
3354
3455
Example *.env* file that configures the `apikey` and `url` for a Watson Assistant service instance hosted in the US East region:
3556
@@ -38,6 +59,12 @@ In this sample application, you're engaging with a banking virtual assistant. Th
3859
ASSISTANT_URL=https://gateway-wdc.watsonplatform.net/assistant/api
3960
```
4061
62+
1. Add the `ASSISTANT_ID` to the previous properties
63+
64+
```
65+
ASSISTANT_ID=522be-7b41-ab44-dec3-g1eab2ha73c6
66+
```
67+
4168
## Running locally
4269
4370
1. Install the dependencies
@@ -56,7 +83,7 @@ In this sample application, you're engaging with a banking virtual assistant. Th
5683
5784
## Deploying to IBM Cloud as a Cloud Foundry Application
5885
59-
1. Login to IBM Cloud with the [IBM Cloud CLI](https://cloud.ibm.com/docs/cli/index.html#overview)
86+
1. Login to IBM Cloud with the [IBM Cloud CLI](https://cloud.ibm.com/docs/cli?topic=cloud-cli-ibmcloud-cli#overview)
6087
6188
```
6289
ibmcloud login
@@ -80,32 +107,6 @@ In this sample application, you're engaging with a banking virtual assistant. Th
80107
For example: https://my-app-name.mybluemix.net
81108
82109
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-
109110
## License
110111
111112
This sample code is licensed under Apache 2.0.
@@ -122,3 +123,6 @@ Find more open source projects on the
122123
123124
[service_url]: https://www.ibm.com/cloud/watson-assistant/
124125
[docs]: https://cloud.ibm.com/docs/services/assistant/index.html#about
126+
[demo_url]: http://assistant-demo.ng.bluemix.net/
127+
[doc_intents]: (https://cloud.ibm.com/docs/services/assistant?topic=assistant-intents#intents)
128+
[docs_landing]: (https://cloud.ibm.com/docs/services/assistant?topic=assistant-getting-started#getting-started)

readme_images/assistant-demo.gif

934 KB
Loading

readme_images/copy_icon.png

517 Bytes
Loading
File renamed without changes.

src/components/App.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -258,16 +258,18 @@ class App extends React.Component {
258258
this.updateMessageStatus(IN_PROGRESS);
259259

260260
fetchMessage(text, context, (err, data) => {
261-
if (err) {
261+
// data.code is set for an error response
262+
if (err || data.code !== undefined) {
262263
this.updateMessageStatus(FAILED);
263264

264265
this.updateChatList({
265266
type: 'bot',
266-
content: 'Could not connect to Watson Assistant',
267+
content: 'I\'m having trouble connecting to the server, please refresh the page.',
267268
});
268269

269-
console.log(err);
270-
throw new Error(err);
270+
const errorMsg = (err) || data;
271+
272+
throw new Error(errorMsg);
271273
}
272274
// update message status
273275
this.updateMessageStatus(COMPLETED);

0 commit comments

Comments
 (0)