Git Product home page Git Product logo

Comments (4)

rajalala avatar rajalala commented on July 23, 2024

By "rasa responses" are you referring to messages from user or Rasa chatbot?

There is parameter onSocketEvent (see README) which allows one to listen and react to some of the socket events, including messages from the bot, but unfortunately that does not include messages from the user. (That event could also be exposed by would require changes to widget source code.)

from rasa-webchat.

MortezaAliyari avatar MortezaAliyari commented on July 23, 2024

Dear @rajalala thanks for your response.
Base on your expalnation onSocketEvent should work for me. I need to listen to messages from rasabot.
for example:
user: "hi"
bot: "Hi there, How can i help you?"
I need use bot response "Hi there, How can i help you?" and send it to my mobile robot.
How could i use below code in my html file?

onSocketEvent={{
  'bot_uttered': () => console.log('the bot said something'),
  'connect': () => console.log('connection established'),
  'disconnect': () => doSomeCleanup(),
}}

thanks in advance.

from rasa-webchat.

MortezaAliyari avatar MortezaAliyari commented on July 23, 2024

html code:

<html>
	<body>
		<script>!(function () {
		sessionStorage.clear();// remove chats history 
		
		  let e = document.createElement("script"),
		    t = document.head || document.getElementsByTagName("head")[0];
		  (e.src =
		    "https://cdn.jsdelivr.net/npm/[email protected]/lib/index.js"),
		 
		    (e.async = !0),
		    (e.onload = () => {
		      window.WebChat.default(
			{
			  intitpayload: '/greet',
			  customData: { language: "en" },
			  socketUrl: "http://0.0.0.0:5005",
			  params:{
			
				storage: "session" // chats history location is "session", default is "local"
				
			  }
			      

			},
			null
		      );
		    }),
		    t.insertBefore(e, t.firstChild);
		})();
		
	
		</script>



	</body>
</html>

from rasa-webchat.

stale avatar stale commented on July 23, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

from rasa-webchat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.