npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

lmfr-openlab-angular-chatbot-module

v0.1.1

Published

Install firebase dependency required by the module <br />

Downloads

15

Readme

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 ;

Add LmfrOpenlabAngularChatbotModule to imports

imports: [
...,
LmfrOpenlabAngularChatbotModule.forRoot(chatbotConfig), 
  
...
]

Copy /lmfr-openlab-angular-chatbot-module/projects.lmfr-openlab-angular-chatbot-module/src/assets/chatbot folder to your assets folder

Usage:

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 :

{
    "type": "summary",
    "elements": [
     {
        "type": "image",
        "value": "https://firebasestorage.googleapis.com/v0/b/portal-bot-19e73.appspot.com/o/uploads%2Ftenor.gif?alt=media&token=372824a2-fb29-451f-8f1a-54e7ac046fa4",
        "title": "Funny gif",
        "icon": ""
      },
      {
        "type": "html",
        "value": "cosutom html  value ",
        "title": "Funny gif",
        "icon": ""
      },
      {
        "type": "button",
        "value": "Action 1",
        "title": "Do Action 1",
        "icon": ""
      },
      {
        "type": "button",
        "value": "Action 2",
        "title": "Do Action 2",
        "icon": ""
      },
      {
        "type": "button",
        "value": "Action 3",
        "title": "Do Action 3",
        "icon": ""
      },
      {
        "type": "button_list",
        "value": [
                    {
                        "type": "button",
                        "value": "Action 1",
                        "title": "Do Action 1",
                        "icon": ""
                    },
                    {
                        "type": "button",
                        "value": "Action 2",
                        "title": "Do Action 2",
                        "icon": ""
                    },
                    {
                        "type": "button",
                        "value": "Action 3",
                        "title": "Do Action 3",
                        "icon": ""
                    }
                ],
        "title": "Do Action 2",
        "icon": ""
      }
        ]
}

Add css

download the default css file from : https://github.com/adeo/lmfr-openlab-angular-chatbot-module/blob/master/external-css-file/lmfr-openlab-angular-chatbot-module.css Apply your modifications link it on the project index.html file at the closing of head tag

<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();
}