2017-12-22 9 views
0

Ich habe kürzlich an einem Lex-Projekt gearbeitet. Mein Projekt benötigt dynamische Inhalte im Inhaltstyp, aber ich kann das nicht herausfinden.Wie man contentType dynamisch in aws macht Lex

Meine aktuelle Erfüllung ist:

"I can help you with : 1. Book a hotel 2. Book a car. What would you like me to do?" 

Was ich sucht ist:

"I can help you with: 
          1. Book a hotel 
          2. Book a car. 
          What would you like me to do?" 

ich mit folgendem Code versucht:

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 

Lassen Sie mich wissen, ob dies möglich ist, tun Sie dies.

Dank

Antwort

1

Rendering der Antwort hängt von dem Client, die Sie verwenden.
Lex-Konsole unterstützt keine neue Zeile.

FB Messenger neue Linie \n mit Add:

I can help you with : \n1. Book a hotel \n2. Book a car. \nWhat would you like me to do? 

Webseite neue Zeile hinzufügen <br> mit:

I can help you with : <br>1. Book a hotel <br>2. Book a car. <br>What would you like me to do? 

Sie können Abstand hinzufügen, wie Sie möchten.

Für Details siehe this Frage.

Verwandte Themen