Hi dont know why …in this code i have this problem…dont know why…seems that panel is calling the callback function without any content…or “[” character…
Im trying to customize a chat gui for my IA:
#Esta funcion gestiona GUI: obtenemos el prompt de la caja de texto, y cuando damos enter, envia el contenido del
#texto como prompt al sistema LLM, y publica la respuesta....
def collect_messages(_):
promptActualGUI = inp.value_input
inp.value = ''
promptsGUI.append(promptActualGUI)
response = llama_chat_openaiGUI(promptsGUI, responsesGUI)
responsesGUI.append(response)
panels.append(
pn.Row('User:', pn.pane.Markdown(promptActualGUI, width=600, styles=user_style)))
panels.append(
pn.Row('Assistant:', pn.pane.Markdown(response, width=600, styles=assistant_style)))
return pn.Column(*panels)
Seems that when i create the pane and button, somehow it calls the collectmessage binded function, with the text empty ( at least should be empty) but it says i submitted a "[· text to AI…Its clear that sending the claudator to the AI, it doesnt understand anything and returns the answer…
By the way if i have a get a long response, the background square in grey color, is smaller than the text…so long text more than 10 lines, the text is bigger than the “box” which is very ugly as UI, Any solution to this ?
Thanks to response, but id like to make a more customizable chat, and also learn Panel…
Perhaps this could help, enough code…in theory you write a question or whatever and clic button Chat…, then the binding should call the function collect messages and return a “hola” message…A user line with the question, and assistant response with “hola” should be added below…and thats every time you ask a new question.
But something is wrong as i got an empty, blank output
# Esta funcion gestiona GUI: obtenemos el prompt de la caja de texto, y cuando damos enter, envia el contenido del
# texto como prompt al sistema LLM, y publica la respuesta....
def collect_messages(_):
promptActualGUI = inp.value_input
inp.value = ''
# promptsGUI.append(promptActualGUI)
response = "hola"
# responsesGUI.append(response)
panels.append(
pn.Row('User:', pn.pane.Markdown(promptActualGUI, width=600)))
panels.append(
pn.Row('Assistant:', pn.pane.Markdown(response, width=600)))
return pn.Column(*panels)
import panel as pn
pn.extension()
panels = []
inp = pn.widgets.TextInput(value="Hi", placeholder='Enter text here…')
button_conversation = pn.widgets.Button(name="Chat!")
interactive_conversation = pn.bind(collect_messages, button_conversation)
dashboard = pn.Column(
inp,
pn.Row(button_conversation),
pn.panel(interactive_conversation, loading_indicator=True, height=300)
)
dashboard
The problem is customize the names of users and their own avatars…
And specially that as you can see id like an first message without response of the system/callback. A presentation chat message as i explain in other post…dont know if its possible to do it actually in Panel.
Please review how to create a minimal reproducible example:
you forgot to define system_response. You also forgot to define welcome.
Further, panel is usually imported as pn…
When you constructed the message to be displayed, you specified user="EduBot",avatar="🤖" so that is what was displayed.
I suggest setting different combinations of user name and avatar,
as well as removing either the user and/or the avatar setting to see what they do.
You will find the call arguments that generate the display you want to see:
I am guessing user='"Asker", but it is not quite clear to me from what you wrote.