scalableminds / chatroom

React-based Chatroom Component for Rasa Stack
https://npm-scalableminds.s3.eu-central-1.amazonaws.com/@scalableminds/chatroom@master/demo.html
GNU Affero General Public License v3.0
307 stars 208 forks source link

Rasa + chatroom, can not integrate #101

Closed GraphGrailAi closed 5 years ago

GraphGrailAi commented 5 years ago

I am trying to get rasa-demo to work with chatroom - but no luck. I have downloaded repo https://github.com/RasaHQ/rasa-demo, train was successful with no errors, models created. Tried both https://github.com/scalableminds/chatroom and https://github.com/mrbot-ai/rasa-webchat

What done: 1) Created new html file with following code as suggested in docs https://github.com/scalableminds/chatroom:

<head>
  <link rel="stylesheet" href="https://npm-scalableminds.s3.eu-central-1.amazonaws.com/@scalableminds/chatroom@master/dist/Chatroom.css" />
</head>
<body>
  <div class="chat-container"></div>
  <script src="https://npm-scalableminds.s3.eu-central-1.amazonaws.com/@scalableminds/chatroom@master/dist/Chatroom.js"/></script>
  <script type="text/javascript">
    var chatroom = window.Chatroom({
      host: "http://localhost:5005",
      title: "Chat with Mike",
      container: document.querySelector(".chat-container"),
      welcomeMessage: "Hi, I am Mike. How may I help you?",
      speechRecognition: "en-US"
    });
    chatroom.openChat();
  </script>
</body>

2) Created a credentials file (credentials.yml) inside rasa-demo-master folder of repo with the following content: (refer to https://rasa.com/docs/core/connectors/#socketio-connector and https://stackoverflow.com/questions/53187184/rasa-webchat-integration)

socketio:
    user_message_evt: user_uttered
    bot_message_evt: bot_uttered

3) Run python -m rasa_core.run -d models/dialogue -u models/nlu/current --port 5005 --credentials credentials.yml

I got output in console: (Ubuntu 19)

joo@joo-tf:~/Документы/LocalRepository/rasa-demo-master$ python -m rasa_core.run -d models/dialogue -u models/nlu/current --port 5005 --credentials credentials.yml
/home/joo/anaconda3/lib/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
/home/joo/anaconda3/lib/python3.6/runpy.py:125: RuntimeWarning: 'rasa_core.run' found in sys.modules after import of package 'rasa_core', but prior to execution of 'rasa_core.run'; this may result in unpredictable behaviour
  warn(RuntimeWarning(msg))
2019-05-19 22:27:12 INFO     root  - Rasa process starting
2019-05-19 22:27:12.075735: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2019-05-19 22:27:12.102039: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 3408000000 Hz
2019-05-19 22:27:12.102509: I tensorflow/compiler/xla/service/service.cc:150] XLA service 0x559bcd483f20 executing computations on platform Host. Devices:
2019-05-19 22:27:12.102533: I tensorflow/compiler/xla/service/service.cc:158]   StreamExecutor device (0): <undefined>, <undefined>
WARNING:tensorflow:From /home/joo/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/saver.py:1266: checkpoint_exists (from tensorflow.python.training.checkpoint_management) is deprecated and will be removed in a future version.
Instructions for updating:
Use standard file APIs to check for files with this prefix.
2019-05-19 22:27:12 WARNING  tensorflow  - From /home/joo/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/saver.py:1266: checkpoint_exists (from tensorflow.python.training.checkpoint_management) is deprecated and will be removed in a future version.
Instructions for updating:
Use standard file APIs to check for files with this prefix.
INFO:tensorflow:Restoring parameters from models/nlu/current/component_3_EmbeddingIntentClassifier.ckpt
2019-05-19 22:27:12 INFO     tensorflow  - Restoring parameters from models/nlu/current/component_3_EmbeddingIntentClassifier.ckpt
2019-05-19 22:27:12 INFO     apscheduler.scheduler  - Scheduler started
WARNING: The TensorFlow contrib module will not be included in TensorFlow 2.0.
For more information, please see:
  * https://github.com/tensorflow/community/blob/master/rfcs/20180907-contrib-sunset.md
  * https://github.com/tensorflow/addons
