-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
567 lines (463 loc) · 31.2 KB
/
index.html
File metadata and controls
567 lines (463 loc) · 31.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
<!DOCTYPE html>
<!--[if lt IE 7 ]><html class="ie ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]><html class="ie ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]><html class="ie ie8" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!-->
<html lang="en">
<!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<meta name="keywords" content="">
<title>NextGenShop dev guide</title>
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon">
<link rel="stylesheet" type="text/css" href="fonts/font-awesome-4.3.0/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="css/stroke.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="css/animate.css">
<link rel="stylesheet" type="text/css" href="css/prettyPhoto.css">
<link rel="stylesheet" type="text/css" href="css/style.css">
<link rel="stylesheet" type="text/css" href="js/syntax-highlighter/styles/shCore.css" media="all">
<link rel="stylesheet" type="text/css" href="js/syntax-highlighter/styles/shThemeRDark.css" media="all">
<!-- CUSTOM -->
<link rel="stylesheet" type="text/css" href="css/custom.css">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<button onclick="topFunction()" id="myBtn" title="Go to top"><i class="fa fa-chevron-up"
aria-hidden="true"></i></button>
<script>
var mybutton = document.getElementById("myBtn");
window.onscroll = function () { scrollFunction() };
function scrollFunction() {
if (document.body.scrollTop > 1000 || document.documentElement.scrollTop > 1000) {
mybutton.style.display = "block";
} else {
mybutton.style.display = "none";
}
}
function topFunction() {
window.scrollTo({ top: 0, behavior: 'smooth' })
document.documentElement.scrollTo({ top: 0, behavior: 'smooth' })
}
document.addEventListener("DOMContentLoaded", () => {
document.querySelector('#mode').addEventListener('click', () => {
document.querySelector('html').classList.toggle('dark');
})
});
</script>
<div id="wrapper">
<div id="mode">
<div class="dark">
<svg aria-hidden="true" viewBox="0 0 512 512">
<title>lightmode</title>
<path fill="currentColor"
d="M256 160c-52.9 0-96 43.1-96 96s43.1 96 96 96 96-43.1 96-96-43.1-96-96-96zm246.4 80.5l-94.7-47.3 33.5-100.4c4.5-13.6-8.4-26.5-21.9-21.9l-100.4 33.5-47.4-94.8c-6.4-12.8-24.6-12.8-31 0l-47.3 94.7L92.7 70.8c-13.6-4.5-26.5 8.4-21.9 21.9l33.5 100.4-94.7 47.4c-12.8 6.4-12.8 24.6 0 31l94.7 47.3-33.5 100.5c-4.5 13.6 8.4 26.5 21.9 21.9l100.4-33.5 47.3 94.7c6.4 12.8 24.6 12.8 31 0l47.3-94.7 100.4 33.5c13.6 4.5 26.5-8.4 21.9-21.9l-33.5-100.4 94.7-47.3c13-6.5 13-24.7.2-31.1zm-155.9 106c-49.9 49.9-131.1 49.9-181 0-49.9-49.9-49.9-131.1 0-181 49.9-49.9 131.1-49.9 181 0 49.9 49.9 49.9 131.1 0 181z">
</path>
</svg>
</div>
<div class="light">
<svg aria-hidden="true" viewBox="0 0 512 512">
<title>darkmode</title>
<path fill="currentColor"
d="M283.211 512c78.962 0 151.079-35.925 198.857-94.792 7.068-8.708-.639-21.43-11.562-19.35-124.203 23.654-238.262-71.576-238.262-196.954 0-72.222 38.662-138.635 101.498-174.394 9.686-5.512 7.25-20.197-3.756-22.23A258.156 258.156 0 0 0 283.211 0c-141.309 0-256 114.511-256 256 0 141.309 114.511 256 256 256z">
</path>
</svg>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-md-3">
<nav class="docs-sidebar" data-spy="affix" data-offset-top="300" data-offset-bottom="200"
role="navigation">
<ul class="nav">
<li><a href="#line1">Getting Started</a></li>
<li><a href="#line2">Conversational AI deployment</a></li>
<li><a href="#line3">Back-end deployment</a></li>
<li><a href="#line4">Front-end deployment</a>
<ul class="nav">
<li><a href="#line4_1">Standalone</a></li>
<li><a href="#line4_2">Browser extension</a></li>
<li><a href="#line4_3">Web component</a></li>
</ul>
</li>
<li><a href="#line5">Files & Sources</a></li>
</ul>
</nav>
</div>
<div class="col-md-9">
<section class="welcome">
<div class="row">
<div class="col-md-12 left-align">
<h2 class="dark-text">Introduction
<hr>
</h2>
<div class="row">
<div class="col-md-12 full">
<div>
<div class="row">
<div class="col-md-12 col-md-offset-0">
<div class="media">
<video width="100%" controls>
<source src="./videos/NextGenShop_ShortVideo_Demo.mp4" type="video/mp4">
</video>
</div>
</div>
</div>
<p></p>
<p><strong>NextGenShop</strong> is a system that allows users to shop online
by interacting with a virtual assistant. It aims to replicate a real
cashier that is able to understand speech input, generate appropriate
responses and perform actions based on user's intent. The complete
sourcecode for the project is available in our <a target="_blank"
rel="noopener noreferrer"
href="https://github.com/NextGenShop">GitHub repositories</a>.</p>
<p>This documentation is here to help you deploy, integrate and customize
the system for your particular needs. Please go through the
documentation carefully to understand how the system is built and how to
configure it properly.</p>
<h4 id="requirements">Requirements</h4>
<p>Deployment scripts used in the project were written and tested for Debian
based Linux operating systems. It is not guaranteed that this guide will
smoothly transition on to other platforms. Aditionally, to run the
system, you will need the following:</p>
<ol>
<li>An active <a target="_blank" rel="noopener noreferrer"
href="https://www.ibm.com/cloud">IBM Cloud</a> account</li>
<li><a target="_blank" rel="noopener noreferrer"
href="https://git-scm.com/book/en/v2/Getting-Started-Installing-Git">Git</a>
</li>
<li><a target="_blank" rel="noopener noreferrer"
href="https://packages.debian.org/en/sid/build-essential">build-essential</a>
packages</li>
<li><a target="_blank" rel="noopener noreferrer"
href="https://docs.docker.com/engine/install/">Docker</a> and <a
target="_blank" rel="noopener noreferrer"
href="https://docs.docker.com/compose/install/">Docker
Compose</a></li>
<li>Web Browser for testing (eg: Google Chrome)</li>
</ol>
</div>
</div>
</div>
<!-- end row -->
</div>
</div>
</section>
<section id="line1" class="section">
<div class="row">
<div class="col-md-12 left-align">
<h2 class="dark-text">Getting Started
<hr>
</h2>
</div>
<!-- end col -->
</div>
<!-- end row -->
<div class="row">
<div class="col-md-12">
<h4>Generate Speech to Text tokens</h4>
<p>Navigate to IBM Cloud <a
href="https://cloud.ibm.com/catalog/services/speech-to-text">Speech to Text
service</a> and create an instance that is suitable for your needs. Find the
newly created instance in your <a
href="https://cloud.ibm.com/resources">resources</a> and click on it to navigate
to the management page. There, you can find your auto-generated service credentials.
Download and save them in a private place. These will later be referred to as the
<strong>Speech to Text token</strong>.
</p>
<img src="images/guide/speech_to_text_tokens.png"
class="img-responsive img-thumbnail" />
<h4></h4>
<div class="intro2 clearfix">
<p><i class="fa fa-exclamation-triangle"></i> Do not expose your Speech to Text
token, since doing so will allow other people to use the service at your
expense.
<br> If needed, the token can be withdrawn and recreated in the Service
credentials tab.
</p>
</div>
<h4></h4>
<h4>Generate Text to Speech tokens</h4>
<p>Navigate to IBM Cloud <a
href="https://cloud.ibm.com/catalog/services/text-to-speech">Text to Speech
service</a> and
create an instance that is suitable for your needs. Find the newly created instance
in your <a href="https://cloud.ibm.com/resources">resources</a> and click on it to
navigate to the management page. There,
you can find your auto-generated service credentials. Download and save them in a
private place. These will later be
referred to as the <strong>Text to Speech token</strong>.</p>
<img src="images/guide/text_to_speech_tokens.png"
class="img-responsive img-thumbnail" />
<h4></h4>
<div class="intro2 clearfix">
<p><i class="fa fa-exclamation-triangle"></i> Do not expose your Text to Speech
token, since doing so will allow
other people to use the service at your expense.
<br> If needed, the token can be withdrawn and recreated in the Service
credentials tab.
</p>
</div>
<h4></h4>
<h4>Initiate the Watson Assistant</h4>
<p>Navigate to IBM Cloud <a
href="https://cloud.ibm.com/catalog/services/watson-assistant">Watson Assistant
service</a> and
create an instance that is suitable for your needs. Find the newly created instance
in your <a href="https://cloud.ibm.com/resources">resources</a> and click on it to
navigate to the management page. There,
you can find your auto-generated service credentials. Download and save them.
These will later be referred to as the <strong>Watson Assistant token</strong>.</p>
<p>To create a new assistant, press 'Launch Watson Assistant' and navigate to your Assistents page.</p>
<img src="images/guide/watson_assistant_tokens.png"
class="img-responsive img-thumbnail" />
<h4></h4>
<p>Press 'Create assistant', and give it an appropriate name (eg: NextGenShopper), then
click 'Create assistant' to finish.</p>
<img src="images/guide/assistant_create.png" class="img-responsive img-thumbnail" />
<h4></h4>
<p>For complete instructions and more information, see <a
href="https://cloud.ibm.com/docs/assistant?topic=assistant-getting-started">Getting
started with Watson Assistant guide</a>.</p>
</div>
<!-- end col -->
</div>
<!-- end row -->
</section>
<!-- end section -->
<section id="line2" class="section">
<div class="row">
<div class="col-md-12 left-align">
<h2 class="dark-text">Conversational AI deployment
<hr>
</h2>
</div>
<!-- end col -->
</div>
<!-- end row -->
<p>Conversational AI component is responsible for interpreting user queries and generating
appropriate responses. A basic dialogue tree for this component
has been provided, allowing the core of the Conversational AI to be set up with minimal
effort. Once imported this can be customised as necessary, including the implementation
of additional dialogues and modifications of existing responses.</p>
<h4>Import the dialogue tree</h4>
<p>Download the pre-made dialogue tree which will act as the core for the conversational AI <a
href="https://raw.githubusercontent.com/NextGenShop/nextgenshop-frontend/main/watsonAssistant/skill-Shopping-Assistant.json">here</a>,
or find it in our <a
href="https://github.com/NextGenShop/nextgenshop-frontend/blob/main/watsonAssistant/skill-Shopping-Assistant.json">front-end
repository</a>. Launch the assistannt service created in the previous step anc click the
'Skills' tab on the left of the window.</p>
<img src="images/guide/skills.png" class="img-responsive img-thumbnail" />
<h4></h4>
<p>Click 'Create skill' and select the 'Dialogue skill' option (it is important to select the
correct type of skill here, otherwise the import will not work as intended). Select 'Upload
skill tab' and upload the ''skill-Shopping-Assistant.json' file downloaded earlier.</p>
<img src="images/guide/skill_upload.png" class="img-responsive img-thumbnail" />
<h4></h4>
<p>Make sure to 'Import everything' when prompted to specify (this will make sure the custom
intents as well as
conversation flows are imported), then click 'Import' to finish.</p>
<p>For complete instructions and more information, see <a
href="https://cloud.ibm.com/docs/assistant-data?topic=assistant-data-skill-dialog-add">Adding
a dialog skill guide</a>.</p>
<h4>Link the dialogue tree with the assistant</h4>
<p>To link the dialogue tree to the assistant created earlier, launch the assistant created in
the first step (a named instance of the assistant, rather than just the
service itself), and click 'Add dialog skill'.</p>
<img src="images/guide/assistant_skills.png" class="img-responsive img-thumbnail" />
<h4></h4>
<p>Select the dialogue skill that imported in the previous step and confirm.</p>
<h4>Modify the dialogue skill</h4>
<p>The dialogue skill can be modified as necessary, allowing for customised repsonses or
additional conversational flows to
be added. For more information on how to do this see the <a
href="https://cloud.ibm.com/docs/assistant?topic=assistant-tutorial">IBM Watson
Assistant documentation</a>.</p>
</section>
<!-- end section -->
<section id="line3" class="section">
<div class="row">
<div class="col-md-12 left-align">
<h2 class="dark-text">Back-end deployment
<hr>
</h2>
</div>
<!-- end col -->
</div>
<!-- end row -->
<p>The Back-end service provides a RESTful API that allows the Front-end application and IBM Watson Assistant to make requests for certain resources
including the product catalogue and shopping basket data. It an be found in our <a href="https://github.com/NextGenShop/Backend_Django">GitHub repository</a>.</p>
<h4>Setup the environment</h4>
<p>Before running the back-end service, create a <strong>.env</strong> file in your <strong>Backend_Django/isolated_shopping/</strong> folder, and configure it as per example below.</p>
<ul>
<li>DEBUG = False or True to allow local deployment and additional logging</li>
<li>SECRET_KEY = </li>
<li>SPEECH_TO_TEXT_URL = can be found in the Speech to Text token created earlier</li>
<li>SPEECH_TO_TEXT_IAM_APIKEY = can be found in the Speech to Text token created earlier</li>
<li>TEXT_TO_SPEECH_URL = can be found in the Text to Speech token created earlier</li>
<li>TEXT_TO_SPEECH_IAM_APIKEY = can be found in the Text to Speech token created earlier</li>
<li>ASSISTANT_URL = can be found in the Watson Assistant token created earlier</li>
<li>ASSISTANT_IAM_APIKEY = can be found in the Watson Assistant token created earlier</li>
</ul>
<pre class="brush: shell highlight: [2,4]">
DEBUG=
SECRET_KEY=
SPEECH_TO_TEXT_URL=
SPEECH_TO_TEXT_IAM_APIKEY=
TEXT_TO_SPEECH_URL=
TEXT_TO_SPEECH_IAM_APIKEY=
ASSISTANT_URL=
ASSISTANT_IAM_APIKEY=
</pre>
<p>Optionally, set NEXTGENSHOP_BACKEND_PORT environment variable to configure the transport layer port at which your API will run <i>(80 is set by default)</i>.</p>
<pre class="brush: shell highlight: [2,4]">
export NEXTGENSHOP_BACKEND_PORT=80
</pre>
<p></p>
<h4>Configure the product catalogue</h4>
<p><strong>Backend_Django/isolated_shopping/MockSupermarketDataset.json</strong> contains a mock product catalogue. Edit this before running the service to fill the API with your own products. An example of the dataset file is shown below:</p>
<pre class="brush: js highlight: [2,4]">
{
{
"model": "product.ProductDB",
"pk": 1,
"fields": {
"name": "Large Eggs",
"price": 3.5,
"image": "mockImageUrl",
"retailer": "Mock Retailer",
"stock": 100
}
},
{
"model": "product.ProductDB",
"pk": 2,
"fields": {
"name": "Beef rump steak",
"price": 4,
"image": "https://images.com/photo-156078",
"retailer": "Mock Retailer",
"stock": 100
}
}
}
</pre>
<p></p>
<h4>Run the service</h4>
<p>GNU Make and Docker are used to pack the service. Assuming you have them installed, and have configured the environment variables, you can run the system on your machine with the following command.</p>
<pre class="brush: bash highlight: [2,4]">
make run
</pre>
<p></p>
<p>In case you need to install GNU Make and/or Docker, take a look at the <a href="#requirements">Requirements</a> section, or use the script from our <a href="https://github.com/NextGenShop/sso/blob/main/install_docker.sh">GitHub repository</a>.</p>
<p>For a detailed description of the datapoints made availale via our back-end service, take a look at our <a href="https://app.swaggerhub.com/apis-docs/bymi15/NextGenShopping/1.0.0">OpenAPI specification</a>.</p>
</section>
<!-- end section -->
<section id="line4" class="section">
<div class="row">
<div class="col-md-12 left-align">
<h2 class="dark-text">Front-end deployment
<hr>
</h2>
</div>
<!-- end col -->
</div>
<!-- end row -->
<p>The Front-end service is responsible displaying the artificial cashier component and handling user interactions. It communicates with the
back-end service via HTTP to call the product and basket API. The source code can be found in our <a href="https://github.com/NextGenShop/nextgenshop-frontend">GitHub repository</a>.</p>
<p>To allow for a more flexible configuration, three different deployment approaches are offered.</p>
<div class="row">
<h4 id="line4_1">Standalone deployment</h4>
<p>The standalone deployment functions as a self-sufficient web application that includes the complete functionality required for exploring available products and placing orders. It provides maximum flexibility in configuring the
user experience and data ownership. Since it implies that the system
exists in parallel and independently of the existing retail platforms,
this is the recommended approach in cases where the client decides
not to tailor the system for one single retailer.</p>
<img src="images/guide/standalone.png" class="img-responsive img-thumbnail" />
<h4></h4>
<p>Before running the front-end service, configure your back-end API endpints in <strong>nextgenshop-frontend/src/config/index.js</strong> as per example below.</p>
<pre class="brush: js highlight: [2,4]">
const prod = {
API_URL: "https://your-api-endpoint.com",
};
const dev = {
API_URL: "https://your-api-endpoint.com",
};
</pre>
<p></p>
<p>Optionally, set NEXTGENSHOP_FRONTEND_PORT environment variable to configure the transport layer port at which your app will run <i>(80 is set by default)</i>.</p>
<pre class="brush: shell highlight: [2,4]">
export NEXTGENSHOP_BACKEND_PORT=80
</pre>
<p></p>
<p>Then, deploy the front-end service on your local machine by running:</p>
<pre class="brush: shell highlight: [2,4]">
make start
</pre>
<p></p>
<p>Alternatively, the project can be compiled by running:</p>
<pre class="brush: shell highlight: [2,4]">
make build
</pre>
<p></p>
</div>
<div class="row">
<h4 id="line4_2">Browser extension</h4>
<p>empty</p>
<img src="images/guide/extension.png" class="img-responsive img-thumbnail" />
<h4></h4>
<p>empty</p>
</div>
<div class="row">
<h4 id="line4_3">Web component</h4>
<p>empty</p>
<img style="max-height:700px" src="images/guide/component.png" class="img-responsive img-thumbnail" />
<h4></h4>
<p>empty</p>
</div>
</section>
<!-- end section -->
<section id="line5" class="section">
<div class="row">
<div class="col-md-12 left-align">
<h2 class="dark-text">Files & Sources
<hr>
</h2>
</div>
<!-- end col -->
</div>
<!-- end row -->
</section>
<!-- end section -->
</div>
<!-- // end .col -->
</div>
<!-- // end .row -->
</div>
<!-- // end container -->
</div>
<!-- end wrapper -->
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/retina.js"></script>
<script src="js/jquery.fitvids.js"></script>
<script src="js/wow.js"></script>
<script src="js/jquery.prettyPhoto.js"></script>
<!-- CUSTOM PLUGINS -->
<script src="js/custom.js"></script>
<script src="js/main.js"></script>
<script src="js/syntax-highlighter/scripts/shCore.js"></script>
<script src="js/syntax-highlighter/scripts/shBrushXml.js"></script>
<script src="js/syntax-highlighter/scripts/shBrushBash.js"></script>
<script src="js/syntax-highlighter/scripts/shBrushCss.js"></script>
<script src="js/syntax-highlighter/scripts/shBrushJScript.js"></script>
</body>
</html>