alibicer commited on
Commit
c910196
·
verified ·
1 Parent(s): 97e8a1b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -10
app.py CHANGED
@@ -17,32 +17,38 @@ REFLECTION_STEPS = [
17
  {
18
  "title": "Observing Creativity-Directed Practices",
19
  "question": "Now that you've watched the video, let's start with **Observing Creativity-Directed Practices.**\n\nWhat stood out to you the most about how the teacher encouraged student creativity?",
20
- "follow_up": "Interesting! You mentioned **{response}**. Can you explain why that strategy is effective in fostering creativity?"
 
21
  },
22
  {
23
  "title": "Small Group Interactions",
24
  "question": "Let's move to **Small Group Interactions.**\n\nWhat did you notice about how the teacher guided student discussions?",
25
- "follow_up": "You noted **{response}**. How do you think that influenced students' understanding of the problem?"
 
26
  },
27
  {
28
  "title": "Student Reasoning and Connections",
29
  "question": "Next, let’s analyze **Student Reasoning and Connections.**\n\nHow did students reason through the task? What connections did they make between percent relationships and fractions?",
30
- "follow_up": "That’s a great point about **{response}**. Can you explain why this was significant in their problem-solving process?"
 
31
  },
32
  {
33
  "title": "Common Core Practice Standards",
34
  "question": "Now, let’s discuss **Common Core Practice Standards.**\n\nWhich Common Core practice standards do you think the teacher emphasized during the lesson?",
35
- "follow_up": "You mentioned **{response}**. How do you see this practice supporting students' proportional reasoning?"
 
36
  },
37
  {
38
  "title": "Problem Posing Activity",
39
  "question": "Let’s engage in a **Problem-Posing Activity.**\n\nBased on what you observed, pose a problem that encourages students to use visuals and proportional reasoning.",
40
- "follow_up": "That's an interesting problem! Does it allow for multiple solution paths? How does it connect to the Common Core practices we discussed?"
 
41
  },
42
  {
43
  "title": "Final Reflection",
44
  "question": "📚 **Final Reflection**\n\nWhat’s one change you will make in your own teaching based on this module?",
45
- "follow_up": "That’s a great insight! How do you think implementing **{response}** will impact student learning?"
 
46
  }
47
  ]
48
 
@@ -65,8 +71,10 @@ def respond(user_message, history):
65
  if not user_message:
66
  return "", history
67
 
68
- # Determine the current step in the reflection process
69
- reflection_index = len([h for h in history if "Reflection Step" in h[1]])
 
 
70
  if reflection_index < len(REFLECTION_STEPS):
71
  current_step = REFLECTION_STEPS[reflection_index]
72
  next_reflection = current_step["question"]
@@ -75,12 +83,12 @@ def respond(user_message, history):
75
 
76
  assistant_reply = gpt_call(history, user_message)
77
 
78
- # Adjust AI response to guide sequential discussion
79
  if reflection_index > 0:
80
  follow_up_prompt = REFLECTION_STEPS[reflection_index - 1]["follow_up"].format(response=user_message)
81
  assistant_reply += f"\n\n{follow_up_prompt}"
82
 
83
- # Append the assistant's response and next reflection question
84
  history.append((user_message, assistant_reply))
85
  history.append(("", f"**Reflection Step {reflection_index + 1}:** {next_reflection}"))
86
 
 
17
  {
18
  "title": "Observing Creativity-Directed Practices",
19
  "question": "Now that you've watched the video, let's start with **Observing Creativity-Directed Practices.**\n\nWhat stood out to you the most about how the teacher encouraged student creativity?",
20
+ "follow_up": "Interesting! You mentioned **{response}**. Can you explain why that strategy is effective in fostering creativity?",
21
+ "next_step": "Small Group Interactions"
22
  },
23
  {
24
  "title": "Small Group Interactions",
25
  "question": "Let's move to **Small Group Interactions.**\n\nWhat did you notice about how the teacher guided student discussions?",
26
+ "follow_up": "You noted **{response}**. How do you think that influenced students' understanding of the problem?",
27
+ "next_step": "Student Reasoning and Connections"
28
  },
29
  {
30
  "title": "Student Reasoning and Connections",
31
  "question": "Next, let’s analyze **Student Reasoning and Connections.**\n\nHow did students reason through the task? What connections did they make between percent relationships and fractions?",
32
+ "follow_up": "That’s a great point about **{response}**. Can you explain why this was significant in their problem-solving process?",
33
+ "next_step": "Common Core Practice Standards"
34
  },
35
  {
36
  "title": "Common Core Practice Standards",
37
  "question": "Now, let’s discuss **Common Core Practice Standards.**\n\nWhich Common Core practice standards do you think the teacher emphasized during the lesson?",
38
+ "follow_up": "You mentioned **{response}**. How do you see this practice supporting students' proportional reasoning?",
39
+ "next_step": "Problem Posing Activity"
40
  },
41
  {
42
  "title": "Problem Posing Activity",
43
  "question": "Let’s engage in a **Problem-Posing Activity.**\n\nBased on what you observed, pose a problem that encourages students to use visuals and proportional reasoning.",
44
+ "follow_up": "That's an interesting problem! Does it allow for multiple solution paths? How does it connect to the Common Core practices we discussed?",
45
+ "next_step": "Final Reflection"
46
  },
47
  {
48
  "title": "Final Reflection",
49
  "question": "📚 **Final Reflection**\n\nWhat’s one change you will make in your own teaching based on this module?",
50
+ "follow_up": "That’s a great insight! How do you think implementing **{response}** will impact student learning?",
51
+ "next_step": None # End of reflections
52
  }
53
  ]
54
 
 
71
  if not user_message:
72
  return "", history
73
 
74
+ # Find the last reflection step completed
75
+ completed_steps = [h for h in history if "Reflection Step" in h[1]]
76
+ reflection_index = len(completed_steps)
77
+
78
  if reflection_index < len(REFLECTION_STEPS):
79
  current_step = REFLECTION_STEPS[reflection_index]
80
  next_reflection = current_step["question"]
 
83
 
84
  assistant_reply = gpt_call(history, user_message)
85
 
86
+ # Follow-up question before moving on
87
  if reflection_index > 0:
88
  follow_up_prompt = REFLECTION_STEPS[reflection_index - 1]["follow_up"].format(response=user_message)
89
  assistant_reply += f"\n\n{follow_up_prompt}"
90
 
91
+ # Append the assistant's response and introduce the next reflection question
92
  history.append((user_message, assistant_reply))
93
  history.append(("", f"**Reflection Step {reflection_index + 1}:** {next_reflection}"))
94