RocketChat / hubot-natural

Natural Language Processing Chatbot for RocketChat
https://open.rocket.chat/channel/hubot-natural
MIT License
145 stars 44 forks source link

Improve docker and project organization #12

Closed MatheusFaria closed 6 years ago

MatheusFaria commented 6 years ago

The dockerfile and docker-compose now are fully working without any external project dependencies.

The training data (corpus) was removed from inside code's directory, since it is a user-provided data, does not makes sense to be along with the code. And now it is included as a volume in the docker-compose file, to give the possibility of changing the data without rebuilding the container image.

Besides that, a trainbot command was added along with the DEBUG_MODE, to speed up the development process, avoiding the container restart every time that you change your corpus.

CLAassistant commented 6 years ago

CLA assistant check
All committers have signed the CLA.

diegodorgam commented 6 years ago

Awesome contributions @MatheusFaria I'm not sure if the external YAML files folder should call training_data because we actually want to use the YAML file to config some bots features and interactions, so probably would be better to keep calling it config. There is also the idea to call this folder corpus, 'cause that's how they call it in the literature. I'll approve it by now, and we can think about this later.

diegodorgam commented 6 years ago

@MatheusFaria I've made some changes after this PR now the configure.coffee class operates with security check, by checking if the user has the required roles to perform operations. By now there is only two operations in this class, the setVariable and the train methods. Both are defined in the YAML corpus, with an action attribute and also a role attribute in the node, like this:

  - name: configure-debug
    expect:
      - "configure debug-"
      - "set debug-"
      - "var debug-"
    answer:
      - $key changed to $value!
      - Got it! Now $key is $value
      - $key = $value -> https://media.giphy.com/media/12NUbkX6p4xOO4/giphy.gif
    event: configure
    type: random
    action: setVariable
    role: admin

  - name: configure-retrain
    expect:
      - "retrain bot"
      - "reload training"
      - "restart bot"
    answer:
      - reloading training..
      - You got it $user
      - Ok, just a moment
      - Got it! Restarting engines...
    event: configure
    type: random
    action: train
    role: admin

hope you enjoy it, now you can tell your bot to reload the training in many ways.

MatheusFaria commented 6 years ago

I was thinking it could be a better approach to remove the configuration commands from the YAML. And do all the debug through the Rocket Chat interface and Environment Variables. I don't know it is possible, but it would remove this role logic from the bot, and inherit it from Rocket Chat.