rasa-webchat icon indicating copy to clipboard operation
rasa-webchat copied to clipboard

Chat window doesn't work "Waiting for server". Early version doesn't return answers.

Open true1337 opened this issue 7 years ago • 11 comments

I still getting "Waiting for server..." and can't type anything.

Please, help me configure Rasa X and Rasa-Webchat to interact with each other.

Logs:

2019-06-21 12:09:15 INFO     engineio.server  - 9a588e8482e840efbb49d93619d03712: Sending packet OPEN data {'sid': '9a588e8482e840efbb49d93619d03712', 'upgrades': ['websocket'], 'pingTimeout': 60000, 'pingInterval': 25000}
2019-06-21 12:09:15 DEBUG    rasa.core.channels.socketio  - User 9a588e8482e840efbb49d93619d03712 connected to socketIO endpoint.
2019-06-21 12:09:15 INFO     engineio.server  - 9a588e8482e840efbb49d93619d03712: Sending packet MESSAGE data 0

Backend db: sqlite

Versions:

rasa                    1.1.3
rasa-sdk                1.1.0
rasa-x                  0.19.2

Webchat

<script src="https://storage.googleapis.com/mrbot-cdn/webchat-0.5.9.js"></script>
<script>
	WebChat.default.init({
		selector: "#webchat",
		//initPayload: "/get_started",
		interval: 1000, // 1000 ms between each message
		customData: {"userId": "123"}, // arbitrary custom data. Stay minimal as this will be added to the socket
		socketUrl: "http://localhost:5005",
		socketPath: "/socket.io",
		title: "Title",
		subtitle: "Subtitle",
		inputTextFieldHint: "Type a message...",
		connectingText: "Waiting for server...",
		hideWhenNotConnected: false,
		fullScreenMode: false,
		//profileAvatar: "https://rasa.com/assets/img/demo/rasa_avatar.png",
		openLauncherImage: 'myCustomOpenImage.png',
		closeLauncherImage: 'myCustomCloseImage.png',
		params: {
			images: {
				dims: {
					width: 1000,
					height: 1000,
				}
			},
			storage: "local"
		}
	})
</script>

Config:

socketio:
  user_message_evt: user_uttered
  bot_message_evt: bot_uttered
  session_persistence: false

Changing session_persistence to true doesn't do anything.

Changing webchat's version to 0.4.1 allows to type messages but rasa backend still doesn't accept anything.

Using rest api channel with another webchat repository works.

true1337 avatar Jun 23 '19 15:06 true1337

You need to use the socket io channel

znat avatar Jun 23 '19 19:06 znat

What do you mean? I’m already using the socket io channel by uncommenting the fields in Rasa config. See here https://rasa.com/docs/rasa/user-guide/connectors/your-own-website/

Socketio: https://github.com/RasaHQ/rasa/blob/master/rasa/core/channels/socketio.py

true1337 avatar Jun 24 '19 06:06 true1337

Can you provide an example how to use the webchat window e.g. in Flask?

I'm trying like this:

from flask import Flask, render_template
from flask_socketio import SocketIO

app = Flask(__name__)
socketio = SocketIO(app)

@app.route('/')
def hello_world():
    return render_template('base.html')

if __name__ == "__main__":
    socketio.run(app, debug=True)

true1337 avatar Jun 24 '19 15:06 true1337

Alright, this is about CORS:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:5002/socket.io/?EIO=3&transport=polling&t=MkIwWwK. (Reason: CORS request did not succeed).
Error: "xhr poll error"

rasa run --cors "*" didn't work.

Solution: used ngrok instead of localhost for host param.

socketUrl: "http://localhost:5002", //"http://XXXXXXXXXXX.ngrok.io/",

true1337 avatar Jun 26 '19 08:06 true1337

You need to use the socket io channel

i am also facing waiting for server and getting 400 Bad request and not able to get through.

can you please help me.

