S
Solara13mo ago
Cezik

Hello,

Hello, has anyone encountered something like this where the ChatMessage component does not display the username above the message? I am using the TrainChatMessage component (my abstraction for a recurring component) and I am also attaching a screenshot of the application. I checked on pycafe with the example from the documentation and it correctly attaches the specified name over the message.
@solara.component
def TrainChatMessage(
message: TrainMessage,
):
with solara.lab.ChatMessage(
user=message['role'] == Role.USER,
name='User' if message['role'] == Role.USER else 'System',
avatar_background_color='primary',
color='#292929',
border_radius='20px',
notch=True,
):
solara.Markdown(message['content'])
@solara.component
def TrainChatMessage(
message: TrainMessage,
):
with solara.lab.ChatMessage(
user=message['role'] == Role.USER,
name='User' if message['role'] == Role.USER else 'System',
avatar_background_color='primary',
color='#292929',
border_radius='20px',
notch=True,
):
solara.Markdown(message['content'])
No description
18 Replies
MaartenBreddels
MaartenBreddels13mo ago
could you give me a pycafe example of what this should look like?
Cezik
CezikOP13mo ago
Hello, sorry for the late reply, but I was not at the computer. Sure enough, I have provided a link to pycafe (this is an example from the documentation under the heading “A Basic Example”). EDIT: It looks like the default template opens when you click on the link, so I'm inserting a screenshot from pycafe
Cezik
CezikOP13mo ago
No description
Cezik
CezikOP13mo ago
Hey @MaartenBreddels , do you have any new news what this could be caused by?
MaartenBreddels
MaartenBreddels13mo ago
I asked for a pycafe link so it doesn't cost me much time to set things up. Lets get that working first. What link does not work for you? Why can't you share a pycafe link with me?
Cezik
CezikOP13mo ago
Sorry, but earlier the link I provided took you to the default template on pycafe. Here is a link to an example from the documentation and it works fine (displays the username with each message), however in the local environment with this code I provided the name does not display. Even the example that is in the link does not show the username correctly. I am working on macOS Sonoma 14.5 with python 3.12.2 and solara 1.37.1. https://py.cafe/CezikLikeWhat/solara-example-chat-message
PyCafe - Solara - Chat with Solara
Create & Share Streamlit, Dash and Python Apps Online.
MaartenBreddels
MaartenBreddels13mo ago
Awesome, saves me so much time 🙂 I see this, both if I run it locally, and on pycafe
No description
MaartenBreddels
MaartenBreddels13mo ago
strange right! can you dig a bit deeper?
Cezik
CezikOP13mo ago
I found the cause... It was my fault. It turned out that the username has a broadcast class “message-name”, and I use an identical class in a different context (in a different part of the GUI) and this class has a display: none setting.... Sorry for the confusion, but it was my fault - the names of the various css classes overlapped By the way, I'll ask - is it possible to tap into the event triggered by pyvuetify? I'm using the TextArea component from reacton.pyvuetify and would like to copy its contents to the clipboard on click
MaartenBreddels
MaartenBreddels13mo ago
Awesome, great to hear it's solved. Do you want to have the data (it's v_model), or an event? if an event, which event?
Cezik
CezikOP13mo ago
Ideally, a specific function should be called when a TextArea (readonly component from pyvuetify) is clicked. What is the feature based on? I have a TextArea component in the application, the contents of which will be filled by an AI agent (in a nutshell, it's just LLM) that runs in a separate task (use_task). Once this field is filled with the entire message, I would like the user to be able to click on the TextArea component and, the contents will be copied to the clipboard. The copying itself from the variable storing the contents of the field I already have implemented using the clipboard library, so I would only care to hook the event of clicking on TextArea to some function @MaartenBreddels Sorry to bother you (I know you're probably busy with other things), but do you have any information about catching events with pyvuetify or could you provide some resources where this is explained? I would appreciate any information 🤗
MaartenBreddels
MaartenBreddels13mo ago
Lost track of this question, so thanks for the reminder. As always, I answer with a py.cafe example 🙂 https://py.cafe/maartenbreddels/solara-vue-events
PyCafe - Solara - Visualizing Vue.js Events with Solara
Create & Share Streamlit, Dash and Python Apps Online.
Cezik
CezikOP13mo ago
Oh, thank you so much! ❤️ The example is great and I think it would be useful to have an identical one in the documentation, it illustrates very well what I wanted to achieve 🫂
MaartenBreddels
MaartenBreddels13mo ago
we plan to add a lot of these py cafe examples in the docs, and make them searchable
Cezik
CezikOP13mo ago
Great idea! I think this will definitely help users coming into the framework
MaartenBreddels
MaartenBreddels13mo ago
it's such a low friction way for us to answer this way
pki
pki12mo ago
Hello, Solara needs an active support and user group. I find almost nil activity here. How are we expecting people to adopt this framework when we don't create a community of users and solara developers.
MaartenBreddels
MaartenBreddels12mo ago
(PS: you are replying in an unrelated thread) Hi @pki , I agree it can seem inactive on here. Although there quite some activity on https://discord.com/channels/1106593685241614489/1169265343596867697 and we often try to respond when we can. We’d love to hear your thoughts on how we could better engage the community. Would you have any ideas on how we can create a more active environment? Your input could help us grow this space.

Did you find this page helpful?