Skip to content

Commit

Permalink
Add README to general and back-end
Browse files Browse the repository at this point in the history
  • Loading branch information
MathieuSchl committed Aug 10, 2023
1 parent 9ad1f98 commit 112a8b0
Show file tree
Hide file tree
Showing 3 changed files with 192 additions and 0 deletions.
83 changes: 83 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,84 @@
# KarAssistant

<div id="header" align="center">
<img src="https://steamuserimages-a.akamaihd.net/ugc/923681227278185275/D579055CC4A7504CFFF832EA33FAACC296B7B937/?imw=5000&imh=5000&ima=fit&impolicy=Letterbox&imcolor=%23000000&letterbox=false"/>
<p>Kara is a personal assistant. Its purpose is to answer questions asked by a client.</p>
</div>

## 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
<div id="header" align="center">
<img src="https://steamuserimages-a.akamaihd.net/ugc/923681227278185275/D579055CC4A7504CFFF832EA33FAACC296B7B937/?imw=5000&imh=5000&ima=fit&impolicy=Letterbox&imcolor=%23000000&letterbox=false"/>
<p>Kara is a personal assistant. Its purpose is to answer questions asked by a client.</p>
</div>
## 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.
100 changes: 100 additions & 0 deletions back_node/README.md
Original file line number Diff line number Diff line change
@@ -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
```
9 changes: 9 additions & 0 deletions back_node/skills/README.md
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 112a8b0

Please sign in to comment.