Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -73,20 +73,19 @@ bot = ChatBot()
|
|
73 |
if bot:
|
74 |
st.session_state["bot"] = bot
|
75 |
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
st.session_state.messages.append({"role": "assistant", "content": response})
|
|
|
73 |
if bot:
|
74 |
st.session_state["bot"] = bot
|
75 |
|
76 |
+
if prompt := st.chat_input("π Ask any question or feel free to use the examples provided in the left sidebar."):
|
77 |
+
|
78 |
+
# Display user message in chat message container
|
79 |
+
st.chat_message("user").markdown(prompt)
|
80 |
+
|
81 |
+
# Add user message to chat history
|
82 |
+
st.session_state.messages.append({"role": "user", "content": prompt})
|
83 |
+
|
84 |
+
# API Call
|
85 |
+
response = bot.generate_response(prompt)
|
86 |
+
|
87 |
+
# Display assistant response in chat message container
|
88 |
+
with st.chat_message("assistant"):
|
89 |
+
st.markdown(response)
|
90 |
+
# Add assistant response to chat history
|
91 |
+
st.session_state.messages.append({"role": "assistant", "content": response})
|
|