diff --git a/concierge_shiny/prompter.py b/concierge_shiny/prompter.py index 79869aa..63d198a 100644 --- a/concierge_shiny/prompter.py +++ b/concierge_shiny/prompter.py @@ -116,7 +116,9 @@ def chat_area(): selected_task = task_list[0] if "question" not in tasks else "question" return ui.TagList( ui.chat_ui( - id="prompter_chat", placeholder=tasks[selected_task]["greeting"] + id="prompter_chat", + placeholder=tasks[selected_task]["greeting"], + messages=chat.messages(), ), collection_selector_ui("collection_selector"), ui.layout_columns( diff --git a/demo_projects/chat_message_wipe/app.py b/demo_projects/chat_message_wipe/app.py index b85a240..d4c0eaf 100644 --- a/demo_projects/chat_message_wipe/app.py +++ b/demo_projects/chat_message_wipe/app.py @@ -18,7 +18,8 @@ async def on_chat_submit(): @render.ui def chat_area(): if show_chat.get(): - return ui.chat_ui("test_chat") + # recent versions allow us to set the messages in the UI element, this fixes the issue! + return ui.chat_ui("test_chat", messages=chat.messages()) else: return ui.markdown("Chat hidden") @@ -27,10 +28,5 @@ def chat_area(): def toggle_chat(): show_chat.set(not show_chat.get()) - @reactive.effect - @reactive.event(chat.messages) - def on_message(): - print(chat.messages()) - app = App(app_ui, server) diff --git a/requirements.txt b/requirements.txt index 7f203f9..55d8e35 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,6 +12,7 @@ python-dotenv~=1.0.1 requests_oauth2client~=1.5.3 requests-oauthlib~=2.0.0 sentence-transformers~=3.0.1 +shiny~=1.2.1 shinyswatch~=0.7.0 isi-util concierge-util