Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't update message reaction icons after click #6804

Closed
1 task
justinwiley opened this issue Apr 30, 2024 · 0 comments · Fixed by #6807
Closed
1 task

Can't update message reaction icons after click #6804

justinwiley opened this issue Apr 30, 2024 · 0 comments · Fixed by #6807

Comments

@justinwiley
Copy link
Contributor

ALL software version info

python = "3.12"
panel = "^1.4.2"

Description of expected behavior and the observed behavior

After clicking a reaction icon in a ChatMessage, it's sometimes useful to limit the ability of the user to click the reaction button again. For example, if the user clicks thumbs up indicating a message from an agent was good, it may change the behavior of the agent moving forward so they shouldn't be able to alter it afterwards.

See discussion here: https://discourse.holoviz.org/t/how-to-trigger-a-callback-on-favorite-action-on-the-chatinterface/7187

Complete, minimal, self-contained example code that reproduces the issue

import panel as pn

def react_on_click(reactions, message):
    print(reactions)
    message.reaction_icons = pn.chat.ChatReactionIcons(options={})  # message chat icons not set

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

ci = pn.chat.ChatInterface(button_properties={"send": {"post_callback": bind_on_send}})
ci.show()

Stack traceback and/or browser JavaScript console output

The print statement successfully prints out the reaction.

Screenshots or screencasts of the bug in action

N/A

  • I may be interested in making a pull request to address this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant