gem install bundler
bundle install
chmod +x bin/console
bin/console
examples in console_data/
- Intent
- Text (regexp, one from array, full equals)
- Answer
- Condition
- Global fallback
While working with intents you need to set AI_HOST variable (example: AI_HOST=http://localhost:8000) in .env file
for connecting to morzebot-ai-v2 service
You need to configure your script via json config. Every block has key type
{
"type": "text"
}Every block can have different data.
Available fields:
"root"- first column block"global"- can be called from any flow"to_start"- after success return to start"<type of block>"- for example"intent": { ...
{
"data": {
"root": true,
"global": false,
"intent": {
"content": "test content"
}
}
}"<type of block>" available fields:
"content": "<name of intent>"
text block has 3 compare_types of content
"content": "<regexp string | array of strings | string>"
"compare_type": "<regexp | from_array | one>"
- regexp - match by regular expression
- from_array - choose one from array
- one - compare with string
empty
"content": "<array of conditons ([[cond, next_block_id ], ...])>"
example "content": [["$sent == 'да'", "next_block_id_1"]]
$sent - reserved variable which contains user sentence
in future will be other variables
key must be "__fallback__"!
move to this block after failed execution as default
{
"caption_before": "test"
}send text before successful block executing
{
"caption_after": "test"
}send text after successful block executing
{
"next_block_id": "next_block_id_test"
}move to next block after successful executing
{
"fallback_id": "fallback_id_1"
}move to fallback block after failed executing