Update app.py
Browse files
app.py
CHANGED
|
@@ -211,11 +211,13 @@ def simulate(prompt, selected_event, selected_persona_file, ai_mode,
|
|
| 211 |
context_note = ""
|
| 212 |
|
| 213 |
# Generate response
|
|
|
|
|
|
|
| 214 |
response, updated_state, teaching_note = generate_response(
|
| 215 |
prompt,
|
| 216 |
persona,
|
| 217 |
conversation_history,
|
| 218 |
-
force_mode=
|
| 219 |
use_fast_mode=use_fast_mode
|
| 220 |
)
|
| 221 |
|
|
@@ -297,32 +299,32 @@ def simulate(prompt, selected_event, selected_persona_file, ai_mode,
|
|
| 297 |
<div style='color: #1e293b; font-size: 1rem; line-height: 1.8; font-weight: 600;'>
|
| 298 |
"""
|
| 299 |
|
| 300 |
-
# Add
|
| 301 |
intensity = updated_state.get('anxiety', 0)
|
| 302 |
openness = updated_state.get('trust', 0)
|
| 303 |
candor = updated_state.get('openness', 0)
|
| 304 |
mode = updated_state.get('mode', 'baseline')
|
| 305 |
|
| 306 |
if intensity > 0.7:
|
| 307 |
-
teaching_feedback += " •
|
| 308 |
elif intensity > 0.4:
|
| 309 |
-
teaching_feedback += " •
|
| 310 |
else:
|
| 311 |
-
teaching_feedback += " •
|
| 312 |
|
| 313 |
if openness > 0.6:
|
| 314 |
-
teaching_feedback += " •
|
| 315 |
elif openness > 0.4:
|
| 316 |
-
teaching_feedback += " •
|
| 317 |
else:
|
| 318 |
-
teaching_feedback += " •
|
| 319 |
|
| 320 |
if mode == "trusting":
|
| 321 |
-
teaching_feedback += " • <strong>
|
| 322 |
elif mode == "triggered":
|
| 323 |
-
teaching_feedback += " • <strong>
|
| 324 |
elif mode == "decompensating":
|
| 325 |
-
teaching_feedback += " • <strong>
|
| 326 |
|
| 327 |
teaching_feedback += """
|
| 328 |
</div>
|
|
|
|
| 211 |
context_note = ""
|
| 212 |
|
| 213 |
# Generate response
|
| 214 |
+
# Note: ai_mode selects which backend to use (HF API vs local model)
|
| 215 |
+
# It should NOT be passed as force_mode (which controls emotional state)
|
| 216 |
response, updated_state, teaching_note = generate_response(
|
| 217 |
prompt,
|
| 218 |
persona,
|
| 219 |
conversation_history,
|
| 220 |
+
force_mode=None, # Let the system determine emotional mode naturally
|
| 221 |
use_fast_mode=use_fast_mode
|
| 222 |
)
|
| 223 |
|
|
|
|
| 299 |
<div style='color: #1e293b; font-size: 1rem; line-height: 1.8; font-weight: 600;'>
|
| 300 |
"""
|
| 301 |
|
| 302 |
+
# Add literary analysis of character state
|
| 303 |
intensity = updated_state.get('anxiety', 0)
|
| 304 |
openness = updated_state.get('trust', 0)
|
| 305 |
candor = updated_state.get('openness', 0)
|
| 306 |
mode = updated_state.get('mode', 'baseline')
|
| 307 |
|
| 308 |
if intensity > 0.7:
|
| 309 |
+
teaching_feedback += " • <strong>High Tension:</strong> Character is at a crisis point - authors use these moments to reveal core fears and motivations. What does this reveal about their inner conflict?<br>\n"
|
| 310 |
elif intensity > 0.4:
|
| 311 |
+
teaching_feedback += " • <strong>Moderate Tension:</strong> Character is emotionally engaged but controlled. Good opportunity to explore the gap between what they say and what they feel (subtext).<br>\n"
|
| 312 |
else:
|
| 313 |
+
teaching_feedback += " • <strong>Calm State:</strong> Character is composed. Authors often use calm moments to establish baseline personality before introducing conflict.<br>\n"
|
| 314 |
|
| 315 |
if openness > 0.6:
|
| 316 |
+
teaching_feedback += " • <strong>Revealing Moment:</strong> Character is sharing deeply - this is when backstory, trauma, and hidden desires surface. Pay attention to what they choose to reveal.<br>\n"
|
| 317 |
elif openness > 0.4:
|
| 318 |
+
teaching_feedback += " • <strong>Cautiously Engaged:</strong> Character is balancing self-protection with honesty. Notice what they avoid - often as revealing as what they share.<br>\n"
|
| 319 |
else:
|
| 320 |
+
teaching_feedback += " • <strong>Guarded/Defensive:</strong> Character is protecting themselves. In literature, walls characters build often point to their deepest wounds. What are they protecting?<br>\n"
|
| 321 |
|
| 322 |
if mode == "trusting":
|
| 323 |
+
teaching_feedback += " • <strong>✨ Breakthrough!</strong> You've reached the character's authentic self - this is where theme emerges. How does their truth connect to the story's larger meaning?<br>\n"
|
| 324 |
elif mode == "triggered":
|
| 325 |
+
teaching_feedback += " • <strong>⚠️ Resistance:</strong> Character is defensive. In literary analysis, resistance often signals proximity to truth. What nerve did you touch?<br>\n"
|
| 326 |
elif mode == "decompensating":
|
| 327 |
+
teaching_feedback += " • <strong>🔥 Crisis Point:</strong> Character breakdown reveals theme. Joyce, Hemingway, etc. use these moments to expose the forces crushing their characters. Analyze what's collapsing and why.<br>\n"
|
| 328 |
|
| 329 |
teaching_feedback += """
|
| 330 |
</div>
|