Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
a846cd0
Fixed input and transcription resetting upon changing topic
DemonicMushy Jun 24, 2020
84e4a7f
Google speech to text now uses Enhanced Model.
DemonicMushy Jun 25, 2020
b7a4d19
Changed Question Topic position on webpage.
DemonicMushy Jul 5, 2020
0eef6de
Added Rushi chatbot.
DemonicMushy Jul 15, 2020
638974e
Fully fixed previous issue where one client's speech to text will be …
DemonicMushy Jul 22, 2020
0217d41
Updated gitignore for python venv files. Flaskservice requirements fo…
Jul 31, 2020
e5fd57e
Added comcare topic
DemonicMushy Aug 21, 2020
f305c49
Fixed name uppercase
DemonicMushy Aug 21, 2020
2251e06
Code cleanup
DemonicMushy Aug 21, 2020
c5fcac5
Removed test questions files
DemonicMushy Aug 21, 2020
09cbcbf
Generalised answering model jsx
DemonicMushy Aug 25, 2020
f961105
Removed DNN from code since unused.
DemonicMushy Aug 26, 2020
8df02ee
Starting on FAQ answering model page
DemonicMushy Sep 8, 2020
70c563b
Update
DemonicMushy Sep 9, 2020
dfc946d
Update on 10 Sep
DemonicMushy Sep 10, 2020
fda069b
Update on backend
DemonicMushy Sep 10, 2020
a5948fb
Merge branch 'dev' of github.com:DemonicMushy/chatbot_web_framework i…
DemonicMushy Sep 10, 2020
97721d9
update on 13 sep
DemonicMushy Sep 13, 2020
361341b
Added adoption faq.
DemonicMushy Sep 13, 2020
85cbc8c
Changes to frontend work in progress
Sep 14, 2020
c546b73
Updated UI. Added similar questions feature. CSS fixes for handling d…
DemonicMushy Sep 15, 2020
0f5422c
Merge branch 'master' into dev
DemonicMushy Sep 16, 2020
4d4a512
Update 21st Sep. Context 'Questions' now fully functional.
DemonicMushy Sep 21, 2020
4968c9e
Update 24 Sep. Feature to add and remove topics. Improved CSS styling…
DemonicMushy Sep 24, 2020
8ce0bb9
Removed dependency on requests module. Update other dependencies.
DemonicMushy Sep 24, 2020
368f760
Merge branch 'master' into dev
DemonicMushy Sep 28, 2020
1024b76
Update 30 Sep. Added alternative phrasing for questions.
DemonicMushy Sep 30, 2020
2922e10
Fix minor bug
DemonicMushy Sep 30, 2020
abfae5c
Updated README.md
DemonicMushy Oct 2, 2020
2272b2b
Refactored code
DemonicMushy Oct 8, 2020
3ead631
Code refactoring of Record.js and other small fixes. Changes to conne…
DemonicMushy Oct 14, 2020
afb1f24
Removed Report
DemonicMushy Oct 14, 2020
df69e98
Python script to make AskJamie requests no longer needed. AskJamie re…
DemonicMushy Oct 22, 2020
3bd0dc4
Fixed similiarity function call referencing stale state variables.
DemonicMushy Oct 22, 2020
9c51745
Merge branch 'dev2'
DemonicMushy Oct 22, 2020
2f4bf96
Added rushi's updated bot
DemonicMushy Nov 6, 2020
dacdf6c
Updated Bani
DemonicMushy Nov 12, 2020
86aa513
Refactoring of code, removal of comparison
DemonicMushy Nov 25, 2020
218a9a4
Added Docker related files. In future, docker branch will no longer b…
DemonicMushy Nov 30, 2020
a670a66
Change backend to use MongoDb for faq data storage. Changes to fronte…
DemonicMushy Dec 2, 2020
93ea015
Update to use @google-cloud/dialogflow package
DemonicMushy Dec 4, 2020
919e840
Updated README.md
DemonicMushy Dec 9, 2020
040580b
Bani route no longer sends a topic field
DemonicMushy Dec 9, 2020
6dfb06f
Added chat widget for Bani Bot
DemonicMushy Dec 18, 2020
62fc930
chore: change name
DemonicMushy Jan 21, 2021
d4bb4b1
chore: update .gitignore
DemonicMushy Jan 21, 2021
58c1f02
fix: widget containeer size fix for mobile view
DemonicMushy Jan 22, 2021
28aef1a
Update 1 for intent-management
DemonicMushy Jan 22, 2021
cab499e
Update Dockerfile
DemonicMushy Jan 22, 2021
6df539b
Added .dockerignore for frontend and backend files
DemonicMushy Jan 22, 2021
9f12eb8
Update to docker-compose to work for deploying intent-management cont…
DemonicMushy Mar 5, 2021
d90e92c
fix: error handling for google's services now that I have no gcloud b…
DemonicMushy Jun 13, 2021
53fbb04
chore: update some env variables in docker-compose.yml
DemonicMushy Jun 13, 2021
6c4ff25
amended frontend dashboard to use model API
knwkx Aug 24, 2021
0a2fca4
Performance analysis API call changed
knwkx Aug 24, 2021
f97a16f
Display Score
knwkx Sep 11, 2021
a9eefae
Update
knwkx Sep 27, 2021
534a624
Merge remote-tracking branch 'karen-repo/main' into dev
DemonicMushy Oct 2, 2021
92e0edd
fix typo in dockerfile
DemonicMushy Oct 2, 2021
04e5e71
fix dotenv remove from dev dependencies
DemonicMushy Oct 2, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ node_modules/
#backend
gcloud/
keys/
data/

