Skip to content

Commit

Permalink
Add context info to the ui in rag website chatbot
Browse files Browse the repository at this point in the history
  • Loading branch information
EveryFine committed May 25, 2024
1 parent ba32eb9 commit f0b5a3e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions GeniusChatbots/pages/3_rag_website_chatbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,15 @@ def create_chatbot():
stream = rag_client.get_stream_response(user_query, st.session_state.chat_history,
st.session_state.vector_store)

context_container = st.empty()
response_container = st.empty()
response_text = ""
for chunk in stream:
if answer_chunk := chunk.get("context"):
with context_container:
with st.expander("context", expanded=False):
st.markdown(answer_chunk)

if answer_chunk := chunk.get("answer"):
response_text += answer_chunk
# 实时更新Streamlit界面上的内容
Expand Down

0 comments on commit f0b5a3e

Please sign in to comment.