|
| 1 | +--- |
| 2 | +title: "GSoC’25 Week 06 Update by Om Santosh Suneri" |
| 3 | +excerpt: "AI-powered Debugger for Music Blocks" |
| 4 | +category: "DEVELOPER NEWS" |
| 5 | +date: "2025-07-13" |
| 6 | +slug: "2025-07-13-gsoc-25-omsuneri-week06" |
| 7 | +author: "@/constants/MarkdownFiles/authors/om-santosh-suneri.md" |
| 8 | +tags: "gsoc25,sugarlabs,week06,Debugger,AI,Music Blocks,GSoC Midterm" |
| 9 | +image: "assets/Images/GSOC.png" |
| 10 | +--- |
| 11 | + |
| 12 | +<!-- markdownlint-disable --> |
| 13 | + |
| 14 | +# Week 06 Progress Report by Om Santosh Suneri |
| 15 | + |
| 16 | +**Project:** [AI-powered Debugger for Music Blocks](https://github.com/omsuneri/AI-powered-Debugger-for-Music-Blocks) |
| 17 | +**Mentors:** [Walter Bender](https://github.com/walterbender/) [Sumit Srivastava](https://github.com/sum2it) |
| 18 | +**Assisting Mentors:** [Devin Ulibarri](https://github.com/pikurasa/) |
| 19 | +**Reporting Period:** 2025-07-06 - 2025-07-12 |
| 20 | + |
| 21 | +--- |
| 22 | + |
| 23 | +## Goal for This Week |
| 24 | + |
| 25 | +**Build a tightly integrated debugging experience by embedding the JSON-to-Text converter into the main debugger Streamlit app and enabling users to export complete chat logs with the AI assistant** |
| 26 | + |
| 27 | +--- |
| 28 | + |
| 29 | +## This Week’s Achievements |
| 30 | + |
| 31 | +### Introduction |
| 32 | + |
| 33 | +This week’s focus was two-fold: |
| 34 | + |
| 35 | +1. **Merge and integrate** the Music Blocks JSON-to-Text converter directly into the existing Streamlit-based debugger UI. |
| 36 | +2. **Enhance user experience** by introducing a "Chat Export" feature that allows users to download their complete AI-debugger conversation history in `.txt` format. |
| 37 | + |
| 38 | +These updates mark a major usability milestone and make the debugging experience smoother and more developer-friendly. |
| 39 | + |
| 40 | +### What I Did |
| 41 | + |
| 42 | +#### 1. Embedded JSON-to-Text Converter in the Debugger Workflow |
| 43 | + |
| 44 | +Previously, users had to first convert their Music Blocks JSON into readable text using a separate converter app and then copy that result into the debugger interface. This extra step caused friction in the user flow. |
| 45 | + |
| 46 | +Now, I’ve **fully integrated the `convert_music_blocks()` function** (from our `json_parser.py` module) directly into the debugger pipeline. Here’s how it works: |
| 47 | + |
| 48 | +* A user pastes raw Music Blocks JSON code into a text area inside the main debugger app. |
| 49 | +* Upon clicking **"🚀 Launch My Music Blocks Project!"**, the code is parsed using `json.loads()` and fed into the `convert_music_blocks()` function. |
| 50 | +* This recursive function translates the block structure into a clean, readable text representation using a tree-like format (`├──`, `│`, etc.), supporting clamp/stack logic and deeply nested project structures. |
| 51 | +* The converted code is **stored in `st.session_state.project_code`** and becomes the foundational context for the entire debugging session. |
| 52 | + |
| 53 | +**Key Enhancements**: |
| 54 | + |
| 55 | +* Handles more block types like `arc`, `incrementOne`, `pitch`, and `settransposition`. |
| 56 | +* Automatically redacts base64-encoded data like audio/image blobs by replacing them with `"data"` in output. |
| 57 | +* Maintains formatting consistency to assist LLM comprehension and improve semantic chunk retrieval. |
| 58 | + |
| 59 | +--- |
| 60 | + |
| 61 | +#### 2. Chat Export Functionality |
| 62 | + |
| 63 | +To support documentation, sharing, and revisiting past sessions, I implemented a **chat export button**. The feature is context-aware and only appears when the user has interacted with the debugger. |
| 64 | + |
| 65 | +**Implementation Details**: |
| 66 | + |
| 67 | +* On each AI-user interaction, chat messages are appended to `st.session_state.chat_history` as a list of message dictionaries (`{"role": ..., "content": ...}`). |
| 68 | +* The `generate_chat_export()` function: |
| 69 | + |
| 70 | + * Adds a timestamp using Python’s `datetime.now()`. |
| 71 | + * Includes both the original converted project code and the full chat history. |
| 72 | + * Formats everything into plain text. |
| 73 | +* The Streamlit `st.download_button()` is used to render the export option, generating a downloadable `.txt` file named like `music_blocks_chat_20250711_143512.txt`. |
| 74 | + |
| 75 | +This makes the tool much more practical for teachers or learners who want to **archive** AI insights, share results, or continue the session later. |
| 76 | + |
| 77 | +--- |
| 78 | + |
| 79 | +### Why These Features Matter |
| 80 | + |
| 81 | +**Improved UX**: |
| 82 | +With the converter now inside the debugger, users no longer need to juggle multiple tools. They can paste once, click once, and begin debugging immediately. |
| 83 | + |
| 84 | +**Smarter Debugging**: |
| 85 | +The LLM uses the converted project code + relevant chunks from Music Blocks documentation (via `retrieve_relevant_chunks()`) to generate highly contextual, beginner-friendly replies. |
| 86 | + |
| 87 | +**Educational Value**: |
| 88 | +Students and educators can **save their interactions**, review solutions offline, or submit chat logs for peer or mentor feedback. |
| 89 | + |
| 90 | +--- |
| 91 | + |
| 92 | +### Preview Features |
| 93 | + |
| 94 | +<a href=""><img src="https://i.ibb.co/FbHymBYN/Screenshot-2025-07-11-at-2-16-30-PM.png" alt="Music Blocks Debugger"></a> |
| 95 | + |
| 96 | +* 🔁 One-click conversion of Music Blocks JSON to structured text. |
| 97 | +* 💬 Chat-driven debugging using Music Blocks Bot + documentation chunks. |
| 98 | +* 💾 "Export Chat" button for persistent chat history. |
| 99 | +* 🧽 "Clear Chat" button to reset sessions easily. |
| 100 | + |
| 101 | +--- |
| 102 | + |
| 103 | +## Midterm Evaluation Summary (Weeks 01–06) |
| 104 | + |
| 105 | +The first six weeks of GSoC 2025 have been focused on architecting and implementing the core systems behind the **AI-powered Debugger for Music Blocks**. From block parsing and embedding generation to LLM integration and full-stack deployment, the project has steadily evolved into a functional, AI-assisted debugging tool optimized for kids and educators. |
| 106 | + |
| 107 | +--- |
| 108 | + |
| 109 | +### Key Technical Achievements |
| 110 | + |
| 111 | +* **JSON-to-Text Parser**: Migrated the logic-heavy JavaScript converter to Python, maintaining tree-structured formatting (`├──`, `│`) and supporting recursion for nested Music Blocks projects. This makes visual projects readable and interpretable as text. |
| 112 | + |
| 113 | +* **Streamlit Interface**: Built a clean, user-friendly UI that enables users to paste JSON, parse it live, and interact with the AI debugger—all in one app. Integrated Gemini for generating responses tailored to kids. |
| 114 | + |
| 115 | +* **Vector Search with Qdrant**: Generated semantic embeddings from 14 curated Music Blocks projects and stored them in a Qdrant vector DB. This enables chunk retrieval from documentation and real examples to enhance LLM understanding. |
| 116 | + |
| 117 | +* **RAG Pipeline**: Combined user input + parsed project code + vector context to construct dynamic prompts for the LLM. Prompt behavior adapts based on session length to balance discovery and solution guidance. |
| 118 | + |
| 119 | +* **Export + UX Enhancements**: Added `.txt` chat export, refined session state handling, and introduced autoscroll + dynamic prompt control for a polished user experience. |
| 120 | + |
| 121 | +--- |
| 122 | + |
| 123 | +### Why It Matters |
| 124 | + |
| 125 | +By allowing users to paste a Music Blocks JSON file and instantly receive both a clean text summary and interactive feedback from an AI assistant, the tool reduces the barrier to debugging and learning. It helps students understand project flow, educators explain logic, and kids explore possibilities in a guided, friendly way. |
| 126 | + |
| 127 | +--- |
| 128 | + |
| 129 | +### Final Thoughts |
| 130 | + |
| 131 | +Over the past six weeks, I’ve transitioned from building isolated components to integrating them into a cohesive, interactive debugger. This week’s merge of the JSON converter into the main app simplified the workflow and enabled richer, context-aware prompts for the LLM. |
| 132 | + |
| 133 | +Technically, it deepened my understanding of state management, error handling, and modular design. Functions like convert_music_blocks() and retrieve_relevant_chunks() proved invaluable for maintaining clean, scalable code. The debugger is now not just functional — it’s ready to be embedded, deployed, and used meaningfully by kids and educators alike. |
| 134 | + |
| 135 | +--- |
| 136 | + |
| 137 | +### Next Week’s Roadmap |
| 138 | + |
| 139 | +* **Deploy the app to Sugar Labs’ AWS server** for long-term availability and community usage. |
| 140 | +* **Develop a Music Blocks Widget** to embed the debugger directly into the Music Blocks environment for seamless integration and real-time support. |
| 141 | + |
| 142 | +--- |
| 143 | + |
| 144 | +## Resources & References |
| 145 | + |
| 146 | +- **Repository:** [AI-powered Debugger for Music Blocks](https://github.com/omsuneri/AI-powered-Debugger-for-Music-Blocks) |
| 147 | +- **Debugger Streamlit App:** [Music Blocks Debugger](https://debuggmb.streamlit.app/) |
| 148 | +- **Directory for Projects:** [Embedding Project Set](https://github.com/omsuneri/AI-powered-Debugger-for-Music-Blocks/tree/main/data/docs) |
| 149 | + |
| 150 | +--- |
| 151 | + |
| 152 | +### Acknowledgments |
| 153 | + |
| 154 | +Thanks to my mentors Walter Bender for the consistent feedback and support, and to Devin Ulibarri for assisting with insights into Music Blocks educational usage. The Sugar Labs community continue to be an invaluable support system. |
| 155 | + |
| 156 | +--- |
0 commit comments