#intent-management
dist/

#dataConstruction directory
permutations/
Expand All @@ -14,10 +18,17 @@ training_data

#python directory
__pycache__/
bin/
!backend/bin/
include/
lib/
share/
others/
pyvenv.cfg
lib64

#optional
.env
.vscode/
.idea/
.DS_Store
3 changes: 0 additions & 3 deletions .vscode/settings.json

This file was deleted.

42 changes: 30 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Chatbot Web Framework for Response Comparisons and Performance Analysis in FAQs

## Project Summary
The objective of this project is to design a full stack web application to compare a variable set of FAQ Chatbot API endpoints. The chatbot platform includes a text input and a speech input for intuitiveness and to cater for real live scenarios. For the context of this project, MSF's Baby Bonus is used as a test bed for FAQ question and answer matching.<br/>
The objective of this project is to design a full stack web application to compare a variable set of FAQ Chatbot API endpoints. The chatbot platform includes a text input and a speech input for intuitiveness and to cater for real live scenarios. For the context of this project, MSF's Baby Bonus and other topics are used as a test bed for FAQ question and answer matching.<br/>

## Features
1. Text and Speech based input methods<br/>
Expand All @@ -13,24 +13,21 @@ The objective of this project is to design a full stack web application to compa
1. Govtech's askJamie (Benchmark for accuracy comparison)<br/>
2. MICL lab's QA Matching Model<br/>
3. Google's Dialogflow<br/>
4. Text Classification Model<br/>
5. Rajat QA Matching Model<br/>
4. Rajat QA Matching Model<br/>
5. Rushi's QA Matching Model<br/>

### Speech to Text API used
1. AISG's Speech to Text<br/>
2. Google's Speech API<br/>
3. Twilio Speech Lab (To be implemented)<br/>


## Deployment Considerations
Docker is used to set up 3 microservices React Frontend, Node Backend and Flask Server for response comparison. A docker-compose file is used to start up all microservices for deployment usage. Docker deployment resources can be found in the Docker branch of the repository.
Docker is used to set up 3 microservices React Frontend and NodeJs Backend. A docker-compose file is used to start up all microservices for deployment usage. Docker deployment resources can be found in the Docker branch of the repository.

