hello people right now i am facing this problem that representation that i am getting on my google assistant interface like this , how can i solve this , I’ll be really thankful to you @Juste @Bunny99 @jason @yashwanths112 @JiteshGaikwand @samscudder
“here is my action.py code:”
"class ActionCategory(Action): #cat_key = 1
def name(self): return ‘action_category’
def run(self, dispatcher, tracker, domain):
category_response = “http://165.227.69.207:9001/api/category/get” category_response_json = requests.get(category_response).json() category_ls = {}
print(“--------cityid--------------------”)
c_name = tracker.get_slot(‘category_name’)
if c_name == None: print(“category not coming”) else: print(“category coming” + c_name)
category_input = str(input(“Enter Category Name”))
for i in range(0, len(category_response_json[“data”])): category_id = category_response_json[“data”][i][“_id”] category_name = category_response_json[“data”][i][“name”] category_ls.update({category_name: category_id})
category_ls = {k.lower(): v for k, v in category_ls.items()}
for key, value in category_ls.items(): if c_name in key: print(key, value) cat_key = value
return cat_key
city_response = “http://165.227.69.207:9001/api/country/get” city_response_json = requests.get(city_response).json() print(“-getting city name”) city_namee = tracker.get_slot(‘city_name’)
if city_namee == None: print(“city not coming”)
else: print("city coming " + city_namee)
city_ls = {}
for i in range(0, len(city_response_json[“data”][0][“cities”])): city_id = city_response_json[“data”][0][“cities”][i][“_id”] city_name = city_response_json[“data”][0][“cities”][i][“city_name”] city_ls.update({city_name: city_id})
print(city_namee) city_ls = {k.lower(): v for k, v in city_ls.items()} for key, value in city_ls.items(): if city_namee in key: print(city_namee) print(key, value) city_key = value
brand_response = “http://165.227.69.207:9001/api/category/getBrandByCategory/{}?city_id={}&customer_id=53616c7465645f5faa59ae365d53a918300db538b645f77228ee71e304203c78dd7d9ef7916465f50aebc40159a6d677”.format( cat_key, city_key) brand_response_json = requests.get(brand_response).json() print(“brand list coming”) brand_ls = count1 = 1 #for i in range(0, len(brand_response_json[“data”][0][“result”])): for i in range(0, 10): brand_name = "{}. ".format(count1) + brand_response_json[“data”][0][“result”][i][“name”] count1 = count1 + 1 brand_ls.append(brand_name) #brand_name_ = “” #brand_ls = [str(x + 1) for x in brand_ls]
if c_name in category_ls: print(c_name) #c_name = c_name.toUpper() response = “Select Your Favourite {} brand from below list”.format(c_name) print(response)
#response = “Tell me the Category” else: response = “The category doesn’t exists in our application” print(response) for i in brand_ls: print(i) dispatcher.utter_message(response) return [SlotSet(‘category_name’, c_name),SlotSet(‘brand_list’,(‘\n’.join(brand_ls)))]"
“Here is my domain.yml code:” "session_config: session_expiration_time: 0.0 carry_over_slots_to_new_session: true intents:
- greet
- goodbye
- inform entities:
- city_name
- category_name
- name
- deal_list
- brand_list
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: Its being nice to talk to you. Bye bye utter_ask_brand:
- text: Tell me your favourite brand? utter_list_of_deals:
- text:
{deal_list}
utter_list_of_brands: - text: “{brand_list\n}\n” actions:
- utter_greet
- utter_ask_city
- utter_goodbye
- utter_ask_brand
- utter_ask_category
- action_brand
- action_city
- action_category
- utter_list_of_deals
- utter_list_of_brands "