i have installed latest rasa_core version with pip install rasa_core and used lastes webchat.js but i am getting error 400

tracker_predict POST, OPTIONS /predict static HEAD, GET, OPTIONS /static/[filename] status HEAD, GET, OPTIONS /status version HEAD, GET, OPTIONS /version fb_webhook.health HEAD, GET, OPTIONS /webhooks/facebook/ fb_webhook.webhook POST, OPTIONS /webhooks/facebook/webhook slack_webhook.health HEAD, GET, OPTIONS /webhooks/slack/ slack_webhook.webhook POST, HEAD, GET, OPTIONS /webhooks/slack/webhook socketio_webhook.health HEAD, GET, OPTIONS /webhooks/socketio/ 2019-08-12 23:38:53 INFO root - Rasa Core server is up and running on http://localhost:5005 127.0.0.1 - - [2019-08-12 23:38:57] "GET /socket.io/?EIO=3&transport=polling&t=Mo9ityA HTTP/1.1" 400 122 0.000583 127.0.0.1 - - [2019-08-12 23:39:03] "GET /socket.io/?EIO=3&transport=polling&t=Mo9ivQD HTTP/1.1" 400 122 0.005541 127.0.0.1 - - [2019-08-12 23:39:09] "GET /socket.io/?EIO=3&transport=polling&t=Mo9iwuD HTTP/1.1" 400 122 0.000164 127.0.0.1 - - [2019-08-12 23:39:15] "GET /socket.io/?EIO=3&transport=polling&t=Mo9iyME HTTP/1.1" 400 122 0.000399 127.0.0.1 - - [2019-08-12 23:39:21] "GET /socket.io/?EIO=3&transport=polling&t=Mo9izq8 HTTP/1.1" 400 122 0.000581 127.0.0.1 - - [2019-08-12 23:39:26] "GET /socket.io/?EIO=3&transport=polling&t=Mo9i_2Z HTTP/1.1" 400 122 0.000192 127.0.0.1 - - [2019-08-12 23:39:31] "GET /socket.io/?EIO=3&transport=polling&t=Mo9j0Gr HTTP/1.1" 400 122 0.000670

Initially when i used webchat version >=0.5.0 i was not able to see chatbot but later when i switched to 0.4.1 or 0.4.2 i can see the chatbot but it is not responding and still i am getting error 400 on console.

please help me as i am stuck with my POC demonstration.

TarunKumar50 avatar Aug 14 '19 08:08 TarunKumar50

Have you set session_persistence: true ?

Le mer. 14 août 2019 04 h 18, TarunKumar50 [email protected] a écrit :

You need to use the socket io channel

i am also facing waiting for server and getting 400 Bad request and not able to get through.

can you please help me.

i have installed latest rasa_core version with pip install rasa_core and used lastes webchat.js but i am getting error 400

tracker_predict POST, OPTIONS /predict static HEAD, GET, OPTIONS /static/[filename] status HEAD, GET, OPTIONS /status version HEAD, GET, OPTIONS /version fb_webhook.health HEAD, GET, OPTIONS /webhooks/facebook/ fb_webhook.webhook POST, OPTIONS /webhooks/facebook/webhook slack_webhook.health HEAD, GET, OPTIONS /webhooks/slack/ slack_webhook.webhook POST, HEAD, GET, OPTIONS /webhooks/slack/webhook socketio_webhook.health HEAD, GET, OPTIONS /webhooks/socketio/ 2019-08-12 23:38:53 INFO root - Rasa Core server is up and running on http://localhost:5005 127.0.0.1 - - [2019-08-12 23:38:57] "GET / socket.io/?EIO=3&transport=polling&t=Mo9ityA HTTP/1.1" 400 122 0.000583 127.0.0.1 - - [2019-08-12 23:39:03] "GET / socket.io/?EIO=3&transport=polling&t=Mo9ivQD HTTP/1.1" 400 122 0.005541 127.0.0.1 - - [2019-08-12 23:39:09] "GET / socket.io/?EIO=3&transport=polling&t=Mo9iwuD HTTP/1.1" 400 122 0.000164 127.0.0.1 - - [2019-08-12 23:39:15] "GET / socket.io/?EIO=3&transport=polling&t=Mo9iyME HTTP/1.1" 400 122 0.000399 127.0.0.1 - - [2019-08-12 23:39:21] "GET / socket.io/?EIO=3&transport=polling&t=Mo9izq8 HTTP/1.1" 400 122 0.000581 127.0.0.1 - - [2019-08-12 23:39:26] "GET / socket.io/?EIO=3&transport=polling&t=Mo9i_2Z HTTP/1.1" 400 122 0.000192 127.0.0.1 - - [2019-08-12 23:39:31] "GET / socket.io/?EIO=3&transport=polling&t=Mo9j0Gr HTTP/1.1" 400 122 0.000670