## Project organization:
**frontend directory**: Written on ReactJS, provides the view of the application<br/>
**backend directory**: Written on NodeJS, provides API endpoints for frontend<br/>
**comparison directory**: Written on Flask, provides API service for response comparisons<br/>
**dialogflowfunctions**: Written on NodeJS, used to upload intentions to dialogflow for NLP training<br/>
**flaskservice directory**: Written on Flask, provides Text Classification Model Training and response comparisons<br/>

## Master Branch

Expand All @@ -39,16 +36,37 @@ Following directories must be executed in seperate terminals to run application

1. Frontend Directory<br/>
2. Backend Directory<br/>
3. flaskservice Directory(Deep Neural Network + Similarity) or comparison Directory(Similarity only)<br/>

**Additional Requirement**<br/>
Create a `.env` file in the Backend Directory with the following:<br/>

```
DIALOGFLOW_PROJECT_ID= XXX
AISG_TOKEN= XXX
SPEECH_API= ws://40.90.170.182:8001/client/ws/speech
SPEECH_HTTP_API= http://40.90.170.182:8001/client/dynamic/recognize
DIALOGFLOW_KEYFILENAME_COVID19=
DIALOGFLOW_KEYFILENAME_BABYBONUS=

MICL_ENDPOINT=
RAJAT_ENDPOINT_BABYBONUS=
RAJAT_ENDPOINT_COVID19=
RUSHI_ENDPOINT=
BANI_ENDPOINT=

AISG_CREDENTIALS=
SPEECH_API=
SPEECH_HTTP_API=
SPEECH_HTTP_AUTH=
SPEECH_ENDPOINT=

DB_HOST=localhost
DB_PORT=27017
DB_USER=
DB_PASS=
DB_NAME=faqdatastore
```

Create a `.env` file in the Frontend Directory with the following:<br/>

```
REACT_APP_API=
```

# Installation/setup instructions will be provided in each directory.
Binary file removed Report/Final Year Project Poster.pdf
Binary file not shown.
Binary file removed Report/Final Year Project Slides PDF.pdf
Binary file not shown.
Binary file not shown.
6 changes: 0 additions & 6 deletions Report/README.md

This file was deleted.

15 changes: 15 additions & 0 deletions backend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.docker
.dockerignore
coverage
dist
node_modules
test
.env*
.eslintrc.js
.prettierrc
Dockerfile
README.md
LICENSE
nest-cli.json
.DS_Store
jest.config.js
24 changes: 24 additions & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM node:12.2.0-alpine

RUN mkdir -p /srv/app/server
WORKDIR /srv/app/server

COPY package.json /srv/app/server
COPY package-lock.json /srv/app/server
COPY requirements.txt /srv/app/server

RUN apk add --no-cache --virtual .build-deps g++ python3-dev libffi-dev openssl-dev && \
apk add --no-cache --update python3 && \
pip3 install --upgrade pip setuptools

RUN npm install --production --slient && \
npm install -g pm2 && \
npm cache clean --force

RUN pip3 install -r requirements.txt

COPY . /srv/app/server

EXPOSE 3001

CMD ["pm2-runtime","ecosystem.config.js"]
38 changes: 31 additions & 7 deletions backend/app.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,56 @@
require("dotenv").config()
const express = require('express');
const dialogflowRouter = require('./routes/dialogflow');
const miclRouter = require('./routes/micl');
const flaskRouter = require('./routes/flask');
const similarityRouter = require('./routes/similarity');
const askJamieRouter = require('./routes/askJamie');
const rajatRouter = require('./routes/rajat.js');
const rushiRouter = require('./routes/rushi.js')
const baniRouter = require('./routes/bani')
const modelsRouter = require('./routes/generalModel')
const STT = require('./controllers/MainController');
const upload = require('./upload');
const AC = require('./controllers/AudioController')
const FAQ = require('./controllers/FAQDataController')

const app = express();

app.use(require('cors')({ origin: true, credentials: true }))
app.use(express.json())
app.use(express.json({limit: "50mb"}))
app.use(express.urlencoded({ extended: false }))

