I have been previously embedding videos in a Rasa system as follows:
dispatcher.utter_message(
attachment={
“type”: “video”,
“payload”: {
“title”: “Here is a video”,
“src”: “www.youtube.com”
}
}
)
However, this has started causing a strange error, the output is as follows:
2021-11-24 11:18:03 ERROR asyncio - Task exception was never retrieved
future: <Task finished coro=<configure_app..run_cmdline_io() done, defined at c:filepath\env\lib\site-packages\rasa\core\run.py:128> exception=TypeError(‘can only concatenate str (not “dict”) to str’)>
Traceback (most recent call last):
File “c:filepath\env\lib\site-packages\rasa\core\run.py”, line 134, in run_cmdline_io
sender_id=conversation_id,
File “c:filepath\env\lib\site-packages\rasa\core\channels\console.py”, line 152, in record_messages
button_question = print_bot_output(response)
File “c:filepath\env\lib\site-packages\rasa\core\channels\console.py”, line 37, in print_bot_output
cli_utils.print_color("Attachment: " + message.get(“attachment”), color=color)
TypeError: can only concatenate str (not “dict”) to str
Transport closed @ (‘127.0.0.1’, 54758) and exception experienced during error handling
This error doesn’t happen when I replace the attachment message with a text output. It’s definitely the attachment format that throws this error.
Output HAS to come from actions.py as there is some additional logic to do with the particular link output to the user.
System is using the following versions:
rasa==1.10.2
rasa-core==0.8.2
rasa-nlu==0.13.3
rasa-sdk==1.10.3
rasa-x==0.32.2
@ronankff Ronan, check my second code please attachment=msg and JSON data should be above not inside dispatcher.utter_message that why I guess dict issue is coming.
I have placed a print method into the run method and that block of code does execute. It fails when dispatcher tries to utter the message. Replacing it with your solution was the same problem.
Hi all, I would like to follow up on this as I get the same error when using RASA 3.1 and also having the attachment within the domain.yml as you declared @nik202
It shows correctly in the webchat but not in the shell. However, I need the shell for debugging. Any idea whether this could be the case, that rasa shell specifically cannot handle this attachment?