Spaces:
Sleeping
Sleeping
Mr-Vicky-01
commited on
Commit
•
56619bc
1
Parent(s):
bd36e08
Update app.py
Browse files
app.py
CHANGED
@@ -97,19 +97,22 @@ with st.sidebar:
|
|
97 |
st.success("Done")
|
98 |
|
99 |
user_prompt = st.chat_input("Ask me anything about the content of the PDF:")
|
100 |
-
# if user_prompt:
|
101 |
-
# st.session_state.messages.append({'role': 'user', "content": user_prompt})
|
102 |
-
# response = handle_query(user_prompt)
|
103 |
-
# st.session_state.messages.append({'role': 'assistant', "content": response})
|
104 |
|
105 |
if user_prompt and uploaded_file:
|
106 |
st.session_state.messages.append({'role': 'user', "content": user_prompt})
|
107 |
with st.chat_message("user", avatar="human-logo.jpeg"):
|
108 |
st.write(user_prompt)
|
109 |
|
110 |
-
|
111 |
-
with st.
|
112 |
response = handle_query(user_prompt)
|
113 |
-
|
114 |
-
|
115 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
st.success("Done")
|
98 |
|
99 |
user_prompt = st.chat_input("Ask me anything about the content of the PDF:")
|
|
|
|
|
|
|
|
|
100 |
|
101 |
if user_prompt and uploaded_file:
|
102 |
st.session_state.messages.append({'role': 'user', "content": user_prompt})
|
103 |
with st.chat_message("user", avatar="human-logo.jpeg"):
|
104 |
st.write(user_prompt)
|
105 |
|
106 |
+
# Trigger assistant's response retrieval and update UI
|
107 |
+
with st.spinner("Assistant is typing..."):
|
108 |
response = handle_query(user_prompt)
|
109 |
+
st.write(response)
|
110 |
+
st.session_state.messages.append({'role': 'assistant', "content": response})
|
111 |
+
|
112 |
+
|
113 |
+
# if st.session_state.messages[-1]["role"] != "assistant":
|
114 |
+
# with st.chat_message("assistant", avatar="👽"):
|
115 |
+
# response = handle_query(user_prompt)
|
116 |
+
# full_response = st.write(response)
|
117 |
+
# message = {"role": "assistant", "content": full_response}
|
118 |
+
# st.session_state.messages.append(message)
|