diff --git a/Dockerfile b/Dockerfile index f616870286e3ab1b828eadbbe0df995e29273a80..1234d2f820db8ae7453e3ab8e29abae6d25fdcd9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM node:alpine LABEL mantainer "Diego Dorgam <diego.dorgam@rocket.chat>" -ENV HUBOT_LANG='pt' \ +ENV HUBOT_LANG='en' \ HUBOT_CORPUS='corpus.yml' \ HUBOT_ADAPTER=rocketchat \ HUBOT_OWNER=RocketChat \ @@ -17,10 +17,9 @@ ENV HUBOT_LANG='pt' \ RESPOND_TO_DM=true \ RESPOND_TO_LIVECHAT=true \ RESPOND_TO_EDITED=true \ - LISTEN_ON_ALL_PUBLIC=false \ - HUBOT_NATURAL_DEBUG_MODE=false + LISTEN_ON_ALL_PUBLIC=true -RUN apk --update add --no-cache git python make g++ && \ +RUN apk --update add --no-cache git && \ addgroup -S hubotnat && adduser -S -g hubotnat hubotnat USER node @@ -47,10 +46,18 @@ RUN yo hubot --adapter ${HUBOT_ADAPTER} \ --owner ${HUBOT_OWNER} \ --name ${HUBOT_NAME} \ --description ${HUBOT_DESCRIPTION} \ - --defaults --no-insight + --defaults --no-insight && \ + rm /home/hubotnat/bot/external-scripts.json \ + /home/hubotnat/bot/scripts/example.coffee \ + /home/hubotnat/bot/hubot-scripts.json -COPY ["external-scripts.json","package.json", "/home/hubotnat/bot/"] + +COPY ["package.json", "/home/hubotnat/bot/"] ADD scripts/ /home/hubotnat/bot/scripts/ ENTRYPOINT /home/hubotnat/bot/bin/hubot -a rocketchat + +USER root +RUN apk del git && \ + rm -rf /var/cache/apk/* diff --git a/launch.sh b/launch.sh index 1dcce76873b5c3e664090d01ed279806584166a0..f37e48301966dbbfdade057cd9d17c61439c20b6 100755 --- a/launch.sh +++ b/launch.sh @@ -3,17 +3,14 @@ export HUBOT_ADAPTER=rocketchat export HUBOT_OWNER=RocketChat export HUBOT_NAME='CatBot' export HUBOT_DESCRIPTION="Processamento de linguagem natural com hubot" -#export ROCKETCHAT_URL=https://demo.rocket.chat -#export ROCKETCHAT_URL=http://localhost:3000 export ROCKETCHAT_URL=https://chat.dorgam.it -#export ROCKETCHAT_ROOM=j8pjQdHtZR5JnGF2S export ROCKETCHAT_ROOM=GENERAL export RESPOND_TO_DM=true export RESPOND_TO_LIVECHAT=true export ROCKETCHAT_USER=catbot -export ROCKETCHAT_PASSWORD='@cat!bot' +export ROCKETCHAT_PASSWORD='GatoNoTelhado' export ROCKETCHAT_AUTH=password export HUBOT_LOG_LEVEL=debug -export HUBOT_CORPUS='rocketenglish.yml' +export HUBOT_CORPUS='catbot-en.yml' export HUBOT_LANG='en' bin/hubot -a rocketchat diff --git a/package.json b/package.json index 3e710dbca0709f886a9d4d4061cd10392721090a..a75b8a833e3ce5607acf8a6325d93a01dac94685 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,11 @@ { "name": "hubot-natural", - "version": "0.0.6", + "version": "0.0.7", "private": true, "author": "Diego Dorgam <diego.dorgam@rocket.chat>", "description": "NLP YAML oriented chatbot", "dependencies": { - "coffee-script": "^1.12.7", + "coffeescript": "^1.12.7", "hubot": "^2.19.0", "hubot-diagnostics": "0.0.1", "hubot-help": "^0.2.2", diff --git a/scripts/bot/index.coffee b/scripts/bot/index.coffee index 7d686ab99f13562a6fcb3e7331ecfc7998aacd8b..785ed000f79262413d29288f29cfe4a667be3108 100644 --- a/scripts/bot/index.coffee +++ b/scripts/bot/index.coffee @@ -248,6 +248,13 @@ module.exports = (_config, _configPath, robot) -> msg = res.match[0].replace res.robot.name+' ', '' msg = msg.replace(/^\s+/, '') msg = msg.replace(/\s+&/, '') + # console.log '\n\n' + # console.log JSON.stringify(res.robot) + # console.log '\n\n' + console.log JSON.stringify(res.message) + console.log '\n\n' + console.log JSON.stringify(res.envelope) + console.log '\n\n' # check if robot should respond if res.envelope.user.roomType in ['c','p'] if (res.message.text.match new RegExp('\\b' + res.robot.name + '\\b', 'i')) or (res.message.text.match new RegExp('\\b' + res.robot.alias + '\\b', 'i')) diff --git a/training_data/catbot-en.yml b/training_data/catbot-en.yml index 736c49ebf72505f1f8d8a3df68e6d3d9a965ef82..3d2c3e7298501eef65996361f2dd84676947200c 100644 --- a/training_data/catbot-en.yml +++ b/training_data/catbot-en.yml @@ -4,15 +4,7 @@ interactions: # Greetings - name: greeting-hi expect: - - hey - - hi - - hi there - - heya - - hi bot - - Greetings - - hey bot - - hiii - - hey you + answer: - Hi, $user. - Just to let you know, I am a chatbot. I am trained to answer stuff @@ -32,6 +24,15 @@ interactions: - hello bot - what's up - what's going on + - hey + - hi + - hi there + - heya + - hi bot + - Greetings + - hey bot + - hiii + - hey you answer: - | Hello =), my name is CatBot, I'm an experimental ChatBot built in Rocket.Chat. @@ -55,8 +56,6 @@ interactions: answer: - I am great, $user. Everything is peaceful around here... - How can I be useful to you? - - Is there something you'd like to know about Rocket.Chat, support, installation, OpenSource movement maybe? - - pode perguntar a vontade event: respond type: block @@ -203,10 +202,8 @@ interactions: expect: - are you a woman - are you female - - are you a man - - are you male - do you have gender - - do you have sex + - you make sex - do you have a penis or vagina answer: - I don't have gender, I am just like an angel, a assexual being, way beyond your form of existance @@ -326,15 +323,10 @@ interactions: expect: - "configure debug-" - "set debug-" - - "let debug-" - - "turn debug-" - - "make debug-" - "var debug-" answer: - $key changed to $value! - Got it! Now $key is $value - - Sure thing! $key is set to $value - - blip blip =] $key equals $value - $key = $value -> https://media.giphy.com/media/12NUbkX6p4xOO4/giphy.gif event: configure type: random @@ -346,11 +338,14 @@ interactions: - "retrain bot" - "reload training" - "restart bot" + - "train again" answer: - - reloading training.. - - You got it $user - - Ok, just a moment - - Got it! Restarting engines... + - Right >>> Training reloaded + - You got it $user. Let's start again. + - Ok, just a moment... Fine we can start it over. + - Got it! Restarting engines... I'm finished training + - Training harder! + - Alright! No pain, no gain! event: configure type: random action: train