2024-09-30 18:29:41 +07:00
|
|
|
# huesos
|
2024-08-30 22:04:28 +07:00
|
|
|
|
2024-09-30 18:29:41 +07:00
|
|
|
Basis for developing chat-robots with "Web App" technology for Telegram
|
|
|
|
|
|
|
|
## Installation
|
|
|
|
|
|
|
|
### AnangoDB
|
|
|
|
|
2024-10-11 13:58:35 +07:00
|
|
|
1. Create a Graph with the specified values
|
2024-10-22 23:28:49 +07:00
|
|
|
**Name:** catalog<br/>
|
|
|
|
<br/>
|
|
|
|
**edgeDefinition:** entry<br/>
|
|
|
|
**fromCollections:** categoy, product<br/>
|
2024-10-11 13:58:35 +07:00
|
|
|
**toCollections:** category
|
2024-09-30 18:29:41 +07:00
|
|
|
|
|
|
|
2. Create a Graph with the specified values
|
2024-10-22 23:28:49 +07:00
|
|
|
**Name:** sessions<br/>
|
|
|
|
<br/>
|
|
|
|
**edgeDefinition:** connect<br/>
|
|
|
|
**fromCollections:** account<br/>
|
2024-10-11 13:58:35 +07:00
|
|
|
**toCollections:** session
|
2024-09-30 18:29:41 +07:00
|
|
|
|
|
|
|
3. Create indexes for the "product" collection
|
2024-10-22 23:28:49 +07:00
|
|
|
**Type:** "Inverted Index"<br/>
|
|
|
|
**Fields:** name.ru<br/>
|
|
|
|
**Analyzer:** "text_ru"<br/>
|
|
|
|
**Search field:** true<br/>
|
|
|
|
**Name:** name_ru<br/>
|
|
|
|
<br/>
|
|
|
|
*Add indexes for all search parameters and for all languages (search language is selected based on the user's language, <br/>
|
|
|
|
otherwise from the default language specified in the active settings from **settings** collection document)*<br/>
|
|
|
|
<br/>
|
|
|
|
*See fields in the `mirzaev/arming_bot/models/product`<br/>
|
2024-10-11 13:58:35 +07:00
|
|
|
**name.ru**, **description.ru** and **compatibility.ru***
|
|
|
|
|
|
|
|
4. Create a View with the specified values
|
2024-10-22 23:28:49 +07:00
|
|
|
**type:** search-alias (you can also use "arangosearch")<br/>
|
|
|
|
**name:** **product**s_search<br/>
|
2024-10-11 15:23:05 +07:00
|
|
|
**indexes:**
|
|
|
|
```json
|
2024-09-30 18:29:41 +07:00
|
|
|
"indexes": [
|
|
|
|
{
|
|
|
|
"collection": "product",
|
2024-10-11 15:23:05 +07:00
|
|
|
"index": "title_ru" # THIS IS AN EXAMPLE
|
2024-09-30 18:29:41 +07:00
|
|
|
}
|
|
|
|
]
|
2024-10-11 15:23:05 +07:00
|
|
|
```
|
2024-09-30 18:29:41 +07:00
|
|
|
|
|
|
|
### NGINX
|
|
|
|
|
2024-10-11 13:58:35 +07:00
|
|
|
1. Example of NGINX server file
|
2024-10-11 15:23:05 +07:00
|
|
|
```nginx
|
2024-10-11 13:58:35 +07:00
|
|
|
location / {
|
|
|
|
try_files $uri $uri/ /index.php;
|
|
|
|
}
|
|
|
|
|
|
|
|
location ~ /(?<type>categories|products) {
|
|
|
|
root /var/www/arming_bot/mirzaev/arming_bot/system/storage;
|
|
|
|
try_files $uri =404;
|
|
|
|
}
|
|
|
|
|
|
|
|
location ~ \.php$ {
|
|
|
|
...
|
2024-09-30 18:29:41 +07:00
|
|
|
}
|
2024-10-11 15:23:05 +07:00
|
|
|
```
|
2024-09-30 18:29:41 +07:00
|
|
|
|
2024-10-11 13:58:35 +07:00
|
|
|
### SystemD (or any alternative you like)
|
|
|
|
|
|
|
|
1. Execute: `sudo cp telegram-huesos.service /etc/systemd/system/telegram-huesos.service`
|
|
|
|
|
2024-10-22 23:28:49 +07:00
|
|
|
*before you execute the command think about **what it does** and whether the **paths** are specified correctly*<br/>
|
2024-10-11 13:58:35 +07:00
|
|
|
*the configuration file is very simple and you can remake it for any alternative to SystemD that you like*
|
|
|
|
|
2024-09-30 18:29:41 +07:00
|
|
|
## Settings
|
2024-10-22 23:28:49 +07:00
|
|
|
Settings of chat-robot and Web App<br/>
|
|
|
|
<br/>
|
2024-10-11 13:58:35 +07:00
|
|
|
Make sure you have a **settings** collection (can be created automatically) and at least one document with the "status" parameter set to "active"
|
2024-10-11 15:23:05 +07:00
|
|
|
```json
|
2024-09-30 18:29:41 +07:00
|
|
|
{
|
2024-10-22 23:28:49 +07:00
|
|
|
"status": "active",
|
|
|
|
"project": {
|
|
|
|
"name": "NAME_OF_THE_PROJECT"
|
|
|
|
},
|
|
|
|
"language": "en",
|
|
|
|
"currency": "usd"
|
2024-09-30 18:29:41 +07:00
|
|
|
}
|
2024-10-11 15:23:05 +07:00
|
|
|
```
|
2024-09-30 18:29:41 +07:00
|
|
|
|
2024-10-22 23:28:49 +07:00
|
|
|
### Language
|
|
|
|
Language for render of interface, if account or session language is not initialized<br/>
|
|
|
|
<br/>
|
|
|
|
**Value:** en<br/>
|
|
|
|
**⚠️ The value will be converted to an instance of enumeration** `mirzaev\arming_bot\models\enumerations\language`
|
|
|
|
|
|
|
|
### Currency
|
|
|
|
Currency for calculations and render of interface, if account or session currency is not initialized<br/>
|
|
|
|
<br/>
|
|
|
|
**Value:** usd<br/>
|
|
|
|
**⚠️ The value will be converted to an instance of enumeration** `mirzaev\arming_bot\models\enumerations\currency`
|
2024-09-30 18:29:41 +07:00
|
|
|
|
|
|
|
## Suspensions
|
2024-10-22 23:28:49 +07:00
|
|
|
System of suspensions of chat-robot and Web App<br/>
|
|
|
|
<br/>
|
2024-10-11 13:58:35 +07:00
|
|
|
Make sure you have a **suspension** collection (can be created automatically)
|
2024-10-11 15:23:05 +07:00
|
|
|
```json
|
2024-09-30 18:29:41 +07:00
|
|
|
{
|
|
|
|
"end": 1726068961,
|
|
|
|
"targets": {
|
|
|
|
"chat-robot": true,
|
|
|
|
"web app": true
|
|
|
|
}
|
|
|
|
"access": {
|
|
|
|
"tester": true,
|
|
|
|
"developer": true
|
|
|
|
},
|
|
|
|
"description": {
|
|
|
|
"ru": "Разрабатываю каталог, поиск и корзину",
|
|
|
|
"en": "I am developing a catalog, search and cart"
|
|
|
|
}
|
|
|
|
}
|
2024-10-11 15:23:05 +07:00
|
|
|
```
|