Skip to content

[codex] Upgrade dual-end math learning workbench - #1

Draft
Xiaotian69 wants to merge 29 commits into
mainfrom
codex/dual-workbench-ui-miniprogram
Draft

[codex] Upgrade dual-end math learning workbench#1
Xiaotian69 wants to merge 29 commits into
mainfrom
codex/dual-workbench-ui-miniprogram

Conversation

@Xiaotian69

Copy link
Copy Markdown
Owner

What changed

This PR turns the project into a stronger dual-end learning workbench story: the web app becomes a polished editorial math workspace, and the WeChat Mini Program now receives and renders teaching diagrams instead of staying text-only.

Web workbench

  • Adds the programmatic diagram engine and expanded renderer registry for number lines, function plots, epsilon-delta diagrams, asymptotes, sequence diagrams, geometry, regions, and tables.
  • Self-hosts serif/mono web fonts so the app no longer depends on Google CDN for the core editorial look.
  • Refines the chapter, exercise, and AI tutor surfaces so the workbench reads as a learning loop: resources, lecture, diagrams, practice, feedback, and context-aware tutoring.
  • Adds the indefinite-integral sample diagrams/content as a richer chapter example.

WeChat Mini Program

  • Extends scripts/build-wx-data.js so shared JSON diagrams are bundled into each knowledge point.
  • Adds a reusable diagram-card component for mini program study pages.
  • Shows diagram counts on the home, chapter, and study screens.
  • Fixes exercise selection inside filtered exercise lists by selecting by exercise id rather than filtered-list index.
  • Adds npm run validate:wx-diagrams and wires it into validate:all so the mini program diagram path is checked on every full validation run.

Content and delivery assets

  • Adds the Gaodeng Shuxue scaffold and task-list plan for the next content track.
  • Adds TeX sources for final exam sets while keeping generated PDFs ignored.

Why this matters

The project now tells a much clearer product story: one JSON content source powers both a Next.js web workbench and a WeChat Mini Program. The web side shows high-fidelity mathematical diagrams and AI-assisted practice; the mini program now exposes diagrams, practice, progress, and AI in the same learning rhythm. This closes the biggest dual-end gap without changing the content schema.

Validation

  • npm run validate:wx-diagrams passed and generated mini program data with 22 chapters, 93 knowledge points, 214 exercises, and diagram payloads attached to knowledge points.
  • npm run validate:all passed, including content validation, AI contract checks, progress/mastery checks, mini program diagram validation, and next build.

Note: next build completed successfully but emitted repeated Windows SWC native package warnings: @next/swc-win32-x64-msvc ... is not a valid Win32 application. Next fell back and still produced a successful production build.

Known boundaries

  • Mini program diagram rendering is a practical first pass: it renders teaching diagram cards and lightweight visualizations. Pixel-level parity with the web SVG engine remains a follow-up.
  • Generated mini program data and PDFs remain ignored artifacts; source JSON and TeX are committed.
  • The remaining 18 math-analysis chapters still need content thickening beyond this UI/platform PR.

Xiaotian and others added 29 commits June 9, 2026 17:00
- adaptExercise now falls back to `problemStatement` field (used in
  6 newer exercise files — was the root cause of blank exercise cards)
- Add `title?: string` to Exercise type; use it as card preview label
  instead of stripped/mangled math — gives clean Chinese titles on cards
- Wrap problem in `.problem-statement` callout box with accent border;
  add `.answer-label` separator before textarea
- Add `.is-primary` button variant for AI-grade submit action
- Include previously unflushed JSON syntax fixes for 7 exercise files

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- MathText: add **bold** and *italic* markdown parsing in non-LaTeX
  segments — coreExplanation uses this heavily for key term callouts
- DiagramRenderer: route to ConceptDiagram for graph/function/geometry
  types instead of the wrong sequence plot; only use SequencePlotDiagram
  for actual sequence diagram types
- ConceptDiagram: new text-based diagram card (no misleading SVG) that
  shows title, description, and student prompt with gold-border styling

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add overview text to all 15 new-format chapter JSON files (was empty
  for every chapter using chapterId format — visible as blank space in
  the chapter header)
- Fix adaptChapter: was hardcoding overview: "" which overwrote the
  field even when present in the JSON

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Wire \"对照评分要点\" button to programmatically open the rubric
  <details> element and scroll it into view
