FX - Bot @ AI and Algorithm @ MentDB Weak
Bot
bot createbot showbot getbot existbot reloadbot deletebot user_createbot user_showbot user_getbot user_existbot set_wait_replaybot get_wait_replaybot right_addbot right_checkbot right_deletebot right_showbot user_set_varbot user_get_varbot user_get_varsbot user_deletebot training_mergebot training_getbot training_existbot training_version_getbot training_version_existbot training_generate_mergebot training_version_generate_mergebot training_version_deletebot training_searchbot training_pushbot training_pullbot execute
bot create <bot> <lang> <is_male> <firstname> <lastname> <cancel_key> <not_found_response>
Description
To create a new bot
To create a new bot
Parameters
bot: The bot name - string - required
lang: The language (en|fr) - string - required
is_male: 1: male, 0: female - string - required
firstname: The firstname - string - required
lastname: The lastname - string - required
cancel_key: The cancel key - string - required
not_found_response: The not found response - string - required
bot: The bot name - string - required
lang: The language (en|fr) - string - required
is_male: 1: male, 0: female - string - required
firstname: The firstname - string - required
lastname: The lastname - string - required
cancel_key: The cancel key - string - required
not_found_response: The not found response - string - required
admin
bot create "mona" "fr" 0 "mona" "payet" "cancel_key" "Désolé, je ne comprends pas. Je préviens l'administrateur...";
mentdb
1
bot show
Description
To show all bots
To show all bots
admin
bot show;
mentdb
[]
bot get <bot>
Description
To get a bot
To get a bot
Parameters
bot: The bot name - string - required
bot: The bot name - string - required
admin
bot get "mona";
mentdb
{}
bot exist <bot>
Description
To check if a bot already exist
To check if a bot already exist
Parameters
bot: The bot name - string - required
bot: The bot name - string - required
admin
bot exist "mona"
mentdb
1
bot reload <bot>
Description
To reload a bot
To reload a bot
Parameters
bot: The bot name - string - required
bot: The bot name - string - required
admin
bot reload "mona";
mentdb
Trigger: 2; Training: 1
bot delete <bot>
Description
To delete a bot
To delete a bot
Parameters
bot: The bot name - string - required
bot: The bot name - string - required
admin
bot delete "mona";
mentdb
1
bot user_create <bot> <login> <password> <json_vars>
Description
To create a new user for a bot
To create a new user for a bot
Parameters
bot: The bot name - string - required
login: The user - string - required
password: The password - string - required
json_vars: The json variable object - string - required
bot: The bot name - string - required
login: The user - string - required
password: The password - string - required
json_vars: The json variable object - string - required
admin
bot user_create "mona" "jim" "pwd" "{ \"[user_firstname]\": \"jimmitry\", \"[user_lastname]\": \"payet\" }";
mentdb
1
bot user_show <bot>
Description
To show all users for a bot
To show all users for a bot
Parameters
bot: The bot name - string - required
bot: The bot name - string - required
admin
bot user_show "mona";
mentdb
[]
bot user_get <bot> <login>
Description
To get a user for a bot
To get a user for a bot
Parameters
bot: The bot name - string - required
login: The user - string - required
bot: The bot name - string - required
login: The user - string - required
admin
bot user_get "mona" "jim"
mentdb
{}
bot user_exist <bot> <login>
Description
To check if a user already exist for a bot
To check if a user already exist for a bot
Parameters
bot: The bot name - string - required
login: The user - string - required
bot: The bot name - string - required
login: The user - string - required
admin
bot user_exist "mona" "jim"
mentdb
1
bot set_wait_replay <bot> <login> <key>
Description
To set a key for a user
To set a key for a user
Parameters
bot: The bot name - string - required
login: The user - string - required
key: The training key - string - required
bot: The bot name - string - required
login: The user - string - required
key: The training key - string - required
admin
bot set_wait_replay "mona" "jim" "dire_bonjour";
mentdb
1
bot get_wait_replay <bot> <login>
Description
To set a variable for a user
To set a variable for a user
Parameters
bot: The bot name - string - required
login: The user - string - required
bot: The bot name - string - required
login: The user - string - required
admin
bot get_wait_replay "mona" "jim";
mentdb
dire_bonjour
bot right_add <bot> <login> <key> <version>
Description
To add a new right for a specific user
To add a new right for a specific user
Parameters
bot: The bot name - string - required
login: The user - string - required
key: The training key - string - required
version: The version of the training - string - required
bot: The bot name - string - required
login: The user - string - required
key: The training key - string - required
version: The version of the training - string - required
admin
bot right_add "mona" "jim" "dire_bonjour" "100";
mentdb
1
bot right_check <bot> <login> <key> <version>
Description
To add a new right for a specific user
To add a new right for a specific user
Parameters
bot: The bot name - string - required
login: The user - string - required
key: The training key - string - required
version: The version of the training - string - required
bot: The bot name - string - required
login: The user - string - required
key: The training key - string - required
version: The version of the training - string - required
admin
bot right_check "mona" "jim" "dire_bonjour" "100";
mentdb
1
bot right_delete <bot> <login> <key> <version>
Description
To delete a right for a specific user
To delete a right for a specific user
Parameters
bot: The bot name - string - required
login: The user - string - required
key: The training key - string - required
version: The version of the training - string - required
bot: The bot name - string - required
login: The user - string - required
key: The training key - string - required
version: The version of the training - string - required
admin
bot right_delete "mona" "jim" "dire_bonjour" "100";
mentdb
1
bot right_show <bot> <login>
Description
To rights for a specific user
To rights for a specific user
Parameters
bot: The bot name - string - required
login: The user - string - required
bot: The bot name - string - required
login: The user - string - required
admin
bot right_show "mona" "jim";
mentdb
[]
bot user_set_var <bot> <login> <varname> <value>
Description
To set a variable for a user
To set a variable for a user
Parameters
bot: The bot name - string - required
login: The user - string - required
varname: The variable name - string - required
value: The value - string - required
bot: The bot name - string - required
login: The user - string - required
varname: The variable name - string - required
value: The value - string - required
admin
bot user_set_var "mona" "jim" "[A]" "9";
mentdb
1
bot user_get_var <bot> <login> <varname>
Description
To get a variable for a user
To get a variable for a user
Parameters
bot: The bot name - string - required
login: The user - string - required
varname: The variable name - string - required
bot: The bot name - string - required
login: The user - string - required
varname: The variable name - string - required
admin
bot user_get_var "mona" "jim" "[A]";
mentdb
9
bot user_get_vars <bot> <login>
Description
To get all variables for a user
To get all variables for a user
Parameters
bot: The bot name - string - required
login: The user - string - required
bot: The bot name - string - required
login: The user - string - required
admin
bot user_get_vars "mona" "jim";
mentdb
{}
bot user_delete <bot> <login>
Description
To delete a user for a bot
To delete a user for a bot
Parameters
bot: The bot name - string - required
login: The user - string - required
bot: The bot name - string - required
login: The user - string - required
admin
bot user_delete "mona" "jim";
mentdb
1
bot training_merge <bot> <key> <context> <description> <in_trigger_json> <out_mql_output_json> <consciousness_json>
Description
To add/update a training
To add/update a training
Parameters
bot: The bot name - string - required
key: The training key - string - required
context: The context - string - required
description: The description - string - required
in_trigger_json: The triggers - string - required
out_mql_output_json: MQL to execute (the result is return) - string - required
consciousness_json: The consciousness object - string - required
bot: The bot name - string - required
key: The training key - string - required
context: The context - string - required
description: The description - string - required
in_trigger_json: The triggers - string - required
out_mql_output_json: MQL to execute (the result is return) - string - required
consciousness_json: The consciousness object - string - required
admin
json load "trigger" "[]"; json iarray "trigger" / "abandonnes l'affaire" STR; json iarray "trigger" / "abandonnes la tâche" STR; json iarray "trigger" / "annules la tâche en cours" STR; json iarray "trigger" / "tu peux abandonner l'affaire" STR; json iarray "trigger" / "tu peux abandonner la tâche" STR; json iarray "trigger" / "tu peux annuler la tâche en cours" STR; json iarray "trigger" / "laisses tomber l'affaire" STR; json iarray "trigger" / "tu peux laisser tomber l'affaire" STR; json iarray "trigger" / "reprends tout à zéro" STR; json iarray "trigger" / "tu peux reprendre tout à zéro" STR; json load "consciousness_done" "[]"; json iarray "consciousness_done" / "j'ai repris tout à zéro." STR; json iarray "consciousness_done" / "j'ai abandonné la tâche en cours." STR; json load "consciousness_think" "[]"; json iarray "consciousness_think" / "j'avais pensé que je devais reprendre tout à zéro." STR; json iarray "consciousness_think" / "j'avais pensé que je devais abandonner la tâche en cours." STR; json load "consciousness_understand" "[]"; json iarray "consciousness_understand" / "j'avais compris que je devais reprendre tout à zéro." STR; json iarray "consciousness_understand" / "j'avais compris que je devais abandonner la tâche en cours." STR; json load "consciousness_subject" "[]"; json iarray "consciousness_subject" / "il s'agissait de reprendre tout à zéro." STR; json iarray "consciousness_subject" / "il s'agissait d'abandonner la tâche en cours." STR; json load "consciousness" "{}"; json iobject "consciousness" / "done" (json doc "consciousness_done") ARRAY; json iobject "consciousness" / "think" (json doc "consciousness_think") ARRAY; json iobject "consciousness" / "understand" (json doc "consciousness_understand") ARRAY; json iobject "consciousness" / "subject" (json doc "consciousness_subject") ARRAY; bot training_merge "mona" "cancel_key" "task" "Annuler la tâche en cours" 100 (json doc "trigger") (mql { ###################################### # Default variables : # [bot] # [bot_lang] # [bot_is_male] # [bot_firstname] # [bot_lastname] # [training_key] # [training_context] # [training_rights] # [user] # [user_request] # [user_variables] # [user_firstname] # [user_lastname] # [user_rights] # [user_wait_replay] ######################################; bot set_wait_replay [bot] [user] null; switch (math random 5) (0) {"D'accord."} (1) {"Ok."} (2) {"Okay."} (3) {"C'est d'accord."} {"Bien reçu."} ; }) (json doc "consciousness") ; json load "trigger" "[]"; json iarray "trigger" / "bonjour" STR; json iarray "trigger" / "salut" STR; json load "consciousness_done" "[]"; json iarray "consciousness_done" / "j'ai dis bonjour." STR; json iarray "consciousness_done" / "j'ai répondu salut." STR; json load "consciousness_think" "[]"; json iarray "consciousness_think" / "j'avais pensé que je devais dire bonjour." STR; json iarray "consciousness_think" / "j'avais pensé que je devais répondre salut." STR; json load "consciousness_understand" "[]"; json iarray "consciousness_understand" / "j'avais compris que je devais dire bonjour." STR; json iarray "consciousness_understand" / "j'avais compris que je devais répondre salut." STR; json load "consciousness_subject" "[]"; json iarray "consciousness_subject" / "il s'agissait de dire bonjour." STR; json iarray "consciousness_subject" / "il s'agissait de répondre salut." STR; json load "consciousness" "{}"; json iobject "consciousness" / "done" (json doc "consciousness_done") ARRAY; json iobject "consciousness" / "think" (json doc "consciousness_think") ARRAY; json iobject "consciousness" / "understand" (json doc "consciousness_understand") ARRAY; json iobject "consciousness" / "subject" (json doc "consciousness_subject") ARRAY; bot training_merge "mona" "dire_bonjour" "politesse" "Répondre à un bonjour de l'utilisateur" 100 (json doc "trigger") (mql { bot set_wait_replay [bot] [user] null; switch (math random 2) (0) {"Salut."} {"Bonjour."} ; }) (json doc "consciousness") ; json load "trigger" "[]"; json iarray "trigger" / "[1] + [2]" STR; json iarray "trigger" / "fait une addition avec les nombres [1] et [2]" STR; json load "consciousness_done" "[]"; json iarray "consciousness_done" / "j'ai fait une addition avec les nombres [1] et [2]." STR; json iarray "consciousness_done" / "j'ai additionné les nombres [1] et [2]." STR; json load "consciousness_think" "[]"; json iarray "consciousness_think" / "j'avais pensé que je devais faire une addition avec les nombres [1] et [2]." STR; json iarray "consciousness_think" / "j'avais pensé que je devais additionner les nombres [1] et [2]." STR; json load "consciousness_understand" "[]"; json iarray "consciousness_understand" / "j'avais compris que je devais faire une addition avec les nombres [1] et [2]." STR; json iarray "consciousness_understand" / "j'avais compris que je devais additionner les nombres [1] et [2]." STR; json load "consciousness_subject" "[]"; json iarray "consciousness_subject" / "il s'agissait de faire une addition avec les nombres [1] et [2]." STR; json iarray "consciousness_subject" / "il s'agissait d'additionner les nombres [1] et [2]." STR; json load "consciousness" "{}"; json iobject "consciousness" / "done" (json doc "consciousness_done") ARRAY; json iobject "consciousness" / "think" (json doc "consciousness_think") ARRAY; json iobject "consciousness" / "understand" (json doc "consciousness_understand") ARRAY; json iobject "consciousness" / "subject" (json doc "consciousness_subject") ARRAY; bot training_merge "mona" "faire_une_addition" "math" "Faire une addition avec 2 nombres" 100 (json doc "trigger") (mql { json load "vars" [user_variables]; if (and (== (json count "vars" /) 2) (and (not (is null or empty (json select "vars" "/[0]"))) (not (is null or empty (json select "vars" "/[1]"))))) { -> "[1]" (json select "vars" "/[0]"); -> "[2]" (json select "vars" "/[1]"); -> "[calc]" (+ [1] [2]); bot set_wait_replay [bot] [user] null; switch (math random 4) (0) {concat "Le résultat est " [calc] "."} (1) {concat "Le résultat de l'addition est " [calc] "."} (2) {concat [1] " + " [2] " = " [calc]} {[calc]} ; } { case (string starts_with (string lower [user_request]) "utilises le nombre") { json load "split" (string get_variable (string lower [user_request]) "utilises le nombre [1]"); if (and (== (json count "split" "/") 1) (type is_double (json select "split" "/[0]"))) { case (not (env exist var "[1]")) { -> "[1]" (json select "split" "/[0]"); } (not (env exist var "[2]")) { -> "[2]" (json select "split" "/[0]"); } ; }; } (string starts_with (string lower [user_request]) "utilises les nombres") { json load "split" (string get_variable (string lower [user_request]) "utilises les nombres [1] et [2]"); if (and (and (== (json count "split" "/") 2) (type is_double (json select "split" "/[0]"))) (type is_double (json select "split" "/[1]"))) { -> "[1]" (json select "split" "/[0]"); -> "[2]" (json select "split" "/[1]"); }; } ( json load "split" (string split (string lower [user_request]) " " -1); and (== (json count "split" "/") 2) (and (type is_double (json select "split" "/[0]")) (type is_double (json select "split" "/[1]"))) ) { -> "[1]" (json select "split" "/[0]"); -> "[2]" (json select "split" "/[1]"); } ( json load "split" (string split (string lower [user_request]) " " -1); and (== (json count "split" "/") 3) (and (equal (json select "split" "/[1]") "et") (and (type is_double (json select "split" "/[0]")) (type is_double (json select "split" "/[2]")))) ) { -> "[1]" (json select "split" "/[0]"); -> "[2]" (json select "split" "/[2]"); } ; if (and (not (env exist var "[1]")) (not (env exist var "[2]"))) { bot set_wait_replay [bot] [user] [training_key]; "Désolé, pour faire une addition il me faut 2 nombres."; } { if (or (not (env exist var "[1]")) (not (env exist var "[2]"))) { bot set_wait_replay [bot] [user] [training_key]; "Désolé, pour faire une addition il me faut encore un nombre."; } { bot set_wait_replay [bot] [user] null; -> "[calc]" (+ [1] [2]); switch (math random 4) (0) {concat "Le résultat est " [calc] "."} (1) {concat "Le résultat de l'addition est " [calc] "."} (2) {concat [1] " + " [2] " = " [calc]} {[calc]} ; }; }; }; }) (json doc "consciousness") ; json load "trigger" "[]"; json iarray "trigger" / "tu te trompes ce n'est pas ce que je voulais" STR; json iarray "trigger" / "tu te trompes ce n'est pas ce que j'attendais" STR; json load "consciousness_done" "[]"; json iarray "consciousness_done" / "j'ai comprenais que je m'étais trompé." STR; json load "consciousness_think" "[]"; json iarray "consciousness_think" / "j'avais pensé que je m'étais trompé." STR; json load "consciousness_understand" "[]"; json iarray "consciousness_understand" / "j'avais compris que je m'étais trompé." STR; json load "consciousness_subject" "[]"; json iarray "consciousness_subject" / "il s'agissait de comprendre que je m'étais trompé." STR; json load "consciousness" "{}"; json iobject "consciousness" / "done" (json doc "consciousness_done") ARRAY; json iobject "consciousness" / "think" (json doc "consciousness_think") ARRAY; json iobject "consciousness" / "understand" (json doc "consciousness_understand") ARRAY; json iobject "consciousness" / "subject" (json doc "consciousness_subject") ARRAY; bot training_merge "mona" "error_key" "task" "Remarquer que je me trompe" 100 (json doc "trigger") (mql { if (env exist var "[user_last_request]") { sql connect "session1" {cm get "MENTDB";}; sql dml "session1" (concat "INSERT INTO public.mona_not_found ( bot, login, input ) VALUES ( " (sql encode [bot]) " , " (sql encode [user]) " , " (sql encode [user_last_request]) " );"); sql disconnect "session1"; }; switch (math random 5) (0) {"D'accord, je préviens l'administrateur."} (1) {"Ok, je préviens l'administrateur."} (2) {"Okay, je préviens l'administrateur."} (3) {"C'est d'accord, je préviens l'administrateur."} {"Bien reçu, je préviens l'administrateur."} ; }) (json doc "consciousness") ; bot reload "mona"; bot execute "mona" "jim" "fait une addition"; bot execute "mona" "jim" "utilises les nombres 99 et 100"; bot execute "mona" "jim" "fait une addition"; bot execute "mona" "jim" "abandonnes la tâche"; bot execute "mona" "jim" "bonjour";
mentdb
1
bot training_get <bot> <key>
Description
To get the last training for a bot
To get the last training for a bot
Parameters
bot: The bot name - string - required
key: The training key - string - required
bot: The bot name - string - required
key: The training key - string - required
admin
bot training_get "mona" "dire_bonjour"
mentdb
{}
bot training_exist <bot> <key>
Description
To check if the last training key already exist for a bot
To check if the last training key already exist for a bot
Parameters
bot: The bot name - string - required
key: The training key - string - required
bot: The bot name - string - required
key: The training key - string - required
admin
bot training_exist "mona" "dire_bonjour"
mentdb
1
bot training_version_get <bot> <key> <version>
Description
To get a training for a bot
To get a training for a bot
Parameters
bot: The bot name - string - required
key: The training key - string - required
version: The training version - string - required
bot: The bot name - string - required
key: The training key - string - required
version: The training version - string - required
admin
bot training_version_get "mona" "dire_bonjour" 100
mentdb
{}
bot training_version_exist <bot> <key> <version>
Description
To check if a training key already exist for a bot
To check if a training key already exist for a bot
Parameters
bot: The bot name - string - required
key: The training key - string - required
version: The training version - string - required
bot: The bot name - string - required
key: The training key - string - required
version: The training version - string - required
admin
bot training_version_exist "mona" "dire_bonjour" 100
mentdb
1
bot training_generate_merge <bot> <key>
Description
To update a training
To update a training
Parameters
bot: The bot name - string - required
key: The training key - string - required
bot: The bot name - string - required
key: The training key - string - required
admin
bot training_generate_merge "mona" "dire_bonjour";
mentdb
1
bot training_version_generate_merge <bot> <key> <version>
Description
To update a training
To update a training
Parameters
bot: The bot name - string - required
key: The training key - string - required
version: The training version - string - required
bot: The bot name - string - required
key: The training key - string - required
version: The training version - string - required
admin
bot training_version_generate_merge "mona" "dire_bonjour" 100;
mentdb
1
bot training_version_delete <bot> <key> <version>
Description
To delete a training for a bot
To delete a training for a bot
Parameters
bot: The bot name - string - required
key: The training key - string - required
version: The training version - string - required
bot: The bot name - string - required
key: The training key - string - required
version: The training version - string - required
admin
bot training_version_delete "mona" "dire_bonjour" 100;
mentdb
1
bot training_search <bot> <key> <context> <description> <in_trigger_json> <out_mql_output_json> <consciousness_json>
Description
To search a training
To search a training
Parameters
bot: The bot name - string - required
key: The training key - string - required
context: The context - string - required
description: The description - string - required
in_trigger_json: The triggers - string - required
out_mql_output_json: MQL to execute (the result is return) - string - required
consciousness_json: The consciousness object - string - required
bot: The bot name - string - required
key: The training key - string - required
context: The context - string - required
description: The description - string - required
in_trigger_json: The triggers - string - required
out_mql_output_json: MQL to execute (the result is return) - string - required
consciousness_json: The consciousness object - string - required
admin
bot training_search "%mona%" "%dire_bonjour%" "%%" "%%" "%%" "%%" "%%";
mentdb
...
bot training_push <bot> <key> <version> <jsonCm>
Description
To push a local training to a remote mentdb server
To push a local training to a remote mentdb server
Parameters
bot: The bot name - string - required
key: The training key - string - required
version: The training version - string - required
jsonCm: The json mentdb connection - string - required
bot: The bot name - string - required
key: The training key - string - required
version: The training version - string - required
jsonCm: The json mentdb connection - string - required
admin
bot training_push "mona" "dire_bonjour" 100 (cm get "demo_cm_mentdb");
mentdb
1
bot training_pull <jsonCm> <bot> <key> <version>
Description
To pull a training from a remote mentdb server to local
To pull a training from a remote mentdb server to local
Parameters
jsonCm: The json mentdb connection - string - required
bot: The bot name - string - required
key: The training key - string - required
version: The training version - string - required
jsonCm: The json mentdb connection - string - required
bot: The bot name - string - required
key: The training key - string - required
version: The training version - string - required
admin
bot training_pull (cm get "demo_cm_mentdb") "mona" "dire_bonjour" 100;
mentdb
1
bot execute <bot> <user> <request>
Description
To execute a talk
To execute a talk
Parameters
bot: The bot name - string - required
user: The user - string - required
request: The request - string - required
bot: The bot name - string - required
user: The user - string - required
request: The request - string - required
admin
bot execute "mona" "jim" "bonjour"
mentdb
["lisa"]
