jmisak commited on
Commit
dd0af13
·
verified ·
1 Parent(s): 25d0a12

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -11
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=ai_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 readable state descriptions
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 += " • The character is highly emotionally charged right now<br>\n"
308
  elif intensity > 0.4:
309
- teaching_feedback += " • The character shows moderate emotional intensity<br>\n"
310
  else:
311
- teaching_feedback += " • The character is relatively calm<br>\n"
312
 
313
  if openness > 0.6:
314
- teaching_feedback += " • They're willing to share and engage deeply<br>\n"
315
  elif openness > 0.4:
316
- teaching_feedback += " • They're somewhat open but still cautious<br>\n"
317
  else:
318
- teaching_feedback += " • They're guarded and protective<br>\n"
319
 
320
  if mode == "trusting":
321
- teaching_feedback += " • <strong>Excellent!</strong> You've built strong rapport<br>\n"
322
  elif mode == "triggered":
323
- teaching_feedback += " • <strong>Note:</strong> The character feels defensive - try a gentler approach<br>\n"
324
  elif mode == "decompensating":
325
- teaching_feedback += " • <strong>Alert:</strong> The character is overwhelmed - consider shifting topics<br>\n"
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>