prthm11 commited on
Commit
410d3aa
·
verified ·
1 Parent(s): 0b11c90

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -3
app.py CHANGED
@@ -801,6 +801,14 @@ def pseudo_generator_node(state: GameState):
801
  # MODIFICATION 1: Include 'Stage' in the list of names to plan for.
802
  # It's crucial to ensure 'Stage' is always present for its global role.
803
  target_names = [t["name"] for t in project_json["targets"]]
 
 
 
 
 
 
 
 
804
 
805
  refinement_prompt = f"""
806
  You are an expert in Scratch 3.0 game development, specializing in understanding block relationships (stacked, nested).
@@ -808,8 +816,15 @@ You are an expert in Scratch 3.0 game development, specializing in understanding
808
  From Image, you also have to detect a value of Key given in Text form "Script for: ". Below is the example
809
  Example: "Script for: Bear", "Script for:" is a key and "Bear" is value and check if there is related target name available.
810
 
811
- **Targets in Game (Sprites and Stage) available in project_json:** {', '.join(target_names)}
 
 
812
 
 
 
 
 
 
813
  --- Scratch 3.0 Block Reference ---
814
  ### Hat Blocks
815
  Description: {hat_description}
@@ -2612,8 +2627,8 @@ def process_pdf():
2612
  "temp_pseudo_code":[],
2613
  }
2614
 
2615
- final_state_dict = app_graph.invoke(initial_state_dict) # Pass dictionary
2616
-
2617
  final_project_json = final_state_dict['project_json'] # Access as dict
2618
  # final_project_json = project_skeleton
2619
 
 
801
  # MODIFICATION 1: Include 'Stage' in the list of names to plan for.
802
  # It's crucial to ensure 'Stage' is always present for its global role.
803
  target_names = [t["name"] for t in project_json["targets"]]
804
+ stage_names = [t["name"] for t in project_json["targets"] if t.get("isStage")]
805
+ sprite_names = [t["name"] for t in project_json["targets"] if not t.get("isStage")]
806
+ # Get costumes separately for Stage and Sprites
807
+ stage_costumes = [
808
+ c["name"]
809
+ for t in project_json["targets"] if t.get("isStage")
810
+ for c in t.get("costumes", [])
811
+ ]
812
 
813
  refinement_prompt = f"""
814
  You are an expert in Scratch 3.0 game development, specializing in understanding block relationships (stacked, nested).
 
816
  From Image, you also have to detect a value of Key given in Text form "Script for: ". Below is the example
817
  Example: "Script for: Bear", "Script for:" is a key and "Bear" is value and check if there is related target name available.
818
 
819
+ **Special Rule for Stage Costumes:**
820
+ If the value of "Script for:" exactly matches ANY costume name in the Stage_costumes list given below,
821
+ then the `"name_variable"` in the output JSON must be set to `"Stage"` (not the costume name).
822
 
823
+ **Targets in Game (Sprites and Stage) available in project_json:**
824
+ Sprite_name:{', '.join(sprite_names)}
825
+ Stage_name: Stage
826
+ Stage_costumes: {', '.join(stage_costumes)}
827
+
828
  --- Scratch 3.0 Block Reference ---
829
  ### Hat Blocks
830
  Description: {hat_description}
 
2627
  "temp_pseudo_code":[],
2628
  }
2629
 
2630
+ #final_state_dict = app_graph.invoke(initial_state_dict) # Pass dictionary
2631
+ final_state_dict = app_graph.invoke(initial_state_dict,config={"recursion_limit": 200})
2632
  final_project_json = final_state_dict['project_json'] # Access as dict
2633
  # final_project_json = project_skeleton
2634