diff --git a/README.md b/README.md index 3ee24d7..e895b15 100644 --- a/README.md +++ b/README.md @@ -1 +1,84 @@ # KarAssistant + + + +## Structure + +The project comprises 3 types of elements: + +- Clients: these are the applications that will be used by users and interact with the back-end +- Back-end: this is the main service. It can receive, interpret and respond to customer queries. It can also use agents as data sources or to perform actions. +- Agent: Agents are physical components that enable sensors to take measurements or perform actions (coming soon). + +````mermaid +flowchart LR + subgraph Backend + back{fa:fa-server Back} + end + + subgraph Clients + app[fa:fa-mobile-alt Mobile app] + console[fa:fa-terminal Console] + homeAssistant[fa:fa-home Home assistant] + end + + subgraph Agents + agent[fa:fa-home Home agent] + end + + app <--> back + console <--> back + homeAssistant <--> back + back <--> agent +```# KarAssistant + + + + +## Structure + +The project comprises 3 types of elements: +- Clients: these are the applications that will be used by users and interact with the back-end +- Back-end: this is the main service. It can receive, interpret and respond to customer queries. It can also use agents as data sources or to perform actions. +- Agent: Agents are physical components that enable sensors to take measurements or perform actions (coming soon). + +```mermaid +flowchart LR + subgraph Backend + back{fa:fa-server Back} + end + + subgraph Clients + app[fa:fa-mobile-alt Mobile app] + console[fa:fa-terminal Console] + homeAssistant[fa:fa-home Home assistant] + end + + subgraph Agents + agent[fa:fa-home Home agent] + end + + app <--> back + console <--> back + homeAssistant <--> back + back <--> agent +```` + +## Available components + +### Client: Flutter applications + +### Back: Backend_node + +This is the main service. +It can receive, interpret and respond queries from the clients. +Each query will be interpreted and compared with a skills database. +Example: for the sentence `what time is it ?` the skill used concerns the time. The back-end will respond with the time `It's 12:15`. + +One of our objectives is to set up physical agents at home, for example. They could operate on raspberries and control certain objects such as lights or shutters. diff --git a/back_node/README.md b/back_node/README.md new file mode 100644 index 0000000..d5b73c9 --- /dev/null +++ b/back_node/README.md @@ -0,0 +1,100 @@ +# Back-end node.js + +```mermaid +flowchart LR + subgraph Backend + subgraph You are here + back{fa:fa-server Back} + end + end + + subgraph Clients + app[fa:fa-mobile-alt Mobile app] + console[fa:fa-terminal Console] + homeAssistant[fa:fa-home Home assistant] + end + + subgraph Agents + agent[fa:fa-home Home agent] + end + + app <--> back + console <--> back + homeAssistant <--> back + back <--> agent +``` + +This is the main service. +It can receive, interpret and respond queries from the clients. +Each query will be interpreted and compared with a skills database. +Example: for the sentence `what time is it ?` the skill used concerns the time. The back-end will respond with the time `It's 12:15`. + +One of our objectives is to set up physical agents at home, for example. They could operate on raspberries and control certain objects such as lights or shutters. + +## How it's work + +```mermaid +stateDiagram-v2 + skills: Skills + kara: Kara + use: USE + use2: USE + user: User + api: Api + + [*] --> kara + skills --> use: Get skills + use --> kara: Encrypt skills + + api --> use2 + use2 --> kara: Encrypt + kara --> api + user --> api: Request + api --> user: Respond +``` + +USE = Universal Sentence Encoder + +### You've missed the point ? + +When the service starts up, skills will be in loaded. To do this, the `Universal Sentence Encoder` (USE) algorithm is used. +This will convert the samples sentences into vectors. +When a customer makes a request, the request phrase is embedded and compared with other vectors. +If the result of the comparison is close to 0, this means that the two sentences in question are similar and the skill code can be executed. The skill will then send the response sentence back to the client. + +To see the skills [click here](back_node/skills) + +## Install & start + +### With node + +Used version : + +- Node.js: v18.13.0 +- npm: 9.1.1 + +To install all packages + +``` +npm install +``` + +To run all packages + +``` +npm run start +``` + +### With docker-compose + +Start + +``` +docker-compose up -d +``` + +Stop + +``` +docker-compose down +``` diff --git a/back_node/skills/README.md b/back_node/skills/README.md new file mode 100644 index 0000000..22f3c96 --- /dev/null +++ b/back_node/skills/README.md @@ -0,0 +1,9 @@ +# Skills + +All folders and subfolders here will be used as skills. Two files are required for the skill to be loaded. The first is `index.js` and contains the skill code. The second is `text.json` and contains all the sample texts. + +The skills available are : + +- kara/date - To get the date and the time +- kara/time - To get the time +- kara/whoareyou - Kara will indroduce herself