- Hint button now shows progress (e.g. \"再来一个提示 (1/3)\") and
  disables when all hints are revealed

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
All 93 KPs have commonMistakes data but it was invisible (only sent to
the AI system prompt). Add a collapsible \"易错提醒\" section below
思考题 so students see common pitfalls before attempting exercises.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
<span> wrapping <p> elements was invalid HTML. Multi-paragraph MathText
now emits <div> instead of <span>. Also fix grade feedback <p> → <div>
since AI feedback can contain multiple paragraphs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add \"第 N 题 · 共 M 题\" label at top of exercise workspace so users
know which exercise they are working on relative to the set.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Complete native mini program for the math-analysis tutor:
- 5 pages: index (章节列表), chapter (KP导航), study (讲义+练习), chat (AI老师), settings
- math-text component: rich-text node rendering for LaTeX/markdown
- utils/parser.js: text→rich-text node conversion
- utils/api.js: DeepSeek chat + grading API (wx.request)
- utils/progress.js: wx.storage backed KP/exercise/chat persistence
- KP prev/next navigation; exercise score badges; chapter progress bars
- Chat: persisted history, scroll-to-bottom, user bubble white text
- Settings: API key override stored locally; domain config instructions
- scripts/build-wx-data.js: bundles 22ch/93KP/214ex into data/all-chapters.js
- .gitignore: excludes config.js (API key) and generated data bundle

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
parser.js: rewrite block builder to handle bullet/ordered lists as
proper rich-text node groups, not inline text. Group consecutive list
items into container divs; separate paragraph logic preserves <br>
between wrapped text lines.

index page: add "继续学习" card that finds the most recently studied
KP by lastStudied timestamp and offers one-tap resume. Card uses
accent left-border style, refreshes on onShow() after returning from
study page.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Pages/onboarding: swipeable 3-card intro covering content scope,
exercises+grading, and AI tutoring. Custom nav bar, warm paper
background, dot indicators with animated active state.

app.js: on first launch (ma_onboarded key absent) redirects to
onboarding page. Onboarding writes the flag and redirects to index
on completion or skip.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add difficulty pill CSS (基础/中档/提升 in green/yellow/pink)
- Grade result now shows verdict title (非常棒/做得不错/部分正确/还需改进)
- vibrateShort on KP prev/next navigation, hint reveal, and grading success

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Every message now stores a ts (Date.now()) and shows formatted HH:MM
  below the bubble in a light grey label
- Typing indicator uses CSS @Keyframes blink animation on the dots
- vibrateShort(light) on send for tactile feedback
- clearChat and new sessions also timestamp the opening message

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Computes progressPct and isComplete in _enrich()
- Chapter header now shows a progress bar (accent color) when any KP is
  studied; turns green when all KPs complete
- "✓ 已完成" green badge replaces the fraction counter when fully done

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Computes overall progress on load: KPs studied, exercises attempted,
avg score across all chapters, overall completion %. Shows a 2x2 stat
grid only when any KP has been studied (hidden for fresh installs).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
api.js: translate HTTP 401/429/500/503 to Chinese messages; improve
network error messages; add parseGradeJson() with fallback JSON regex
extraction in case AI wraps response in markdown.

chat.js: extract _sendToApi() method; add hasError/lastErrorMsg state;
add retryLastMessage() that re-sends current messages without re-adding
a user message; pass errors to hasError state instead of appending a
fake assistant message.

chat.wxml/wxss: show error banner with retry button at bottom of
messages when hasError is true.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The nav bar center now shows two mini pills below the position
counter: "N 题" (accent) for exercise count, and "NN 分" (green/yellow)
for best score achieved on this KP. Shows instantly from stored
progress data — no API calls needed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- onShareAppMessage/onShareTimeline on index page (system share menu)
- Settings page: "分享给同学" button using open-type=share
- Settings page: onShareAppMessage/onShareTimeline handlers

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
index: show gold left-border hint bar "从第1章开始…" when no KP has
been studied yet (replaces continue-card which only shows with progress)

chapter: show "点击开始学习" gold hint in section header when no KP in
the chapter has been visited

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Study learn tab now shows "第N章 章名 › 知识点名" breadcrumb at the top,
giving users context about where they are in the course structure.

Version bumped to 1.1.0 in settings about section.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
When a KP has 5+ exercises, filter chips appear above the list:
全部/基础/中档/提升/待做. Filtering updates filteredExercises array
reactively. After grading, filteredExercises re-applies the current
filter so scores update without resetting the view.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
progress.js: clearAllProgress() deletes all ma_ keys from wx.storage
except the API key override (ma_apikey).

Settings page: "数据管理" section with a red "清空学习记录" button that
shows a confirmation modal with explicit warning before clearing.
Clears stats display immediately after successful reset.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
When user taps '下一节' on the last KP, instead of doing nothing:
- Show a modal "🎉 本章学完了!" with chapter title and KP count
- Offer "返回目录" (navigateBack) or "继续复习" (dismiss, stay on page)
- vibrateShort(medium) for satisfying haptic feedback

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
On first visit to a KP's chat (≤1 message), show horizontally
scrollable chips derived from the KP's learning goals:
e.g. "「上极限」是什么意思?". Tapping a chip fills input and
auto-sends. Chips disappear after first message is sent or cleared.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
A full-width button at the bottom of the lecture content shows
"下一节:[KP title] ›" in accent red. On the last KP it shows
"✓ 本章已学完" in green and triggers the chapter completion modal.

This gives users an obvious flow through the course without needing
to scroll back up to the nav bar.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
study-bench Ready Ready Preview, Comment Jun 20, 2026 5:53am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant