Sorry but made lots of tests and changes and doesnt work at all…
import panel as pnci
from panel.chat import ChatMessage
pnci.extension() #In notebook
panels =[]
promptsGUI=[]
responsesGUI=[]
message_params = dict(
default_avatars = {"System": "☂️", "User": "👤"}, # this does not apply to creating a ChatMessage. Does ChatFeed have a creation function?
reaction_icons = {},
show_user = True,
show_timestamp = False,
show_copy_icon = False,
sizing_mode = "scale_width",
)
STYLE = """
.avatar {
border-radius: 50% 20% / 10% 40%;;
margin-top: 0;
margin-left: 0;
margin-right: 0;
}
.left {
min-height: 10px;
height: 18px;
}
.center {
/* background-color: yellow; */
margin-right:0px;
width: calc(100% - 5px);
}
.message {
min-height: 15px;
}
.right {
margin-left: 0;
/* background-color: gray; */
}
"""
def system_response(contents: str, user: str, instance: pnci.chat.ChatInterface):
promptActualGUI=contents
promptsGUI.append(promptActualGUI)
# chat_history.append({'role':'user', 'content':f"{prompt}"})
#response = llama_chat_openaiGUI(promptsGUI, responsesGUI)
response ="hola" + promptActualGUI
responsesGUI.append(response)
response ="hola" + promptActualGUI
return response
gui.send("Hi, Ima an assistant of the system, my name is EduBot.. Ask me a question..", user="EduBot", avatar="🎶")
gui = pnci.chat.ChatInterface( message_params=message_params,
show_rerun=False, show_undo=False,
stylesheets=[STYLE],
#css_classes=[STYLE],
widgets=pnci.widgets.TextAreaInput( placeholder="Escribe tu pregunta aqui", auto_grow=True, max_rows=5 ),
height=350,
callback=system_response,
user="Client",
avatar = pnci.pane.PNG('https://panel.pyviz.org/_images/JPG.png'),
)
gui
What i want to do:
1 - ( dont know if possible, but if not could be a feature request). A welcome message of assistant, WITHOUT any response…For example: Hi im EduBot and im here to help you…please write any question and id try to help you…
With this message no response of callback and the textinput for user to write his her question.
2 - Assistant: name Edubot, avatar custom image or select one avatar different to default one.
3 - Client name: instead of user, Client, and another custom avatar.
Actually it does nothing:
ps. First question is related to other post : Textinput sends a empty string or "[" string first time panel is built - #5 by ejgutierrez74 that the first Hi message from assistant is responded by callback function…
Panel 1.3.8