You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to sent an adaptive card attachment as the response activity via context.sendActivity (using the same reference as here), The line breaks are not rendered well and neither the code block is rendered. I am assuming that the latter is not supported explicitly but:
Why the line-breaks \n are not being supported?
If I send a text as the response activity then that renders the code block but then why does the adaptive card not render it? Is it difficult to provide the support for code blocks via markdown in adaptive cards?
Sample Payload:
{
"type": "message",
"attachmentLayout": "list",
"attachments": [
{
"contentType": "application/vnd.microsoft.card.adaptive",
"content": {
"type": "AdaptiveCard",
"$schema": "https://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.3",
"msteams": {
"width": "full"
},
"body": [
{
"type": "TextBlock",
"text": "**From online search:**",
"horizontalAlignment": "left",
"isSubtle": false,
"wrap": true,
"style": "default",
"separator": false,
"isVisible": true
},
{
"type": "TextBlock",
"text": "Certainly! Below is a simple Python function that checks if a given array (or list) is sorted in non-decreasing order (i.e., each element is less than or equal to the next). If you want to check for strictly increasing order, you would just need to change the comparison from `<=` to `<`.\n\n\n\n```python\n\ndef is_sorted(array):\n\n return all(array[i] <= array[i+1] for i in range(len(array) - 1))\n\n\n\n# Example usage:\n\nmy_array = [1, 2, 2, 3, 4, 5]\n\nprint(is_sorted(my_array)) # Output: True\n\n\n\nmy_array = [1, 2, 3, 4, 3, 5]\n\nprint(is_sorted(my_array)) # Output: False\n\n```\n\n\n\nThis function uses the `all()` function to check if all adjacent pairs of elements in the array satisfy the condition `array[i] <= array[i+1]`. If this is true for all pairs, then the array is sorted.\n\n\n\nIf you want to check if the array is sorted in non-increasing order, you can modify the comparison accordingly:\n\n\n\n```python\n\ndef is_sorted_descending(array):\n\n return all(array[i] >= array[i+1] for i in range(len(array) - 1))\n\n\n\n# Example usage:\n\nmy_array = [5, 4, 4, 3, 2, 1]\n\nprint(is_sorted_descending(my_array)) # Output: True\n\n\n\nmy_array = [5, 4, 3, 2, 3, 1]\n\nprint(is_sorted_descending(my_array)) # Output: False\n\n```\n\n\n\nRemember that these functions assume the array is sorted in non-decreasing or non-increasing order, which allows for consecutive duplicate elements. If you need to check for strictly increasing or decreasing order, adjust the comparison operators accordingly.",
"horizontalAlignment": "left",
"isSubtle": false,
"wrap": true,
"style": "default",
"separator": false,
"isVisible": true
}
],
"rtl": false
}
}
],
"inputHint": "acceptingInput"
}
Output Screenshot: (supports neither new line \n and neither the code blocks)
Now if this text is sent directly as the response activity
"Certainly! Below is a simple Python function that checks if a given array (or list) is sorted in non-decreasing order (i.e., each element is less than or equal to the next). If you want to check for strictly increasing order, you would just need to change the comparison from <= to <.\n\npython\ndef is_sorted(array):\n return all(array[i] <= array[i+1] for i in range(len(array) - 1))\n\n# Example usage:\nmy_array = [1, 2, 2, 3, 4, 5]\nprint(is_sorted(my_array)) # Output: True\n\nmy_array = [1, 2, 3, 4, 3, 5]\nprint(is_sorted(my_array)) # Output: False\n\n\nThis function uses the all() function to check if all adjacent pairs of elements in the array satisfy the condition array[i] <= array[i+1]. If this is true for all pairs, then the array is sorted.\n\nIf you want to check if the array is sorted in non-increasing order, you can modify the comparison accordingly:\n\npython\ndef is_sorted_descending(array):\n return all(array[i] >= array[i+1] for i in range(len(array) - 1))\n\n# Example usage:\nmy_array = [5, 4, 4, 3, 2, 1]\nprint(is_sorted_descending(my_array)) # Output: True\n\nmy_array = [5, 4, 3, 2, 3, 1]\nprint(is_sorted_descending(my_array)) # Output: False\n\n\nRemember that these functions assume the array is sorted in non-decreasing or non-increasing order, which allows for consecutive duplicate elements. If you need to check for strictly increasing or decreasing order, adjust the comparison operators accordingly."
Output Screenshot
The only difference between the two textual payloads is that in the case of adaptive cards, I attempted adding a new line character based on the guideline here Using \n\n in place of \n.
The text was updated successfully, but these errors were encountered:
We are able to repro this issue. We have raised a bug for the same. We will inform you once we get any further update from engineering team. Thanks!
Thanks @Prasad-MSFT. Is there any ETA associated to this (a ball-park number)? This is affecting our app's UX, would like this to be addressed on priority.
@karantrehan3 - Apologies. Currently there is no ETA to share. We are following up with engineering team about this issue. We will update this thread once we hear from them. Thanks!
@karantrehan3 - At the moment, we have not received any updates from the engineering team. However, we have made them aware of the seriousness of the issue. As soon as we receive any updates from them, we will notify you in this thread.
Metadata:
botbuilder
Problem:
When trying to sent an adaptive card attachment as the response activity via
context.sendActivity
(using the same reference as here), The line breaks are not rendered well and neither the code block is rendered. I am assuming that the latter is not supported explicitly but:\n
are not being supported?Sample Payload:
Output Screenshot: (supports neither new line \n and neither the code blocks)
Now if this text is sent directly as the response activity
"Certainly! Below is a simple Python function that checks if a given array (or list) is sorted in non-decreasing order (i.e., each element is less than or equal to the next). If you want to check for strictly increasing order, you would just need to change the comparison from
<=
to<
.\n\npython\ndef is_sorted(array):\n return all(array[i] <= array[i+1] for i in range(len(array) - 1))\n\n# Example usage:\nmy_array = [1, 2, 2, 3, 4, 5]\nprint(is_sorted(my_array)) # Output: True\n\nmy_array = [1, 2, 3, 4, 3, 5]\nprint(is_sorted(my_array)) # Output: False\n
\n\nThis function uses theall()
function to check if all adjacent pairs of elements in the array satisfy the conditionarray[i] <= array[i+1]
. If this is true for all pairs, then the array is sorted.\n\nIf you want to check if the array is sorted in non-increasing order, you can modify the comparison accordingly:\n\npython\ndef is_sorted_descending(array):\n return all(array[i] >= array[i+1] for i in range(len(array) - 1))\n\n# Example usage:\nmy_array = [5, 4, 4, 3, 2, 1]\nprint(is_sorted_descending(my_array)) # Output: True\n\nmy_array = [5, 4, 3, 2, 3, 1]\nprint(is_sorted_descending(my_array)) # Output: False\n
\n\nRemember that these functions assume the array is sorted in non-decreasing or non-increasing order, which allows for consecutive duplicate elements. If you need to check for strictly increasing or decreasing order, adjust the comparison operators accordingly."Output Screenshot
The only difference between the two textual payloads is that in the case of adaptive cards, I attempted adding a new line character based on the guideline here Using
\n\n
in place of\n
.The text was updated successfully, but these errors were encountered: