botfront / rasa-webchat

A feature-rich chat widget for Rasa and Botfront
https://botfront.io/rasa
Apache License 2.0
962 stars 497 forks source link

Rasa Webchat waiting for server error showing in website #325

Closed sid321axn closed 3 years ago

sid321axn commented 3 years ago

I am trying to use rasa web chat for my website integration with rasa x bot. But after deploying rasax over GCP it is not working while calling through rasa webchat using socket.io channel. but the bot is working fine when accessing directly through rasa x guest share using direct IP.

I am using below code for integrating rasa web chat in my index.html file

<script src="https://cdn.jsdelivr.net/npm/rasa-webchat@0.11.11/lib/index.min.js" type="text/javascript"></script>

    <script>
      WebChat.default.init({
        selector: "#webchat",
        initPayload: "/get_started",
        customData: {"language": "en"}, // arbitrary custom data. Stay minimal as this will be added to the socket
        socketUrl: "http://104.198.26.96",
        socketPath: "/socket.io/",
        profileAvatar: "syra.png",
        openLauncherImage: "syra.png",
        hideWhenNotConnected:false,
        title: "Syra",
        subtitle: "Digital Assistant for Tax Advice",
        params: {"storage": "session"} // can be set to "local"  or "session". details in storage section.
      })
    </script>

In credentials.yml file I have added following code block for socket.io channel

socketio:
  user_message_evt: user_uttered
  bot_message_evt: bot_uttered
  session_persistence: true

I have used docker-compose for deployement over gcp and rasa 2.0

forwitai commented 3 years ago

Hi, please I have a question. When you tried the integration locally, were you able to see the conversations users have with your bot through webchat in Rasa X conversations' history ? I can't find them anywhere.

sid321axn commented 3 years ago

I integrated Rasa with socket.io but it is showing this error

Traceback (most recent call last): File "c:\users\siddhartha\anaconda3\envs\installingrasa\lib\site-packages\socketio\asyncio_server.py", line 473, in _handle_event_internal r = await server._trigger_event(data[0], namespace, sid, data[1:]) File "c:\users\siddhartha\anaconda3\envs\installingrasa\lib\site-packages\socketio\asyncio_server.py", line 501, in _trigger_event ret = await self.handlers[namespace][event](args) File "c:\users\siddhartha\anaconda3\envs\installingrasa\lib\site-packages\rasa\core\channels\socketio.py", line 217, in handle_message await on_new_message(message) File "c:\users\siddhartha\anaconda3\envs\installingrasa\lib\site-packages\rasa\core\channels\channel.py", line 85, in handler await app.agent.handle_message(*args, kwargs) File "c:\users\siddhartha\anaconda3\envs\installingrasa\lib\site-packages\rasa\core\agent.py", line 522, in handle_message return await processor.handle_message(message) File "c:\users\siddhartha\anaconda3\envs\installingrasa\lib\site-packages\rasa\core\processor.py", line 98, in handle_message await self._predict_and_execute_next_action(message.output_channel, tracker) File "c:\users\siddhartha\anaconda3\envs\installingrasa\lib\site-packages\rasa\core\processor.py", line 566, in _predict_and_execute_next_action action, tracker, output_channel, self.nlg, policy, confidence File "c:\users\siddhartha\anaconda3\envs\installingrasa\lib\site-packages\rasa\core\processor.py", line 701, in _run_action await self.execute_side_effects(events, tracker, output_channel) File "c:\users\siddhartha\anaconda3\envs\installingrasa\lib\site-packages\rasa\core\processor.py", line 605, in execute_side_effects await self._send_bot_messages(events, tracker, output_channel) File "c:\users\siddhartha\anaconda3\envs\installingrasa\lib\site-packages\rasa\core\processor.py", line 621, in _send_bot_messages await output_channel.send_response(tracker.sender_id, e.message()) File "c:\users\siddhartha\anaconda3\envs\installingrasa\lib\site-packages\rasa\core\channels\channel.py", line 183, in send_response recipient_id, message.pop("text"), message.pop("buttons"), message File "c:\users\siddhartha\anaconda3\envs\installingrasa\lib\site-packages\rasa\core\channels\socketio.py", line 77, in send_text_with_buttons "payload": button["payload"], KeyError: 'payload'

sid321axn commented 3 years ago

Problem is half solved. Actually in my welcome message some button base responses are there which will trigger some actions but rasa web chat is not supporting buttons that why it showing error of payload. But when I am asking some other question it is working fine. is there any workaround for payloads?

sid321axn commented 3 years ago

The problem is resolved. There was a syntax error in payload part. Now working fine

Z1A1 commented 2 years ago

how did you solves ,please give steps