Formatting string output in Amazon Lex

爱⌒轻易说出口 提交于 2019-12-20 03:19:40

问题


I'm trying to print a series of objects in a List using the C# version of AWS Lambda. Its linked to my AWS RDS and my Lex bot. Currently, when I test the bot using the LEX test console, the output that is printed isn't formatted with line breaks even though I'm using the \n line break for C#.

Example Code:

        var result = string.Empty;

        result = $"Events for {User}:";
        foreach (var evt in events)
        {
            result += $"\n\n{evt.ID} - {evt.FeedbackType} - {evt.Status} - {evt.OpenedDate.ToString()}";
        }

        return result;

Below is the output I am getting on Lex:

Can anyone please explain how to fix this or if its an issue with the LEX Console? Thanks!


回答1:


I believe it is simply a limitation of the lex console. You are at the mercy of the program rendering the chat to handle formatting. Try integrating to Slack - you'll see it work there. The lex console is pretty basic.

BTW if it is of any use, I've got a little app to let you chat with your bot in the commandline. As long as you are logging into the AWS CLI: https://github.com/dwmkerr/lex-chat.



来源:https://stackoverflow.com/questions/47804682/formatting-string-output-in-amazon-lex

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!