diff --git a/app.py b/app.py index 7e702fe..74f876b 100644 --- a/app.py +++ b/app.py @@ -2182,16 +2182,10 @@ def display_activity_info(room_name, username): ) return - # Load the activity YAML from S3 - s3_client = boto3.client("s3") - bucket_name = os.environ.get("S3_BUCKET_NAME") - s3_file_path = activity_state.s3_file_path + # Load the activity content + activity_content = get_activity_content(activity_state.s3_file_path) try: - response = s3_client.get_object(Bucket=bucket_name, Key=s3_file_path) - activity_yaml = response["Body"].read().decode("utf-8") - activity_content = yaml.safe_load(activity_yaml) - # Fetch the entire room history all_messages = ( Message.query.filter_by(room_id=room.id) diff --git a/research/activity17-choose-adventure.yaml b/research/activity17-choose-adventure.yaml index 21608da..c98b3da 100644 --- a/research/activity17-choose-adventure.yaml +++ b/research/activity17-choose-adventure.yaml @@ -29,7 +29,7 @@ sections: transitions: prize_1: content_blocks: - - "You received Prize 1: A golden keychain. πŸ—οΈ" + - "You received Prize 1: A golden keychain. πŸ—" next_section_and_step: "section_2:step_1" metadata_add: golden_keychain: true @@ -59,7 +59,7 @@ sections: magical_wand: true prize_6: content_blocks: - - "You received Prize 6: A treasure map. πŸ—ΊοΈ" + - "You received Prize 6: A treasure map. πŸ—Ί" next_section_and_step: "section_2:step_1" metadata_add: treasure_map: true @@ -98,7 +98,7 @@ sections: - step_id: "step_1" title: "Offer to the God" content_blocks: - - "You have entered the temple pit. πŸ›οΈ" + - "You have entered the temple pit. πŸ›" - "You can offer an item to the god to receive a new item." tokens_for_ai: "Guide the user to make a choice between offering different items." question: "Which item do you offer to the god? πŸ€”" @@ -114,10 +114,13 @@ sections: - offer_rare_book - offer_magical_potion - go_back + - off_topic transitions: offer_golden_keychain: + metadata_conditions: + golden_keychain: true content_blocks: - - "You offered the golden keychain to the god. πŸ—οΈ" + - "You offered the golden keychain to the god. πŸ—" - "The god grants you a mystical amulet. 🧿" next_section_and_step: "section_2:step_1" metadata_add: @@ -125,6 +128,8 @@ sections: metadata_remove: golden_keychain: true offer_mysterious_amulet: + metadata_conditions: + mysterious_amulet: true content_blocks: - "You offered the mysterious amulet to the god. 🧿" - "The god grants you a rare gemstone. πŸ’Ž" @@ -134,6 +139,8 @@ sections: metadata_remove: mysterious_amulet: true offer_rare_gemstone: + metadata_conditions: + rare_gemstone: true content_blocks: - "You offered the rare gemstone to the god. πŸ’Ž" - "The god grants you an ancient scroll. πŸ“œ" @@ -143,6 +150,8 @@ sections: metadata_remove: rare_gemstone: true offer_ancient_scroll: + metadata_conditions: + ancient_scroll: true content_blocks: - "You offered the ancient scroll to the god. πŸ“œ" - "The god grants you a magical wand. πŸͺ„" @@ -152,17 +161,21 @@ sections: metadata_remove: ancient_scroll: true offer_magical_wand: + metadata_conditions: + magical_wand: true content_blocks: - "You offered the magical wand to the god. πŸͺ„" - - "The god grants you a treasure map. πŸ—ΊοΈ" + - "The god grants you a treasure map. πŸ—Ί" next_section_and_step: "section_2:step_1" metadata_add: treasure_map: true metadata_remove: magical_wand: true offer_treasure_map: + metadata_conditions: + treasure_map: true content_blocks: - - "You offered the treasure map to the god. πŸ—ΊοΈ" + - "You offered the treasure map to the god. πŸ—Ί" - "The god grants you a silver coin. πŸͺ™" next_section_and_step: "section_2:step_1" metadata_add: @@ -170,6 +183,8 @@ sections: metadata_remove: treasure_map: true offer_silver_coin: + metadata_conditions: + silver_coin: true content_blocks: - "You offered the silver coin to the god. πŸͺ™" - "The god grants you a mystical ring. πŸ’" @@ -179,6 +194,8 @@ sections: metadata_remove: silver_coin: true offer_mystical_ring: + metadata_conditions: + mystical_ring: true content_blocks: - "You offered the mystical ring to the god. πŸ’" - "The god grants you a rare book. πŸ“š" @@ -188,6 +205,8 @@ sections: metadata_remove: mystical_ring: true offer_rare_book: + metadata_conditions: + rare_book: true content_blocks: - "You offered the rare book to the god. πŸ“š" - "The god grants you a magical potion. πŸ§ͺ" @@ -197,9 +216,11 @@ sections: metadata_remove: rare_book: true offer_magical_potion: + metadata_conditions: + magical_potion: true content_blocks: - "You offered the magical potion to the god. πŸ§ͺ" - - "The god grants you a golden keychain. πŸ—οΈ" + - "The god grants you a golden keychain. πŸ—" next_section_and_step: "section_2:step_1" metadata_add: golden_keychain: true @@ -209,3 +230,7 @@ sections: content_blocks: - "You chose to go back to the prize room. 🎁" next_section_and_step: "section_1:step_1" + off_topic: + ai_feedback: + tokens_for_ai: "Gently guide the user back to the story in a supportive manner. Use emojis like πŸ”„ and 🧭." + next_section_and_step: "section_2:step_1"