Spaces:
Sleeping
Sleeping
Update pages/chatbot.py
Browse files- pages/chatbot.py +13 -13
pages/chatbot.py
CHANGED
@@ -2,7 +2,7 @@ import streamlit as st
|
|
2 |
from app import rag_query, process_feedback
|
3 |
|
4 |
|
5 |
-
st.title("RAG Chatbot")
|
6 |
|
7 |
# Initialize chat history
|
8 |
if "messages" not in st.session_state:
|
@@ -12,16 +12,16 @@ if "messages" not in st.session_state:
|
|
12 |
for i, message in enumerate(st.session_state.messages):
|
13 |
with st.chat_message(message["role"]):
|
14 |
st.markdown(message["content"])
|
15 |
-
if message["role"] == "assistant":
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
|
26 |
# React to user input
|
27 |
if prompt := st.chat_input("Bạn cần tư vấn về điều gì? Hãy chia sẻ nhu cầu và thông tin của bạn nhé!"):
|
@@ -38,8 +38,8 @@ if prompt := st.chat_input("Bạn cần tư vấn về điều gì? Hãy chia s
|
|
38 |
# Add assistant response to chat history
|
39 |
st.session_state.messages.append({"role": "assistant", "content": response})
|
40 |
|
41 |
-
# Rerun the app to display the feedback buttons
|
42 |
-
st.
|
43 |
|
44 |
# Sidebar for additional controls
|
45 |
with st.sidebar:
|
|
|
2 |
from app import rag_query, process_feedback
|
3 |
|
4 |
|
5 |
+
st.title("🛡️ RAG Chatbot 🛡️")
|
6 |
|
7 |
# Initialize chat history
|
8 |
if "messages" not in st.session_state:
|
|
|
12 |
for i, message in enumerate(st.session_state.messages):
|
13 |
with st.chat_message(message["role"]):
|
14 |
st.markdown(message["content"])
|
15 |
+
# if message["role"] == "assistant":
|
16 |
+
# col1, col2 = st.columns([1,15])
|
17 |
+
# with col1:
|
18 |
+
# if st.button("👍", key=f"thumbs_up_{i}"):
|
19 |
+
# process_feedback(st.session_state.messages[i-1]["content"], message["content"], True)
|
20 |
+
# with col2:
|
21 |
+
# if st.button("👎", key=f"thumbs_down_{i}"):
|
22 |
+
# process_feedback(st.session_state.messages[i-1]["content"], message["content"], False)
|
23 |
+
# # st.session_state.messages.pop() # Remove the last assistant message
|
24 |
+
# #st.rerun() # Rerun the app to regenerate the response
|
25 |
|
26 |
# React to user input
|
27 |
if prompt := st.chat_input("Bạn cần tư vấn về điều gì? Hãy chia sẻ nhu cầu và thông tin của bạn nhé!"):
|
|
|
38 |
# Add assistant response to chat history
|
39 |
st.session_state.messages.append({"role": "assistant", "content": response})
|
40 |
|
41 |
+
# # Rerun the app to display the feedback buttons
|
42 |
+
# st.rerun()
|
43 |
|
44 |
# Sidebar for additional controls
|
45 |
with st.sidebar:
|