Update app.py
Browse files
app.py
CHANGED
@@ -62,35 +62,18 @@ for message in st.session_state.messages:
|
|
62 |
|
63 |
prompt = st.chat_input("What kind of class are you looking for?")
|
64 |
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
#
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
result_query = 'Original Query:' + query + 'Query Results:' + str(response)
|
81 |
-
final_response = result_agent(result_query, OPENAI_API)
|
82 |
-
|
83 |
-
### GPT Response
|
84 |
-
# Display assistant response in chat message container
|
85 |
-
with st.chat_message("assistant"):
|
86 |
-
message_placeholder = st.empty()
|
87 |
-
assistant_response = "Hello there! How can I assist you today?"
|
88 |
-
# Simulate stream of response with milliseconds delay
|
89 |
-
for chunk in assistant_response.split():
|
90 |
-
full_response += chunk + " "
|
91 |
-
time.sleep(0.05)
|
92 |
-
# Add a blinking cursor to simulate typing
|
93 |
-
message_placeholder.markdown(full_response + "▌")
|
94 |
-
message_placeholder.markdown(final_response)
|
95 |
-
# Add assistant response to chat history
|
96 |
-
st.session_state.messages.append({"role": "assistant", "content": final_response})
|
|
|
62 |
|
63 |
prompt = st.chat_input("What kind of class are you looking for?")
|
64 |
|
65 |
+
|
66 |
+
### GPT Response
|
67 |
+
# Display assistant response in chat message container
|
68 |
+
with st.chat_message("assistant"):
|
69 |
+
message_placeholder = st.empty()
|
70 |
+
assistant_response = "Hello there! How can I assist you today?"
|
71 |
+
# Simulate stream of response with milliseconds delay
|
72 |
+
for chunk in assistant_response.split():
|
73 |
+
full_response += chunk + " "
|
74 |
+
time.sleep(0.05)
|
75 |
+
# Add a blinking cursor to simulate typing
|
76 |
+
message_placeholder.markdown(full_response + "▌")
|
77 |
+
message_placeholder.markdown(final_response)
|
78 |
+
# Add assistant response to chat history
|
79 |
+
st.session_state.messages.append({"role": "assistant", "content": final_response})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|