Spaces:
Sleeping
Sleeping
ogegadavis254
commited on
Commit
•
cdf0d37
1
Parent(s):
83841b9
Update app.py
Browse files
app.py
CHANGED
@@ -102,7 +102,7 @@ if prompt := st.chat_input(f"Hi, I'm {selected_model}, ask me a question"):
|
|
102 |
st.session_state.message_count += 1
|
103 |
|
104 |
# Check if intervention is needed based on user input or bot response
|
105 |
-
if any(keyword in
|
106 |
# Intervention logic here
|
107 |
if not st.session_state.ask_intervention:
|
108 |
st.session_state.ask_intervention = True
|
@@ -117,5 +117,5 @@ with st.empty():
|
|
117 |
st.empty()
|
118 |
st.markdown(assistant_response)
|
119 |
|
120 |
-
# Add assistant response to chat
|
121 |
st.session_state.messages.append(("assistant", assistant_response))
|
|
|
102 |
st.session_state.message_count += 1
|
103 |
|
104 |
# Check if intervention is needed based on user input or bot response
|
105 |
+
if any(keyword in prompt.lower() for keyword in ["human", "therapist", "someone", "died", "death", "help", "suicide", "suffering", "crisis", "emergency", "support", "depressed", "anxiety", "lonely", "desperate", "struggling", "counseling", "distressed", "hurt", "pain", "grief", "trauma", "abuse", "danger", "risk", "urgent", "need assistance"] for prompt in st.session_state.messages):
|
106 |
# Intervention logic here
|
107 |
if not st.session_state.ask_intervention:
|
108 |
st.session_state.ask_intervention = True
|
|
|
117 |
st.empty()
|
118 |
st.markdown(assistant_response)
|
119 |
|
120 |
+
# Add assistant response to chat history
|
121 |
st.session_state.messages.append(("assistant", assistant_response))
|