If you depend on functionality not listed there, please file an issue.
WARNING:tensorflow:From /home/joo/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/resource_variable_ops.py:435: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Colocations handled automatically by placer.
2019-05-19 22:27:13 WARNING  tensorflow  - From /home/joo/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/resource_variable_ops.py:435: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Colocations handled automatically by placer.
WARNING:tensorflow:From /home/joo/anaconda3/lib/python3.6/site-packages/tensorflow/python/keras/backend.py:4010: calling dropout (from tensorflow.python.ops.nn_ops) with keep_prob is deprecated and will be removed in a future version.
Instructions for updating:
Please use `rate` instead of `keep_prob`. Rate should be set to `rate = 1 - keep_prob`.
2019-05-19 22:27:13 WARNING  tensorflow  - From /home/joo/anaconda3/lib/python3.6/site-packages/tensorflow/python/keras/backend.py:4010: calling dropout (from tensorflow.python.ops.nn_ops) with keep_prob is deprecated and will be removed in a future version.
Instructions for updating:
Please use `rate` instead of `keep_prob`. Rate should be set to `rate = 1 - keep_prob`.
WARNING:tensorflow:From /home/joo/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py:3066: to_int32 (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.cast instead.
2019-05-19 22:27:13 WARNING  tensorflow  - From /home/joo/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py:3066: to_int32 (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.cast instead.
2019-05-19 22:27:14 INFO     root  - Rasa Core server is up and running on http://localhost:5005
127.0.0.1 - - [2019-05-19 22:27:53] "GET /webhooks/chatroom/conversations/581bbacb-9e64-4540-ad8d-0e295218831d/log?nocache=1558294072984 HTTP/1.1" 404 342 0.001709
127.0.0.1 - - [2019-05-19 22:27:53] "GET /webhooks/chatroom/conversations/581bbacb-9e64-4540-ad8d-0e295218831d/log?nocache=1558294073571 HTTP/1.1" 404 342 0.002112
127.0.0.1 - - [2019-05-19 22:27:54] "GET /webhooks/chatroom/conversations/581bbacb-9e64-4540-ad8d-0e295218831d/log?nocache=1558294074589 HTTP/1.1" 404 342 0.000531
127.0.0.1 - - [2019-05-19 22:27:55] "GET /webhooks/chatroom/conversations/581bbacb-9e64-4540-ad8d-0e295218831d/log?nocache=1558294075622 HTTP/1.1" 404 342 0.001741
127.0.0.1 - - [2019-05-19 22:27:56] "GET /webhooks/chatroom/conversations/581bbacb-9e64-4540-ad8d-0e295218831d/log?nocache=1558294076695 HTTP/1.1" 404 342 0.002742

When i navigate to html file created on the first step I can see that server start output very second like 127.0.0.1 - - [2019-05-19 22:27:53] "GET /webhooks/chatroom/conversations/581bbacb-9e64-4540-ad8d-0e295218831d/log?nocache=1558294072984 HTTP/1.1" 404 342 0.001709

I assume i am on the right path, but chatroom never answer to my posts from browser

hotzenklotz commented 5 years ago

Looks like you are on the right track. If you can see traffics logs in the Rasa Core output (e.g. GET /webhooks/chatroom/conversations/.../log?) then everything should be connected together correctly.

That being said, there could very well be a bug in connecting to the latest Rasa Core version. (Haven't try that one yet.) The Rasa APIs change very rapidly.

Have you checked the output of your browser's dev tools? Especially the Network tab is interesting as it shows the requests from the Chat frontend. The log requests are polling for new information from the server. What happens when you write something in the Chat? (say request)

GraphGrailAi commented 5 years ago

I can do this today, could you suggest version with 100% success - i will reinstall fast ans test it

GraphGrailAi commented 5 years ago

Here screens of web inteface with network tab and terminal, say hello

Снимок экрана от 2019-05-20 12-10-26 Снимок экрана от 2019-05-20 12-09-54

hotzenklotz commented 5 years ago

@GraphGrailAi All requests fail with a 404 error. Looks like something is not connected correctly. What does your credentials.yamllook like? I suspect this is the problem. Make sure include the channel adapter for the Chatroom (amongst all your other channels. E.g. something like this:

socketio:
  user_message_evt: user_uttered
  bot_message_evt: bot_uttered
  session_persistence: true
rest:
  # pass
<path_to_code>.bot_server_channel.BotServerInputChannel:
  # pass

I just tried the chatroom with a new bot project running on Rasa Core 0.13.7 without any problems.

hnithyanandam commented 5 years ago

I am also facing the same issue. I tried using

rasa-core==0.11.1
rasa-core-sdk==0.11.0
rasa-nlu==0.13.2

My credentials.yml file is (I created a folder rasa_utils and posted the file in the github there)

rasa_utils.bot_server_channel.BotServerInputChannel:
#pass

i am running the server using this command. python -m rasa_core.run --enable_api -d models/dialogue -u models/current/nlu --port 5005 --endpoints endpoints.yml --credentials credentials.yml --cors "*"

Kindly help what i am missing.

Also do i have to change the port to 5005 from 5002 in inputchannel

def __init__(
        self, agent=None, preprocessor=None, port=5002, message_store=FileMessageStore()
    )
hotzenklotz commented 5 years ago

@hnithyanandam @GraphGrailAi Please provide a link to a GitHub repository of the code for debugging.

Also do i have to change the port to 5005 from 5002 in inputchannel I don't think you have to do this. This is old code (that we probably should delete). The port should be the same as your Rasa Core configuration / port. (e.g. 5005)

hnithyanandam commented 5 years ago

@hotzenklotz Please find the code https://github.com/hnithyanandam/samplerasabot

hnithyanandam commented 5 years ago

I changed the port to 5005 and tried. Still not working

GraphGrailAi commented 5 years ago

@hotzenklotz Cool! I was able to launch it! But this only works with this repo: https://github.com/RasaHQ/starter-pack-rasa-stack (i tried with rasa-demo where i was unable to install https://github.com/facebook/duckling and rasa-nlu repo, where problems with no domain.yml and other files)

Also, to launch server from terminal i changed a path to models:

joo@joo-tf:~/Документы/LocalRepository/starter-pack-rasa-stack$ python -m rasa_core.run -d models/current/dialogue -u models/current/nlu --port 5005 --credentials credentials.yml

Only after that chat widget start responding with 200 code

Снимок экрана от 2019-05-20 17-59-24

I still curious should port be the same in terminal --port 5005 and in endpoints.yml: action_endpoint: url: "http://localhost:5055/webhook"

GraphGrailAi commented 5 years ago

i close

hnithyanandam commented 5 years ago

I am still facing the same issue..Rasa server continuously getting 404 for conversation logs. Is it because of using older version?

GraphGrailAi commented 5 years ago

@hnithyanandam I use Rasa newest version from https://rasa.com/docs/core/installation/#latest-most-recent-github My experience 404 may be because different port in files endpoints.yml and when calling from command line.