app.use('/similarity', similarityRouter);
app.use('/dialog', dialogflowRouter);
app.use('/micl', miclRouter);
app.use('/flask', flaskRouter);
app.use('/jamie', askJamieRouter);
app.use('/rajat', rajatRouter);
app.use('/rushi', rushiRouter);
app.use('/bani', baniRouter);
app.use('/models', modelsRouter())

app.get('/', (req, res, next)=>{res.json({'status':'success'})})

app.post('/stream/google', STT.streamByRecordingGoogle)
app.post('/stream/aisg', STT.streamByRecordingAISG)
app.post('/stream/import', upload.single('file'), STT.streamByImport)
app.post('/stream/import', upload.audio.single('file'), STT.streamByImport)

app.post('/api/upload', upload.single('file'), AC.convertToWAV)
app.post('/api/speechlabs', upload.none(), STT.speechLabsHTTPRequest)
app.post('/api/google', upload.none(), STT.googleHTTPRequest)
app.post('/api/upload', upload.audio.single('file'), AC.convertToWAV)
app.post('/api/speechlabs', upload.audio.none(), STT.speechLabsHTTPRequest)
app.post('/api/google', upload.audio.none(), STT.googleHTTPRequest)
app.get('/api/deletestorage', AC.deleteFiles)


app.get('/faqdata/topic/:topic', FAQ.getFAQData)
app.delete('/faqdata/topic/:topic', FAQ.deleteAllIntents)

app.get('/faqdata/id/:id', FAQ.getIntent)
app.delete('/faqdata/id/:id', FAQ.deleteIntent)
app.patch('/faqdata/id/:id', FAQ.updateIntent)
app.post('/faqdata/id', FAQ.createIntent)

app.post('/faqdata/csv', upload.csv.single('file'), FAQ.processCSV)
app.get('/faqtopics', FAQ.getFAQTopics)
app.post('/faqtopics/create', FAQ.addNewTopic)
app.delete('/faqtopics/:topic', FAQ.deleteTopic)

module.exports = app
6 changes: 6 additions & 0 deletions backend/ask_jamie.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
import requests
from bs4 import BeautifulSoup


"""
This script is no longer required or in use
but will remain in the project for archiving and referencing if needed.
"""

if __name__ == '__main__':
arg_parser = argparse.ArgumentParser()
arg_parser.add_argument("--test_questions", type=str, help="Path to newline separated questions stored in txt file")
Expand Down
23 changes: 19 additions & 4 deletions backend/bin/www
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
*/

const app = require('../app')
const debug = require('debug')('online-asr-backend:server')
const debug = require('debug')('chatbot-backend:server')
const http = require('http')
const io = require('../io')
const mongoose = require('mongoose')

/**
* Get port from environment and store in Express.
Expand All @@ -31,11 +32,25 @@ server.listen(port)
server.on('error', onError)
server.on('listening', onListening)

/**
* Connect to mongo database
*/

mongoose.connect(`mongodb://${process.env.DB_HOST}:${process.env.DB_PORT}/${process.env.DB_NAME}`, {
useNewUrlParser: true,
useUnifiedTopology: true
})
const db = mongoose.connection
db.on('error', console.error.bind(console, 'connection error:'))
db.once('open', () => {
console.log('Mongodb connected')
})

/**
* Normalize a port into a number, string, or false.
*/

function normalizePort (val) {
function normalizePort(val) {
const port = parseInt(val, 10)

if (isNaN(port)) {
Expand All @@ -55,7 +70,7 @@ function normalizePort (val) {
* Event listener for HTTP server "error" event.
*/

function onError (error) {
function onError(error) {
if (error.syscall !== 'listen') {
throw error
}
Expand Down Expand Up @@ -83,7 +98,7 @@ function onError (error) {
* Event listener for HTTP server "listening" event.
*/

function onListening () {
function onListening() {
const addr = server.address()
const bind = typeof addr === 'string'
? 'pipe ' + addr
Expand Down
Loading