alibicer commited on
Commit
b8542fc
·
verified ·
1 Parent(s): dbfc2bc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -89,7 +89,7 @@ REFLECTION_STEPS = [
89
  "title": "Final Reflection",
90
  "question": "📚 **Final Reflection**\n\nWhat’s one change you will make in your own teaching based on this module?",
91
  "follow_up": "That’s a great insight! How do you think implementing **{response}** will impact student learning?",
92
- "next_step": None # End of reflections
93
  }
94
  ]
95
 
@@ -105,12 +105,18 @@ def respond(user_message, history):
105
  current_step = REFLECTION_STEPS[reflection_index]
106
  next_reflection = current_step["question"]
107
  else:
108
- next_reflection = "You've completed the reflections. Would you like to discuss anything further?"
 
 
 
 
 
 
109
 
110
  assistant_reply = gpt_call(history, user_message)
111
 
112
  # Follow-up question before moving on
113
- if reflection_index > 0:
114
  follow_up_prompt = REFLECTION_STEPS[reflection_index - 1]["follow_up"].format(response=user_message)
115
  assistant_reply += f"\n\n{follow_up_prompt}"
116
 
 
89
  "title": "Final Reflection",
90
  "question": "📚 **Final Reflection**\n\nWhat’s one change you will make in your own teaching based on this module?",
91
  "follow_up": "That’s a great insight! How do you think implementing **{response}** will impact student learning?",
92
+ "next_step": "End" # Final step
93
  }
94
  ]
95
 
 
105
  current_step = REFLECTION_STEPS[reflection_index]
106
  next_reflection = current_step["question"]
107
  else:
108
+ # If it's the last step, check the user's response
109
+ if user_message.strip().lower() in ["no", "no thanks", "i'm done"]:
110
+ assistant_reply = "Thank you for engaging in this reflection! If you ever have more thoughts or questions, feel free to return. Happy teaching! 🎉"
111
+ history.append((user_message, assistant_reply))
112
+ return "", history
113
+ else:
114
+ next_reflection = "You've completed the reflections. Would you like to discuss anything further?"
115
 
116
  assistant_reply = gpt_call(history, user_message)
117
 
118
  # Follow-up question before moving on
119
+ if reflection_index > 0 and reflection_index < len(REFLECTION_STEPS):
120
  follow_up_prompt = REFLECTION_STEPS[reflection_index - 1]["follow_up"].format(response=user_message)
121
  assistant_reply += f"\n\n{follow_up_prompt}"
122