Skip to content

Commit 5cd923f

Browse files
authored
Merge pull request #4753 from Commanderk3/user-guide
User Guide for Reflection Widget
2 parents fe71ff6 + b00c45e commit 5cd923f

File tree

2 files changed

+105
-6
lines changed

2 files changed

+105
-6
lines changed

REFLECTION-WIDGET-GUIDE.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Reflection Widget - User Guide
2+
3+
The Reflection Widget lets you chat with AI mentors to reflect on and analyze your Music Blocks project. Using this tool, you can learn quickly and improve your coding and music skills.
4+
5+
## Getting Started
6+
7+
1. **Open the Reflection Widget**
8+
- You will find the reflection block in the widget palette (available in both beginner and advanced modes).
9+
- Drag it to your workspace and click it to open the widget.
10+
11+
2. **Meet Your AI Mentors**
12+
13+
There are three AI mentors in the widget:
14+
- **Rohan** (Meta) for general project reflection. He is an expert at helping you think about your project as a whole. He will discuss your goals, challenges, and learning.
15+
16+
- **Beethoven** (Music) for music-specific advice. The famous composer Ludwig van Beethoven is here to help you improve your music compositions and knowledge.
17+
18+
- **Alan** (Code) for coding help. Alan Kay, a pioneer in computer science, will assist you with coding concepts. He may ask critical questions to help you think about your code structure and logic.
19+
20+
Click the mentor’s icon to change who you’re chatting with. You can switch mentors at any time.
21+
22+
## Sending Messages
23+
24+
- Your mentor will first read your project and share their initial thoughts. They may ask if their understanding of your project is correct.
25+
- Confirm their guess to start discussing your project.
26+
- The AI mentors will ask reflective questions to help you think more deeply about your work.
27+
- Provide detailed responses to receive better feedback.
28+
- Press `Enter` or click **Send** to send your message.
29+
30+
## Tips
31+
32+
- The best way to use this tool is to have a detailed and long conversation with your mentor. The more you share, the better the feedback.
33+
- Let your mentors ask the questions; you can just sit back and answer them thoughtfully.
34+
- If your mentors are done asking questions, they will ask you if you want to continue the conversation or end it. It is up to you!
35+
- When you feel satisfied with the conversation, you can generate an analysis report. This report is based on your interactions with the mentors and the previous report. It will discuss your learning outcomes, areas for improvement, and next steps.
36+
37+
## Widget Features
38+
39+
- **Summary:**
40+
Click the notes icon to view or generate a summary (after 10+ messages).
41+
42+
- **Change Mentor:**
43+
Click the mentor icons to switch between Rohan, Beethoven, and Alan.
44+
45+
- **Save Conversation:**
46+
Click the save icon to download your chat as a `.txt` file.
47+
48+
- **Refresh Project:**
49+
Click the refresh icon to update the widget with your latest project code.
50+
51+
---
52+
53+
Enjoy reflecting and improving your projects with the help of AI mentors!

js/widgets/reflection-guide.md

Lines changed: 52 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Backend Code for the widget : [musicblocks_reflection_fastapi](https://github.co
88

99
## Key Features
1010

11-
- **Multi-mentor Chat:** Switch between AI mentors (Meta/Rohan, Music/Beethoven, Code/Steve).
11+
- **Multi-mentor Chat:** Switch between AI mentors (Meta/Rohan, Music/Beethoven, Code/Alan).
1212
- **Chat History:** Stores and renders conversation history.
1313
- **Typing Indicator:** Shows animated "Thinking..." while awaiting responses.
1414
- **Markdown Rendering:** Converts Markdown responses to HTML for display.
@@ -92,14 +92,14 @@ Backend Code for the widget : [musicblocks_reflection_fastapi](https://github.co
9292
"code": "<project code string>"
9393
}
9494
```
95-
- **Response:**
95+
- **Response:**
9696
```json
9797
{
9898
"algorithm": "<algorithm string>",
9999
"message": "<first message>"
100100
}
101101
```
102-
or
102+
or
103103
```json
104104
{
105105
"error": "<error message>"
@@ -164,21 +164,67 @@ Backend Code for the widget : [musicblocks_reflection_fastapi](https://github.co
164164

165165
---
166166

167+
### 4. `/updatecode`
168+
169+
- **Method:** `POST`
170+
- **Purpose:** Sends updated project code to the backend to refresh the algorithmic summary.
171+
- **Payload:**
172+
```json
173+
{
174+
"oldcode": "<existing project code string>",
175+
"newcode": "<new project code string>"
176+
}
177+
```
178+
- **Response:**
179+
```json
180+
{
181+
"algorithm": "<new algorithm string>",
182+
"message": "<response message>"
183+
}
184+
```
185+
186+
---
187+
167188
**All endpoints expect and return JSON.**
168189
**The backend is expected to run locally while development.**
169190

170191
---
171192

172193
### API testing
173194

195+
code :
196+
174197
```bash
175-
curl -X POST http://localhost:PORT/projectcode \
198+
curl -X GET http://localhost:8000/
199+
```
200+
201+
output :
202+
203+
```json
204+
{
205+
"message": "Hello, Music Blocks!"
206+
}
207+
```
208+
209+
Test `/projectcode` endpoint with sample project code:
210+
211+
```bash
212+
curl -X POST http://localhost:8000/projectcode \
176213
-H "Content-Type: application/json" \
177214
-d '{
178-
"code": "MUSICBLOCKS_PROJECT_CODE_HERE"
215+
"code": "[[0,[\"start\",{\"id\":123,\"collapsed\":false}],244,80,[null,18,null]],[1,\"plus\",392,440,[10,16,8]]]"
179216
}'
180217
```
181218

219+
Output:
220+
221+
```json
222+
{
223+
"algorithm": "1. Start the program.\n2. Perform an addition operation.",
224+
"response": "This looks like a very basic program designed to add two numbers. Is that correct?"
225+
}
226+
```
227+
182228
**Note** : Save your Music Blocks project as an HTML file. Open the file to locate the embedded JSON code, and make sure to stringify the JSON before using it for testing.
183229

184-
Written by : [Diwangshu Kakoty](https://github.com/Commanderk3)
230+
Written by : [Diwangshu Kakoty](https://github.com/Commanderk3)

0 commit comments

Comments
 (0)