Multi Lingual Chat Bot using Rasa

Hello Everyone, I have created two bots in English and Hindi language respectively. I want user to select the language he wishes to choose from the front end and then call the respective bot server. Please help

@JiteshGaikwad please help

It depends on your fronted.

So if English bot is running on port 5005 and Hindi bot is running on port 5006.

So In your front-end you can provide options to the user which language to select and then once user selects the language, you trigger the respective endpoint of the bot and start the conversation.

1 Like

@JiteshGaikwad I am using rasa custom UI Rasa Custom UI . And Language button suggestion is coming from the rasa server and handled by addsuggestions function.

function addSuggestion(textToAdd) {
	setTimeout(function () {
		var suggestions = textToAdd;
		var suggLength = textToAdd.length;
		$(' <div class="singleCard"> <div class="suggestions"><div class="menu"></div></div></diV>').appendTo('.chats').hide().fadeIn(1000);
		// Loop through suggestions
		for (i = 0; i < suggLength; i++) {
			$('<div class="menuChips" data-payload=\''+(suggestions[i].payload)+'\'>' + suggestions[i].title + "</div>").appendTo(".menu");
	}, 1000);

// on click of suggestions, get the value and send to rasa
$(document).on("click", ".menu .menuChips", function () {
	var text = this.innerText;
	var payload= this.getAttribute('data-payload');
	console.log("button payload: ",this.getAttribute('data-payload'))
	$('.suggestions').remove(); //delete the suggestions 

How it would handle button click to call respective rasa server based on language.

@pankaj676, follow the below stesp:

  • you need to add buttons in you front-end before calling the Rasa server, the Language button suggestion which you are trying to send from Rasa must be shown directly from the front-end not from Rasa server.

  • so those language buttons are not the part of response of Rasa server, it should be as hardcoded buttons from the UI and you must not handle those button click event using the addSuggestion function since it handles the response of Rasa server

  • you need to write a function similar to addSuggestion which will check the language selected by user and then call the respective language bot of the Rasa.

1 Like

Also the UI which you are using have been archived, please use the updated UI:

I have hard coded first message as told by you but now after user selects the language how could one proceed because now only one server should remain active. and send function calls the server. can you provide sample code how could one server remain set during conversation in particular language unless user again change it from menu. thanks

you can run this bots in two different port.

as I mentioned here.

I haven’t done this before, so I don’t anything to share

1 Like

Thank You @JiteshGaikwad

1 Like

Welcome @pankaj676 :slightly_smiling_face:

@JiteshGaikwad can you explain this further? What do you mean by hardcode? And what file do I use to implement this?

can you help me how you have implemented hindi bot using rasa, as @JiteshGaikwad widget Github link is showing not found.

You can watch this video