Initially when i used webchat version >=0.5.0 i was not able to see chatbot but later when i switched to 0.4.1 or 0.4.2 i can see the chatbot but it is not responding and still i am getting error 400 on console.

please help me as i am stuck with my POC demonstration.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mrbot-ai/rasa-webchat/issues/91?email_source=notifications&email_token=AA4GAKW5QCZ5DCPUHBBHZM3QEO5UNA5CNFSM4H2ZGP2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4IB2BI#issuecomment-521149701, or mute the thread https://github.com/notifications/unsubscribe-auth/AA4GAKU5VD2XPNZG2VKQ773QEO5UNANCNFSM4H2ZGP2A .

znat avatar Aug 14 '19 12:08 znat

Yes

On Wed, 14 Aug 2019, 18:01 Nathan Zylbersztejn, [email protected] wrote:

Have you set session_persistence: true ?

Le mer. 14 août 2019 04 h 18, TarunKumar50 [email protected] a écrit :

You need to use the socket io channel

i am also facing waiting for server and getting 400 Bad request and not able to get through.

can you please help me.

i have installed latest rasa_core version with pip install rasa_core and used lastes webchat.js but i am getting error 400

tracker_predict POST, OPTIONS /predict static HEAD, GET, OPTIONS /static/[filename] status HEAD, GET, OPTIONS /status version HEAD, GET, OPTIONS /version fb_webhook.health HEAD, GET, OPTIONS /webhooks/facebook/ fb_webhook.webhook POST, OPTIONS /webhooks/facebook/webhook slack_webhook.health HEAD, GET, OPTIONS /webhooks/slack/ slack_webhook.webhook POST, HEAD, GET, OPTIONS /webhooks/slack/webhook socketio_webhook.health HEAD, GET, OPTIONS /webhooks/socketio/ 2019-08-12 23:38:53 INFO root - Rasa Core server is up and running on http://localhost:5005 127.0.0.1 - - [2019-08-12 23:38:57] "GET / socket.io/?EIO=3&transport=polling&t=Mo9ityA HTTP/1.1" 400 122 0.000583 127.0.0.1 - - [2019-08-12 23:39:03] "GET / socket.io/?EIO=3&transport=polling&t=Mo9ivQD HTTP/1.1" 400 122 0.005541 127.0.0.1 - - [2019-08-12 23:39:09] "GET / socket.io/?EIO=3&transport=polling&t=Mo9iwuD HTTP/1.1" 400 122 0.000164 127.0.0.1 - - [2019-08-12 23:39:15] "GET / socket.io/?EIO=3&transport=polling&t=Mo9iyME HTTP/1.1" 400 122 0.000399 127.0.0.1 - - [2019-08-12 23:39:21] "GET / socket.io/?EIO=3&transport=polling&t=Mo9izq8 HTTP/1.1" 400 122 0.000581 127.0.0.1 - - [2019-08-12 23:39:26] "GET / socket.io/?EIO=3&transport=polling&t=Mo9i_2Z HTTP/1.1" 400 122 0.000192 127.0.0.1 - - [2019-08-12 23:39:31] "GET / socket.io/?EIO=3&transport=polling&t=Mo9j0Gr HTTP/1.1" 400 122 0.000670

