Skip to content

Commit

Permalink
update Shiny version, pass existing messages into chat UI
Browse files Browse the repository at this point in the history
  • Loading branch information
sebovzeoueb committed Dec 4, 2024
1 parent 0677066 commit 9a566d4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
4 changes: 3 additions & 1 deletion concierge_shiny/prompter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
8 changes: 2 additions & 6 deletions demo_projects/chat_message_wipe/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand All @@ -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)
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9a566d4

Please sign in to comment.