in functions/source/bot_fulfillment/bot_fulfillment.py [0:0]
def get_text_response(column_names, content, param_formatter, rows, slots):
if rows[0][0] is None:
content = "Sorry, I don't seem to find information related to your query in the database."
elif rows[0][0] == 422:
content = "We are just in the month of January. I cant get you the details yet."
elif 'orders_revenue' in slots and slots['orders_revenue'] == 'revenue':
row = float(rows[0][0])
if row > 100000:
slots[column_names[0]] = format(int(round(row / 1000)), ',d') + 'K'
else:
slots[column_names[0]] = format(int(round(row)), ',d')
elif 'orders_revenue' in slots and slots['orders_revenue'].lower() == 'orders':
slots[column_names[0]] = format(int(round(rows[0][0])), ',d')
response = {
"sessionAttributes": {
"card": ""
},
"dialogAction": {
"type": "Close",
"fulfillmentState": "Fulfilled",
"message": {
"contentType": "PlainText",
"content": param_formatter.format(content, **slots)
}
}
}
return response