Spaces:
Sleeping
Sleeping
Create Stage1_functions_definition.py
Browse files
pathways/Solara2/Stage1_functions_definition.py
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
def process_structured_output(stage_key_values, output_json):
|
| 2 |
+
print("-----", output_json)
|
| 3 |
+
if "current_stage" in stage_key_values:
|
| 4 |
+
if stage_key_values["current_stage"] != output_json["stage_number"]:
|
| 5 |
+
stage_key_values["interaction_count"] = 0
|
| 6 |
+
|
| 7 |
+
stage_key_values["current_stage"] = output_json["stage_number"]
|
| 8 |
+
|
| 9 |
+
# Solara Part 2 (Halvik backstage) images — adjust filenames if needed.
|
| 10 |
+
image = "pathways/Solara2/assets/backstage_hall.png"
|
| 11 |
+
|
| 12 |
+
if stage_key_values["current_stage"] == 1:
|
| 13 |
+
image = "pathways/Solara2/assets/backstage_hall.png" # Post-performance corridor/wing
|
| 14 |
+
elif stage_key_values["current_stage"] == 2:
|
| 15 |
+
image = "pathways/Solara2/assets/halvik_intro.png" # First chat with Halvik
|
| 16 |
+
elif stage_key_values["current_stage"] == 3:
|
| 17 |
+
image = "pathways/Solara2/assets/halvik_blame.png" # Subtle blame surfaces
|
| 18 |
+
elif stage_key_values["current_stage"] == 4:
|
| 19 |
+
image = "pathways/Solara2/assets/halvik_challenge.png" # Player distinguishes control vs. not
|
| 20 |
+
elif stage_key_values["current_stage"] == 5:
|
| 21 |
+
image = "pathways/Solara2/assets/halvik_reflection.png" # Halvik’s mindset shift
|
| 22 |
+
stage_key_values["stage_complete"] = True
|
| 23 |
+
|
| 24 |
+
return {
|
| 25 |
+
"text": [
|
| 26 |
+
output_json["dungeon_master_response"]
|
| 27 |
+
],
|
| 28 |
+
"image": image
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
def forced_stage_exit(stage_key_values):
|
| 32 |
+
print("In forced_stage_exit function:", stage_key_values)
|
| 33 |
+
stage_key_values["stage_complete"] = True
|
| 34 |
+
|
| 35 |
+
return {
|
| 36 |
+
"text": ["You’ve lingered too long backstage. The performers disperse, and your chance to speak with Halvik passes."]
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
def checker_function(stage_key_values):
|
| 40 |
+
# Reset per your existing pattern
|
| 41 |
+
stage_key_values["interaction_count_for_hint"] = 0
|
| 42 |
+
|
| 43 |
+
# Stage-specific nudges for Solara2 (Halvik)
|
| 44 |
+
if stage_key_values.get("current_stage") == 1:
|
| 45 |
+
return {
|
| 46 |
+
"text": ["Find Halvik the lute player backstage and greet him after the performance."]
|
| 47 |
+
}
|
| 48 |
+
elif stage_key_values["current_stage"] == 2:
|
| 49 |
+
return {
|
| 50 |
+
"text": ["Listen to Halvik. Take note of issues he mentions that were outside his control."]
|
| 51 |
+
}
|
| 52 |
+
elif stage_key_values["current_stage"] == 3:
|
| 53 |
+
return {
|
| 54 |
+
"text": ["Ask follow-up questions to surface more examples. What else affected his performance tonight?"]
|
| 55 |
+
}
|
| 56 |
+
elif stage_key_values["current_stage"] == 4:
|
| 57 |
+
return {
|
| 58 |
+
"text": ["Separate what Halvik can’t control (lighting, audience, others) from what he can (tempo, focus, technique) and explain it to him."]
|
| 59 |
+
}
|
| 60 |
+
elif stage_key_values["current_stage"] == 5:
|
| 61 |
+
return {
|
| 62 |
+
"text": ["Wrap up and follow Cassian to your next introduction."]
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
# Fallback
|
| 66 |
+
return {
|
| 67 |
+
"text": ["Speak with Halvik about what’s within his control versus what isn’t."]
|
| 68 |
+
}
|