Initially when i used webchat version >=0.5.0 i was not able to see chatbot but later when i switched to 0.4.1 or 0.4.2 i can see the chatbot but it is not responding and still i am getting error 400 on console.

please help me as i am stuck with my POC demonstration.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/mrbot-ai/rasa-webchat/issues/91?email_source=notifications&email_token=AA4GAKW5QCZ5DCPUHBBHZM3QEO5UNA5CNFSM4H2ZGP2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4IB2BI#issuecomment-521149701 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AA4GAKU5VD2XPNZG2VKQ773QEO5UNANCNFSM4H2ZGP2A

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mrbot-ai/rasa-webchat/issues/91?email_source=notifications&email_token=AJWOKETZSLRGETWJUMDQDCDQEP3LBA5CNFSM4H2ZGP2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4IUR4A#issuecomment-521226480, or mute the thread https://github.com/notifications/unsubscribe-auth/AJWOKEW7S6WSJ777ZIAO3JLQEP3LBANCNFSM4H2ZGP2A .

TarunKumar50 avatar Aug 14 '19 13:08 TarunKumar50

Previously it was working on my other system but that got crashed and I have to start from scratch.session persistence: true I have used.please suggest how can I resolve it.

TarunKumar50 avatar Aug 15 '19 06:08 TarunKumar50

Ok, your problem is because is because engineio has been updated and requires now an explicit CORS directive. You can see how we do it for Botfront: https://github.com/botfront/rasa-addons/blob/c82ac585c028b76e87580ee18ec6e815d719b088/rasa_addons/core/channels/webchat.py#L148

znat avatar Aug 15 '19 13:08 znat

Thanks for your help, now I can talk to my bot after upgrading to latest version and using RasaHQ repo and making the changes which u suggested in socketio.py file.

TarunKumar50 avatar Aug 16 '19 05:08 TarunKumar50

@znat now bot is getting connected but not getting answer from bot. if you can help would be great.thanks.

Here is my config.yml file

Configuration for Rasa NLU.

https://rasa.com/docs/rasa/nlu/components/

language: en pipeline: supervised_embeddings

Configuration for Rasa Core.

https://rasa.com/docs/rasa/core/policies/

policies:

  • name: "KerasPolicy" featurizer:
    • name: MaxHistoryTrackerFeaturizer max_history: 5 state_featurizer:
      • name: BinarySingleStateFeaturizer
  • name: "MemoizationPolicy" max_history: 5
  • name: "FallbackPolicy" nlu_threshold: 0.4 core_threshold: 0.3 fallback_action_name: "utter_default"

When training the core getting "Object of type 'MaxHistoryTrackerFeaturizer' is not JSON serializable'


