Hi, Andrew. Thanks for your help.
The following code and video illustrate my question.
import panel as pn
import time
pn.extension()
def callback(context, user, instance):
time.sleep(3) # Simulate a long running process
return f'{context} echo'
chat = pn.chat.ChatInterface(callback=callback)
def btn_click(event):
chat.send('Example message', respond=True)
btn = pn.widgets.Button(name='Click here for an example message', button_type='primary', on_click=btn_click)
pn.Column(btn, chat).servable()
Thank you.