I want to give new line to every element of list when passing the list to SlotSet('deal_list',('\n'.join(list_of_deals))

slots: brand_list: type: list category_name: type: text city_name: type: text deal_list: type: list name: type: text responses: utter_greet:

  • text: Hello! How can I help? utter_ask_city:
  • text: Tell me your City? utter_ask_category:
  • text: Tell me the category to show you the related brands? utter_goodbye:
  • text: Talk to you later.
  • text: Bye bye :frowning: utter_ask_brand:
  • text: Tell me your favourite brand? utter_list_of_deals:
  • text: ‘Here are the list of deals:’
  • text: “{deal_list}\n\n” utter_list_of_brands:
  • text: “{brand_list}\n”

-----This is where i am returning the list

-----This is my list code

		for i in range(0, len(brand_response_json["data"][0]["result"])):

				title = brand_response_json["data"][0]["result"][i]["offer"][0]["title"]
				sub_title = brand_response_json["data"][0]["result"][i]["offer"][0]["sub_title"]
				offer_description = brand_response_json["data"][0]["result"][i]["offer"][0]["offer_description"]
				print("Deal {} name is: ".format(count) + title)
				response_title ="Deal {} name is: ".format(count) + title
				count = count + 1
				if sub_title == "":
					response_sub_title = end=''
					print("Offer on this deal is: " + sub_title)
					response_sub_title =  "Offer on this deal is: " + sub_title
				print("Offer description on this deal is: " + offer_description + "\n")
				response_offer_description = "Offer description on this deal is: " + offer_description + "\n"

This is the output which was coming

need urgent help ??? @Juste @jason @JiteshGaikwand @samscudder @erohmensing @Bunny99

I have actions returning text on separate lines in rasa shell that show up wrong in Rasa X. I guess it would depend on how the front end is rendering it. I haven’t tried, but what happens if you join with '<br />' instead of /n?

Another thing you could do is use an action instead of the response, and have several phrases, something like this:

class ShowList(Action):
    def name(self):
        return "action_showlist"

    def run(self, dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:

        slot_value = tracker.get_slot('deal_list')
        deal_list = slot_value.split('\n')

        for j in deal_list
            dispatcher.utter_message(str(j), tracker)

        return [Form(None), SlotSet('requested_slot', None)]

And then just call action_showlist