How to bind a callback to the reactions in the ChatInterface component?

import panel as pn

def react_on_click(reactions):

def bind_on_send(instance, event):
    message = instance.objects[-1]
    pn.bind(react_on_click, message.param.reactions, watch=True)

ci ={"send": {"post_callback": bind_on_send}})

This example demos how to add callbacks to messages after it’s been sent. When the user clicks on the heart reaction, [‘favorite’] will be printed.


1 Like