SUSI.AI is an artificial intelligence system, combining pattern matching, internet data, data flow, and inference engine principles. Through some abilities to reflect, it can remember the user input to produce deductions and personalized feedback. Its purpose is to explore the abilities of an artificial companion and to answer the remaining unanswered questions. The SUSI.AI web chat is a front-end developed for web access of SUSI.
Please join our mailing list to discuss questions regarding the project: https://groups.google.com/group/susiai/
Our chat channel is to be found on Gitter: https://gitter.im/fossasia/susi_webchat
- HTML - Generated structure of the web page.
- CSS - Web page styling options and details.
- Javascript(JSON) - Used to store information for deploying the application, such as dependencies.
- ReactJS - Structure for deployment of the web page.
- node --version >= 6
- npm --version >= 3
Running on localhost
- Step 1: Fork the chat.susi.ai repository and clone it to your machine
- Step 2: Cd into the cloned folder
- Step 3: Install all the dependencies with:
$ npm install
- Step 4: Run on http://localhost:3000 with:
$ npm run start
- Step 5: Build locally with:
$ npm run build
- Step 6: To deploy at a URL use:
$ npm run deploy
Running on Surge
Click this picture to see video about deploy!
- Step 1: Install Surge:
$ npm install -g surge
- Step 2: Then cd into the cloned chat.susi.ai folder
- Step 3: Install the node modules:
$ npm install
(if not already) - Step 4: Build the app:
$ npm run build
- Step 5: Go to the build directory:
cd build
- Step 6: Run Surge:
surge
- Step 7: Follow the prompts and provide an e-mail address and a password.
- Step 8: Go to the URL that appears after the above process is finished, and provide this link in the PR for testing your changes.
Still having problems? Watch this video to clear your doubts How to setup SUSI web-chat with surge
Click Here to read the set up guide
Click this picture to see a video for deploying on Firebase
The SUSI.AI WebChat uses Web Speech API for speech recognition and synthesis. To test whether your browser supports Text To Speech, open your browser console and run the following:
var msg = new SpeechSynthesisUtterance('Hello World');
window.speechSynthesis.speak(msg)
If you get speech output, then the Web API Speech Synthesis is supported by your browser and the text-to-speech features of SUSI.AI Web Chat will work. The Web Speech API has support for all latest Chrome/-ium browsers as mentioned in the Web Speech API Mozilla docs. However there are a few bugs with some Chromium versions please check this link on how to fix them locally.
SUSI.AI can be used anomymously or as a logged in user by using the account features. The advantage logged in users is, that they the interaction history is synced across devices. More about accounting here.
Whenever a user logs in he must be able to view his chat history in the chat client. A user might also be using multiple chat clients, so the history across all platforms must be in sync.
A memory servlet is used to retrieve the user history.
api.susi.ai/susi/memory.json?access_token=ACCESS_TOKEN
When the client makes a call to the server to the above endpoint with the ACCESS_TOKEN
of the logged in user, the server returns a list of cognitions which contain susi responses to the queries in the history.
The response from the memory servlet is of the form:
{
"cognitions" : [],
"session" : {},
}
A sample SUSI.AI response is of the form :
{
"query" :
"answers" : [ {
"data" : [],
"actions" : []
}],
}
So each cognition has query
as well as answer
and thus we get a conversation message pair in the chat history.
The cognitions contain a list of SUSI.AI responses of the above form using which chat history is rendered.
All the user messages are stored in a log file. The memory servlet digs out the history of the required user from the log file. The log uses the identity of the user and accesses only that information which has been stored for the user. If the user is not logged on, no information is available. The conversation log is NOT stored for a particular IP. It’s stored for an Identity within the AAA system. That identity can be represented with an email address, or there can be others.
Thus the synchronization of history across all chat platforms is maintained.
After creation and a successful build, your project should have the following file structure:
chat.susi.ai/
README.md
node_modules/
docs/
build/
package.json
public/
index.html
src/
__tests__/
actions/
components/
constants/
dispatcher/
images/
stores/
utils/
App.js
App.test.js
ChatDataServer.js
history.js
index.css
index.js
setupTests.js
.eslintrc
.travis.yml
deploy.sh
LICENSE
public/index.html
is the page template.docs
contains instructions for setting up the project locally and also for deploying it with Surge. It also contains information regarding Accounting.src/index.js
is the JavaScript entry point.src/App.js
is the component which contains React routes to all other components.src/__tests__/
new tests related to all the components can be created in this folder, this project follows ajest
testing suite.src/actions/
contains related action types which can be defined in this folder.src/components/
any new component can be added in this folder, given that the file is reused or should be unique in some way. All static files are present in this component as well.src/components/Translate/
has all the pot files required to integrate the project with Weblate.src/constants/
contains all the action types which are being used in the Application.src/dispatcher/
contains the files to call the Dispatcher Service for the Chat App.src/images/
contains all the static images being used in the App.src/stores/
contains all application related stores for the Dispatcher Service which can be defined in this folder.src/utils/
contains all utilities are files which help us in communicating efficiently between the stores and the actions.src/App.test.js/
is the entry point for all tests in the__tests__
folder.src/ChatDataServer.js/
contains all the helper functions to the calls from the actions to the store.src/history.js/
registers a history for thereact-router
service in the application.src/setupTests.js/
is the file containing custom scripts written for failing tests to pass due to the deprecated libraries..eslintrc
is the config file for the ESLint testing.deploy.sh
handles the continuous Travis Deployment of the project ongh-pages
..travis.yml
is the config file for Travis CI.
- Go to https://hosted.weblate.org/projects/susi-ai/chat/ and Login using your Github Account.
- Select Chat component to add new translations.
- Click on
Start new translation
and choose a new language for which you want to add translations. - After selecting the language, you can add your own translations for the different strings.
- Save the translations.
- Click on the Manage Tab to commit your changes to the local repository based on the translations.
Note
- To make changes to a repository make sure you are Authenticated
- To read more about Weblate and about its integration go to https://docs.weblate.org/en/
-
Chat Bubble Colour
-
Toggle Colour
-
User Feedback Colour
-
Fonts
-
Chat Bubble Colour
-
Toggle Colour
-
User Feedback Colour
-
Fonts
This repository is under a GNU LESSER GENERAL PUBLIC LICENSE 2.1.