Spaces:
Sleeping
Sleeping
Update QA_Bot.py
Browse files
QA_Bot.py
CHANGED
|
@@ -12,6 +12,7 @@ def summarize_data(documents):
|
|
| 12 |
|
| 13 |
|
| 14 |
def QA_Bot(vectorstore,API_KEY,documents):
|
|
|
|
| 15 |
st.title("Q&A Bot")
|
| 16 |
# Initialize chat history
|
| 17 |
if "messages" not in st.session_state:
|
|
@@ -21,14 +22,16 @@ def QA_Bot(vectorstore,API_KEY,documents):
|
|
| 21 |
for message in st.session_state.messages:
|
| 22 |
with st.chat_message(message["role"]):
|
| 23 |
st.markdown(message["content"])
|
| 24 |
-
|
|
|
|
|
|
|
| 25 |
# React to user input
|
| 26 |
if prompt := st.chat_input("What is up?"):
|
| 27 |
# Display user message in chat message container
|
| 28 |
st.chat_message("user").markdown(prompt)
|
| 29 |
# Add user message to chat history
|
| 30 |
st.session_state.messages.append({"role": "user", "content": prompt})
|
| 31 |
-
|
| 32 |
ai_response = Q_A(vectorstore,prompt,API_KEY)
|
| 33 |
response = f"Echo: {ai_response}"
|
| 34 |
# Display assistant response in chat message container
|
|
|
|
| 12 |
|
| 13 |
|
| 14 |
def QA_Bot(vectorstore,API_KEY,documents):
|
| 15 |
+
summary_response = None
|
| 16 |
st.title("Q&A Bot")
|
| 17 |
# Initialize chat history
|
| 18 |
if "messages" not in st.session_state:
|
|
|
|
| 22 |
for message in st.session_state.messages:
|
| 23 |
with st.chat_message(message["role"]):
|
| 24 |
st.markdown(message["content"])
|
| 25 |
+
summary_response = summarize_data(documents)
|
| 26 |
+
print(summary_response)
|
| 27 |
+
|
| 28 |
# React to user input
|
| 29 |
if prompt := st.chat_input("What is up?"):
|
| 30 |
# Display user message in chat message container
|
| 31 |
st.chat_message("user").markdown(prompt)
|
| 32 |
# Add user message to chat history
|
| 33 |
st.session_state.messages.append({"role": "user", "content": prompt})
|
| 34 |
+
|
| 35 |
ai_response = Q_A(vectorstore,prompt,API_KEY)
|
| 36 |
response = f"Echo: {ai_response}"
|
| 37 |
# Display assistant response in chat message container
|