
subhan_ahmed397

This project is an AI-powered coding teacher built with Streamlit and an OpenAI-compatible client pointed at the AIML API. It uses the GPT-5 model to deliver adaptive, Socratic guidance across Beginner, Intermediate, and Advanced modes. The app detects when users paste code and responds with clear explanations, issue spotting, improvements, refactors, and practice tasks. Responses stream live and can automatically continue when truncated, keeping long explanations coherent. Key capabilities: * Adaptive mentoring: adjusts tone, depth, and examples across three levels. * Code awareness: detects code in input and switches to explanation, issue spotting, refactoring, and exercises. * Streaming replies: shows tokens as they arrive for a responsive feel. * Auto-continuation: resumes exactly where a reply was cut off due to token limits. * Token budgeting: estimates prompt size and clamps `max output tokens` to fit context. * Periodic summarization: condenses chat history to preserve context in longer sessions. * Topic tracking: infers topics from prompts and saves them to `progress.json`. * Export: downloads the full conversation as JSON for review or sharing. * Controls: sidebar sliders for `temperature`, `top_p`, `max output tokens`, `auto-continue`, and continuation count, plus a Clear Chat action. How it works: * System prompts are tailored by level to balance clarity and rigor. * A lightweight code detector switches instructions between Q\&A mode and code-analysis mode. * The app streams tokens via the chat completions API and aggregates segments if `auto-continue` is enabled. * Context is managed with lightweight summaries refreshed periodically. * Session state stores the visible conversation and mirrored chat log (`CHAT_KEY`) initialized via `init_chat_history` from `utils.py`. Export is provided by `export_chat_bytes`.
24 Aug 2025