Comments (9)
With Rasa Core it must follow the template schema.
So for an image:
{
text: ...,
image: ...
}
See: https://rasa.com/docs/core/domains/#images-and-buttons
from rasa-webchat.
Update: I used dispatcher.utter_attachment(message) with message = {
"type":"video",
"payload":{
"title":"Link name",
"src": "https://youtu.be/f3EbDbm8XqY"
}
}
But it still shows as text in the chat window:
from rasa-webchat.
I was able to send an image by adding it in the templates of the domain file, but I can't send through the custom actions. I changed the value of the message variable in my actions file into this:
message = {
"attachment":{
"type":"image",
"payload":{
"text":"Test",
"image": "img.jpg"
}
}
}
Then I used the dispatcher to send it, but it still doesn't show the image. I'm not sure if I'm in the right track here. Is it possible to send image/video through the custom actions or it can only be done through the domain file?
from rasa-webchat.
I have encountered the same problem with you, attachment should be part of response. The reality is that it is part of text. I don't know if you have solved this problem.
from rasa-webchat.
Sorry, I got busy... Anyway, it seems that we need the Rasa core output channel of the webchat to send the video. I checked the rasa-addons link where we supposed can get it but I didn't find it there...
from rasa-webchat.
the socketio.py doesn't seem like it supports video tag, so there is a mismatch.
The other way is send thru custom message.
from rasa-webchat.
It's still not working using custom message. This is the video JSON data I sent to the UI:
message = {
"attachment":{
"type":"video",
"title":"Link name",
"src": "https://www.youtube.com/watch?v=f3EbDbm8XqY"
}
}
I did a debug on the UI and it's acknowledging that it received the data as video but it just doesn't show it. Is there a video JSON format that I should follow?
from rasa-webchat.
Got it finally resolved. These are the steps I did:
In CollectingDispatcher class, I added this function:
def utter_response(self, message: Dict[Text, Any]) -> None:
"""Send a message to the client."""
self.messages.append(message)
In SocketIOOutput class of the socketio module, I added the following:
def send_response(self, recipient_id: Text, message: Dict[Text, Any]):
self._send_message(self.sid, message)
In the Dispatcher class of the dispatcher module, I made the following changes:
def utter_response(self, message: Dict[Text, Any]) -> None:
"""Send a message to the client."""
bot_message = BotMessage(text=message.get("text"),
data={"elements": message.get("elements"),
"buttons": message.get("buttons"),
"attachment": message.get("video")})
self.latest_bot_messages.append(bot_message)
self.output_channel.send_response(self.sender_id, message)
from rasa-webchat.
Sorry, above fix caused some issue when dispatching messages other than video attachment. I made changes to the send_custom_message function in socketio instead:
def send_custom_message(self, recipient_id: Text, elements: List[Dict[Text, Any]]) -> None: """Sends elements to the output.""" #print(">>>elements:", elements) message = '' try: if not any('attachment' in d for d in elements): message = {"attachment": { "type": "template", "payload": { "template_type": "generic", "elements": elements[0] }}} else: message = elements[0] self._send_message(self.sid, message) except Exception as e: print("Error sending custom message:", e)
from rasa-webchat.
Related Issues (20)
- Link Image Address HOT 1
- ยฟCan I change the parameter language that goes in customData to the widget, without recharging the page? HOT 2
- Starting the conversation HOT 1
- how can i get response of socket.io HOT 1
- JWT authentication HOT 1
- Unable to connect to websocket getting handshake error and unable to customize the chat bot HOT 2
- How to use in Angular project HOT 1
- Table is not rendered HOT 1
- How can I change file and import it into my project? HOT 1
- I don't want the link in the button to open in a new tab. HOT 1
- Rasa 3? HOT 7
- Custom Button in the header HOT 4
- showFullScreenButton and displayUnreadCount HOT 1
- React integration HOT 1
- Not able to clone and run the code in my local HOT 3
- tooltipPayload overwrites initPayload HOT 2
- Not sure about what is the purpose of dispatch evalUrl function HOT 1
- Adding a custom component to RASA web-chat HOT 1
- Getting 'AsyncServer.enter_room' was never awaited error. HOT 2
- Bot does not respond HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rasa-webchat.