Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +23 -8
src/streamlit_app.py
CHANGED
@@ -127,10 +127,10 @@ To learn more about my work, visit:
|
|
127 |
with st.form("setup_form"):
|
128 |
st.header("Set Up Your Simulation")
|
129 |
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
|
135 |
scenario = st.text_area(
|
136 |
"Describe the scenario you'd like to practice:",
|
@@ -152,7 +152,7 @@ with st.form("setup_form"):
|
|
152 |
if submitted:
|
153 |
# Store simulation parameters for debrief
|
154 |
st.session_state.simulation_params = {
|
155 |
-
"
|
156 |
"scenario": scenario,
|
157 |
"tone": tone,
|
158 |
"goals": goals
|
@@ -161,7 +161,7 @@ with st.form("setup_form"):
|
|
161 |
# Prepare system message with simulation parameters
|
162 |
st.session_state.system_message = f"""
|
163 |
You are a conversational partner helping someone practice difficult conversations.
|
164 |
-
The user has a {
|
165 |
|
166 |
Respond in a {tone} manner. Help them achieve their goals: {goals}
|
167 |
|
@@ -175,7 +175,7 @@ with st.form("setup_form"):
|
|
175 |
|
176 |
**Goal Alignment**: [Reflect on how well they stayed aligned with their stated goal. Note small wins and struggles, affirm effort and awareness]
|
177 |
|
178 |
-
**Attachment Insight**: [Offer one insight based on their {
|
179 |
|
180 |
**Practical Tool**: [Offer a brief NVC or DBT tool they could try next time (e.g., needs check-in, opposite action, self-validation, distress tolerance)]
|
181 |
|
@@ -200,6 +200,21 @@ else:
|
|
200 |
for message in st.session_state.messages:
|
201 |
with st.chat_message(message["role"]):
|
202 |
st.markdown(message["content"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
203 |
|
204 |
# Chat input
|
205 |
if prompt := st.chat_input("Type your message here (type 'debrief' or 'end roleplay' when ready to reflect)"):
|
@@ -215,7 +230,7 @@ else:
|
|
215 |
# Add debrief request to messages
|
216 |
prompt = f"""Please provide a therapeutic debrief for this roleplay session using:
|
217 |
|
218 |
-
Attachment Style: {st.session_state.simulation_params['
|
219 |
Scenario: {st.session_state.simulation_params['scenario']}
|
220 |
Goals: {st.session_state.simulation_params['goals']}
|
221 |
AI Tone: {st.session_state.simulation_params['tone']}
|
|
|
127 |
with st.form("setup_form"):
|
128 |
st.header("Set Up Your Simulation")
|
129 |
|
130 |
+
tone_archetype = st.selectbox(
|
131 |
+
"Select the voice you'd like to engage with:",
|
132 |
+
["Ghost", "Sycophant", "Critic"]
|
133 |
+
)
|
134 |
|
135 |
scenario = st.text_area(
|
136 |
"Describe the scenario you'd like to practice:",
|
|
|
152 |
if submitted:
|
153 |
# Store simulation parameters for debrief
|
154 |
st.session_state.simulation_params = {
|
155 |
+
"tone_archetype": tone_archetype,
|
156 |
"scenario": scenario,
|
157 |
"tone": tone,
|
158 |
"goals": goals
|
|
|
161 |
# Prepare system message with simulation parameters
|
162 |
st.session_state.system_message = f"""
|
163 |
You are a conversational partner helping someone practice difficult conversations.
|
164 |
+
The user has a {tone_archetype} attachment style and wants to practice: {scenario}
|
165 |
|
166 |
Respond in a {tone} manner. Help them achieve their goals: {goals}
|
167 |
|
|
|
175 |
|
176 |
**Goal Alignment**: [Reflect on how well they stayed aligned with their stated goal. Note small wins and struggles, affirm effort and awareness]
|
177 |
|
178 |
+
**Attachment Insight**: [Offer one insight based on their {tone_archetype} attachment style. Normalize the response as protective. Gently suggest a next growth step without shaming]
|
179 |
|
180 |
**Practical Tool**: [Offer a brief NVC or DBT tool they could try next time (e.g., needs check-in, opposite action, self-validation, distress tolerance)]
|
181 |
|
|
|
200 |
for message in st.session_state.messages:
|
201 |
with st.chat_message(message["role"]):
|
202 |
st.markdown(message["content"])
|
203 |
+
|
204 |
+
# Optional somatic input logging
|
205 |
+
st.subheader("🧘 Somatic Reflection (Optional)")
|
206 |
+
somatic_input = st.text_input("What’s happening in your body right now?", key="soma_input")
|
207 |
+
|
208 |
+
if st.button("Log Somatic Entry"):
|
209 |
+
if 'soma_log' not in st.session_state:
|
210 |
+
st.session_state.soma_log = []
|
211 |
+
st.session_state.soma_log.append({
|
212 |
+
"timestamp": datetime.now().isoformat(),
|
213 |
+
"tone": st.session_state.simulation_params.get('tone_archetype', st.session_state.simulation_params.get('tone_archetype', 'Unknown')),
|
214 |
+
"somatic_input": somatic_input
|
215 |
+
})
|
216 |
+
st.success("Somatic reflection logged.")
|
217 |
+
|
218 |
|
219 |
# Chat input
|
220 |
if prompt := st.chat_input("Type your message here (type 'debrief' or 'end roleplay' when ready to reflect)"):
|
|
|
230 |
# Add debrief request to messages
|
231 |
prompt = f"""Please provide a therapeutic debrief for this roleplay session using:
|
232 |
|
233 |
+
Attachment Style: {st.session_state.simulation_params['tone_archetype']}
|
234 |
Scenario: {st.session_state.simulation_params['scenario']}
|
235 |
Goals: {st.session_state.simulation_params['goals']}
|
236 |
AI Tone: {st.session_state.simulation_params['tone']}
|