|
| 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" |
| 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 | +### Final Thoughts |
| 104 | + |
| 105 | +This week involved deep integration between previously decoupled components of the app. Bridging the JSON converter and the debugger not only streamlines the UX but also unlocks better prompt generation for the LLM. |
| 106 | + |
| 107 | +From a technical standpoint, handling state persistence, error boundaries, and contextual prompt generation offered many learning opportunities. I’m also seeing the value of modular code (`convert_music_blocks`, `retrieve_relevant_chunks`, etc.) in accelerating such integrations. |
| 108 | + |
| 109 | +--- |
| 110 | + |
| 111 | +### Next Week’s Roadmap |
| 112 | + |
| 113 | +* Deploy the debugger application to the official Sugar Labs AWS server |
| 114 | +* Create a Music Blocks Debugger widget for seamless in-platform integration. |
| 115 | + |
| 116 | +--- |
| 117 | + |
| 118 | +## Resources & References |
| 119 | + |
| 120 | +- **Repository:** [AI-powered Debugger for Music Blocks](https://github.com/omsuneri/AI-powered-Debugger-for-Music-Blocks) |
| 121 | +- **Debugger Streamlit App:** [Music Blocks Debugger](https://debuggmb.streamlit.app/) |
| 122 | +- **Directory for Projects:** [Embedding Project Set](https://github.com/omsuneri/AI-powered-Debugger-for-Music-Blocks/tree/main/data/docs) |
| 123 | + |
| 124 | +--- |
| 125 | + |
| 126 | +### Acknowledgments |
| 127 | + |
| 128 | +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. |
| 129 | + |
| 130 | +--- |
0 commit comments