0.1.1 • Published 5 years ago

lmfr-openlab-angular-chatbot-module v0.1.1

Weekly downloads
401
License
-
Repository
-
Last release
5 years ago

Lmfr-Openlab-Angular-Chatbot-Module

Integrate library into angular application

Install firebase dependency required by the module

npm i firebase --save
npm i ngx-cookie --save 
npm i @nguniversal/express-engine --save 
npm install @agm/core --save 
ng add @angular/material 

In app.module.ts :

import {LmfrOpenlabAngularChatbotModule} from 'lmfr-openlab-angular-chatbot-module';

Bot initlization data

const chatbotConfig = {
name: 'Bot api name ',
displayName: 'Bot display name',
token: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXX',
expression: 'first expression', // To wake up the bot
apiUrl: 'https://api.cai.tools.sap/build/v1/dialog' ,
clientApiKey: 'PUBLIC_LMFR_API_KEY'
//Si Dialogflow => fournir l'url de l'instance lmfr-openlab-support-client-chatbot-backend/df/detect
type: 'recast' // ou bien 'dialogflow',
project: 'id du project DF' ,
firebaseConfig : fbConfig ,
shouldShowSummaryPannel: shouldShowSummaryPannelOption,
errorMessageText: 'Arf ... Je ne sais pas quoi répondre'

};

Optional config for vote tracking on firebase

const fb = {
apiKey: '.............................',
authDomain: '.........................',
databaseURL: '.....................',
projectId: '...................',
storageBucket: '................',
messagingSenderId: '...........',
appId: '..................................'
};

Configuation of the summary pannel

const shouldShowSummaryPannelOption = false  // default value is true ;
imports: [
...,
LmfrOpenlabAngularChatbotModule.forRoot(chatbotConfig), 
  
...
]

In footer componant html file : <lib-lmfr-openlab-angular-chatbot-module></lib-lmfr-openlab-angular-chatbot-module> OR

<lib-lmfr-openlab-angular-chatbot-module <br>
(activateBotEvent)="onActivateBotEvent()" (hideBotEvent)="onhideBotEvent()"<br>
(resetBotEvent)="onResetBotEvent()" (rateThumbUpEvent)="onRateThumbUpEvent()"<br>
(rateThumbDownEvent)="onRateThumbDownEvent()"<br>
(userSentMessageEvent)="onUserSentMessageEvent($event)"<br>
(botRespondedEvent)="onBotRespondedEvent($event)"></lib-lmfr-openlab-angular-chatbot-module>;

Events triggerged :

onActivateBotEvent() {} 

onhideBotEvent() {} 

onResetBotEvent() {} 

onRateThumbUpEvent() {} 

onRateThumbDownEvent() {}

onUserSentMessageEvent(messsage: Message[]) {}

onBotRespondedEvent(messsage: Message[]) {}

Summary panel:

A panel containing summary on what the bot can do . To use it , set shouldShowSummaryPannel = true ; create intention in your agent "get-resume" that responde with a custom payload :

<head>
...
<link href="assets/lmfr-openlab-angular-chatbot-module.css" rel="stylesheet">
</head>

if summary feat is used edit css to make it pretty

IAdvize

Intercept "botRespondedEvent" and call method onBotRespondedEvent:

onBotRespondedEvent(messsage: Message[]) {
if (messsage.length > 0) {
      if (messsage[messsage.length - 1].intent === 'talk.human') {
        console.log('calling iadvize');
        try {
          // @ts-ignore
          window.idzCustomData = messsage;
          // @ts-ignore
          tc.event();
        } catch (e) {
          console.log('error invok iadvize');
          console.log(e);
        }
      }
    }
}

Acces to library functions

Here is an example on how to activate and hide the bot without clic on icon:

if (LmfrOpenlabAngularChatbotComponent.instance.botService.bot.isMinimised) {
   LmfrOpenlabAngularChatbotComponent.instance.onActivateClick();
} else {
   LmfrOpenlabAngularChatbotComponent.instance.onCloseClick();
}
0.1.1

5 years ago

0.1.0

5 years ago

0.0.98

5 years ago

0.0.99

5 years ago

0.0.97

5 years ago

0.0.96

5 years ago

0.0.95

5 years ago

0.0.94

5 years ago

0.0.93

5 years ago

0.0.91

5 years ago

0.0.90

5 years ago

0.0.89

5 years ago

0.0.88

5 years ago

0.0.84

5 years ago

0.0.85

5 years ago

0.0.86

5 years ago

0.0.87

5 years ago

0.0.80

5 years ago

0.0.81

5 years ago

0.0.82

5 years ago

0.0.83

5 years ago

0.0.73

5 years ago

0.0.74

5 years ago

0.0.75

5 years ago

0.0.76

5 years ago

0.0.77

5 years ago

0.0.78

5 years ago

0.0.79

5 years ago

0.0.72

5 years ago

0.0.70

5 years ago

0.0.71

5 years ago

0.0.68

5 years ago

0.0.69

5 years ago

0.0.67

5 years ago

0.0.66

5 years ago

0.0.65

5 years ago

0.0.64

5 years ago

0.0.63

5 years ago

0.0.62

5 years ago

0.0.61

5 years ago

0.0.60

5 years ago

0.0.59

5 years ago

0.0.58

5 years ago

0.0.57

5 years ago

0.0.56

5 years ago

0.0.54

5 years ago

0.0.55

5 years ago

0.0.53

5 years ago

0.0.51

5 years ago

0.0.52

5 years ago

0.0.50

5 years ago

0.0.49

5 years ago

0.0.48

5 years ago

0.0.47

5 years ago

0.0.45

5 years ago

0.0.46

5 years ago

0.0.44

5 years ago

0.0.43

5 years ago

0.0.42

5 years ago

0.0.41

6 years ago

0.0.40

6 years ago

0.0.39

6 years ago

0.0.38

6 years ago

0.0.37

6 years ago

0.0.36

6 years ago

0.0.35

6 years ago

0.0.33

6 years ago

0.0.34

6 years ago

0.0.32

6 years ago

0.0.31

6 years ago

0.0.30

6 years ago

0.0.29

6 years ago

0.0.28

6 years ago

0.0.21

6 years ago

0.0.22

6 years ago

0.0.23

6 years ago

0.0.24

6 years ago

0.0.25

6 years ago

0.0.26

6 years ago

0.0.27

6 years ago

0.0.20

6 years ago

0.0.17

6 years ago

0.0.18

6 years ago

0.0.19

6 years ago

0.0.16

6 years ago

0.0.15

6 years ago

0.0.14

6 years ago

0.0.13

6 years ago

0.0.12

6 years ago

0.0.11

6 years ago

0.0.10

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago