我最近一直在研究Lex项目。我的项目需要内容类型的动态内容,但我无法弄清楚。
我目前的成就是:
"I can help you with : 1. Book a hotel 2. Book a car. What would you like me to do?"
我需要的是:
"I can help you with:
1. Book a hotel
2. Book a car.
What would you like me to do?"
我尝试使用以下代码:
def HelpMsg(intent_request, intent_name):
if intent_name == 'HelpMsg':
response = {
'dialogAction': {
'type': 'Close',
'fulfillmentState': 'Fulfilled',
'message': {'contentType': 'Plaintext', 'content': 'I can help you with '
'\n1. Book a hotel '
'\n2. Book a car'
'\nWhat would you like me to do?'}
}}
return response
如果有可能,请告诉我。
由于
答案 0 :(得分:1)
响应的呈现取决于您使用的客户端 Lex控制台不支持新线路。
FB Messenger将使用\n
添加新行:
I can help you with : \n1. Book a hotel \n2. Book a car. \nWhat would you like me to do?
网站将使用<br>
添加新行:
I can help you with : <br>1. Book a hotel <br>2. Book a car. <br>What would you like me to do?
您可以根据需要添加间距。
有关详细信息,请参阅this问题。