Skip to content

Commit 23e8eb2

Browse files
authored
Week 10 updates by Aman Naik (#374)
1 parent 7277186 commit 23e8eb2

File tree

4 files changed

+90
-0
lines changed

4 files changed

+90
-0
lines changed
32 KB
Loading
72.9 KB
Loading
36 KB
Loading
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
---
2+
title: "DMP ’25 Week 10 Update by Aman Naik"
3+
excerpt: "This week focused on adding an advice feature powered by the LLM, and refactoring the ChatSidebar using Gtk.Stack to resolve UI toggling issues."
4+
category: "DEVELOPER NEWS"
5+
date: "2025-08-09"
6+
slug: "2025-08-09-dmp-25-AmanNaik-week10"
7+
author: "@/constants/MarkdownFiles/authors/amannaik247.md"
8+
tags: "dmp25,writeactivity,write,sugarlabs,week10,amannaik247"
9+
image: "assets/Images/c4gt_DMP.png"
10+
---
11+
12+
<!-- markdownlint-disable -->
13+
14+
# Week 10 Progress Report by Aman Naik
15+
16+
**Project:** [Add an AI-assistant to the Write Activity](https://github.com/sugarlabs/write-activity/issues/52)
17+
**Mentors:** [Walter Bender](https://github.com/walterbender), [Ibiam Chihurumnaya](https://github.com/chimosky)
18+
**Reporting Period:** 2025-08-03 – 2025-08-09
19+
20+
---
21+
22+
## Goals for This Week
23+
24+
- Add a "Get Advice" button to provide students with feedback on their stories
25+
- Refactor ChatSidebar to properly manage chat and framework views using `Gtk.Stack`
26+
27+
---
28+
29+
## This Week’s Achievements
30+
31+
1. **Added “Get Advice” Feature**
32+
- Introduced a new button labeled **Get Advice** in the toolbar.
33+
- When clicked, the application retrieves all text written in the document using the `'get_content'` method.
34+
- The full story is then sent to an LLM along with a carefully designed prompt template.
35+
- The model responds with both advice and encouragement, written in simple, child-friendly language, attributed to a fictional guide named *Mary Tales*.
36+
- For now, the advice gets displayed on the console to quickly test out the LLM response quality.
37+
38+
![Advice being displayed in the console based on the written story](assets/Images/aman-naik-week10-img1.png)
39+
![Story that was written on the document](assets/Images/aman-naik-week10-img2.png)
40+
41+
2. **Refactored ChatSidebar with Gtk.Stack**
42+
- Migrated the sidebar view management from manual hiding/showing to `Gtk.Stack`, which allows switching between the chat and framework sections without rendering conflicts.
43+
- Fixed an issue where toggling the sidebar on/off caused **both** the chat and framework to appear simultaneously.
44+
- Now, the sidebar correctly restores the last active view when reopened, ensuring a smoother and more predictable user experience.
45+
```chatbox.py
46+
# Create a Gtk.Stack to manage different views (chat, framework)
47+
self.main_stack = Gtk.Stack()
48+
self.main_stack.set_transition_type(Gtk.StackTransitionType.SLIDE_LEFT_RIGHT)
49+
self.main_stack.set_transition_duration(300)
50+
```
51+
52+
---
53+
54+
## Challenges & How I Overcame Them
55+
56+
- **Challenge:** Old toggle logic caused multiple framework instances to stack below the chat
57+
**Cause:** Earlier implementation relied on `'show_all()'`, which rendered every child widget in the container. This resulted in vertically stacked duplicates when switching views.
58+
59+
![Old toggle logic causing multiple framework instances to stack below the chat](assets/Images/aman-naik-week10-img3.png)
60+
61+
**Solution:** Completely refactored the code so the chat section and framework section are independent widgets. They are now managed exclusively via `Gtk.Stack`, and navigation between them is handled by the **Create Framework** and **Back to Chat** buttons. This eliminated duplicate rendering and made state management far cleaner.
62+
63+
---
64+
65+
## Key Learnings
66+
67+
**Integrating Context-Aware LLM Feedback**
68+
- Learned how to combine user-generated content with structured prompt templates to produce relevant, age-appropriate feedback.
69+
70+
**Using Gtk.Stack for Multi-View UI Management**
71+
- `Gtk.Stack` provides a more robust method for switching views compared to manual widget hiding, preventing unwanted re-rendering issues.
72+
73+
**Refactoring for Maintainability**
74+
- Separating chat and framework into standalone widgets improved both readability of the code and maintainability for future UI changes.
75+
76+
---
77+
78+
## Next Week’s Roadmap
79+
80+
- Continue refining the “Get Advice” feature to make the advice visible within the activity instead of the console.
81+
- Contribute to the recent developments happening with Sugar-AI so we can quickly implement it within the write-activity.
82+
- Add proper icons to the chat and advice buttons.
83+
84+
---
85+
86+
## Acknowledgments
87+
88+
Thank you to my mentors for helping me validate the UX flow for the new advice feature and suggesting improvements for sidebar state management.
89+
90+
---

0 commit comments

Comments
 (0)