Update app.py
Browse files
app.py
CHANGED
@@ -101,4 +101,20 @@ if prompt := st.chat_input(f"Hi, I'm {selected_model}, ask me a question"):
|
|
101 |
st.session_state.message_count += 1
|
102 |
|
103 |
# Check if intervention is needed based on bot response
|
104 |
-
if any(keyword
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
st.session_state.message_count += 1
|
102 |
|
103 |
# Check if intervention is needed based on bot response
|
104 |
+
if any(keyword in prompt.lower() for keyword in ["human", "therapist"]):
|
105 |
+
if not st.session_state.ask_intervention:
|
106 |
+
if st.button("Do you need to talk to a therapist?"):
|
107 |
+
st.session_state.ask_intervention = True
|
108 |
+
st.write("You can reach out to a certified therapist at +25493609747.")
|
109 |
+
|
110 |
+
# Interact with the selected model
|
111 |
+
assistant_response = interact_with_together_api(st.session_state.messages, model_links[selected_model])
|
112 |
+
|
113 |
+
# Display assistant response in chat message container
|
114 |
+
with st.empty():
|
115 |
+
st.markdown("AI is typing...")
|
116 |
+
st.empty()
|
117 |
+
st.markdown(assistant_response)
|
118 |
+
|
119 |
+
# Add assistant response to chat history
|
120 |
+
st.session_state.messages.append(("assistant", assistant_response))
|