2019-08-16 11:19:33 INFO rasa.core.policies.keras_policy - Done fitting keras policy model Processed trackers: 100%|███████████████████████████████████████████████████████████████████████████████████████████████| 17/17 [00:00<00:00, 657.52it/s, # actions=105] Processed actions: 105it [00:00, 5027.53it/s, # examples=105] 2019-08-16 11:19:34 INFO rasa.core.agent - Persisted model to '/tmp/tmp5vuuy737/core' Core model training completed. Traceback (most recent call last): File "/home/vinbox/Documents/environments/my_env/bin/rasa", line 11, in sys.exit(main()) File "/home/vinbox/Documents/environments/my_env/lib/python3.6/site-packages/rasa/main.py", line 76, in main cmdline_arguments.func(cmdline_arguments) File "/home/vinbox/Documents/environments/my_env/lib/python3.6/site-packages/rasa/cli/train.py", line 112, in train_core kwargs=extract_additional_arguments(args), File "/home/vinbox/Documents/environments/my_env/lib/python3.6/site-packages/rasa/train.py", line 243, in train_core kwargs=kwargs, File "uvloop/loop.pyx", line 1417, in uvloop.loop.Loop.run_until_complete File "/home/vinbox/Documents/environments/my_env/lib/python3.6/site-packages/rasa/train.py", line 299, in train_core_async kwargs=kwargs, File "/home/vinbox/Documents/environments/my_env/lib/python3.6/site-packages/rasa/train.py", line 337, in _train_core_with_validated_data new_fingerprint = await model.model_fingerprint(file_importer) File "/home/vinbox/Documents/environments/my_env/lib/python3.6/site-packages/rasa/model.py", line 216, in model_fingerprint config, include_keys=CONFIG_MANDATORY_KEYS_CORE File "/home/vinbox/Documents/environments/my_env/lib/python3.6/site-packages/rasa/model.py", line 241, in _get_hash_of_config return get_dict_hash(sub_config) File "/home/vinbox/Documents/environments/my_env/lib/python3.6/site-packages/rasa/core/utils.py", line 357, in get_dict_hash return md5(json.dumps(data, sort_keys=True).encode(encoding)).hexdigest() File "/usr/lib/python3.6/json/init.py", line 238, in dumps **kw).encode(obj) File "/usr/lib/python3.6/json/encoder.py", line 199, in encode chunks = self.iterencode(o, _one_shot=True) File "/usr/lib/python3.6/json/encoder.py", line 257, in iterencode return _iterencode(o, 0) File "/usr/lib/python3.6/json/encoder.py", line 180, in default o.class.name) TypeError: Object of type 'MaxHistoryTrackerFeaturizer' is not JSON serializable


when i run 'rasa run' it gives "No policy ensemble or domain set. Skipping action prediction and execution." due to which not getting answer from bot.


sion_id":"762b3287e2aa4247bfab97c5c5992ceb"}]', rsv1=False, rsv2=False, rsv3=False) 2019-08-16 10:38:12 INFO engineio.server - e7f33a068fba4cd1ab812afbb28f0b74: Received packet MESSAGE data 2["user_uttered",{"message":"hello","customData":{"userId":"123"},"session_id":"762b3287e2aa4247bfab97c5c5992ceb"}] 2019-08-16 10:38:12 INFO socketio.server - received event "user_uttered" from e7f33a068fba4cd1ab812afbb28f0b74 [/] 2019-08-16 10:38:12 DEBUG rasa.core.agent - Created a new lock for conversation '762b3287e2aa4247bfab97c5c5992ceb' 2019-08-16 10:38:12 DEBUG rasa.core.tracker_store - Recreating tracker for id '762b3287e2aa4247bfab97c5c5992ceb' 2019-08-16 10:38:12 DEBUG rasa.core.processor - Received user message 'hello' with intent '{'name': 'greet', 'confidence': 0.9571930170059204}' and entities '[]' 2019-08-16 10:38:12 DEBUG rasa.core.processor - Logged UserUtterance - tracker now has 3 events 2019-08-16 10:38:12 WARNING rasa.core.processor - No policy ensemble or domain set. Skipping action prediction and execution. 2019-08-16 10:38:12 DEBUG rasa.core.agent - Deleted lock for conversation '762b3287e2aa4247bfab97c5c5992ceb' (unused) 2019-08-16 10:38:21 DEBUG websockets.protocol - undefined < Frame(fin=True, opcode=1, data=b'2', rsv1=False, rsv2=False, rsv3=False) 2019-08-16 10:38:21 INFO engineio.server - ad54899d07a34c3c9506ab7afcb2f774: Received packet PING data None 2019-08-16 10:38:21 INFO engineio.server - ad54899d07a34c3c9506ab7afcb2f774: Sending packet PONG data None


TarunKumar50 avatar Aug 16 '19 19:08 TarunKumar50