Skip to content

feat: add question bank reference for course generation#44

Open
YizukiAme wants to merge 2 commits intoTHU-MAIC:mainfrom
YizukiAme:feat/question-bank-reference
Open

feat: add question bank reference for course generation#44
YizukiAme wants to merge 2 commits intoTHU-MAIC:mainfrom
YizukiAme:feat/question-bank-reference

Conversation

@YizukiAme
Copy link

Summary

Adds a Question Bank Reference feature to the generation toolbar, allowing users to upload or paste reference questions that the AI uses when generating quiz scenes. Closes #43.

What it does

  • 📖 Question Bank pill button in the toolbar with a popover UI containing:
    • Textarea for pasting reference questions
    • File import button (.txt / .md)
    • Clear button and character count indicator
    • Active state pill when content is loaded
  • Prompt injection: Question bank text flows through the full pipeline:
    FormStatesessionStoragegeneration-previewscene-outlines-stream API → prompt template
  • AI behavior: When a question bank is provided, the AI can either:
    • Draw original questions directly from the bank
    • Generate new questions following the same style, format, and difficulty

Files changed (7)

File Change
lib/i18n/common.ts 7 new i18n keys (zh-CN + en-US)
app/generation-preview/types.ts questionBankContext field in session state
lib/generation/prompts/templates/.../user.md ### Question Bank Reference section + instruction #9
app/api/generate/scene-outlines-stream/route.ts Accept & pass questionBankContext to prompt
app/generation-preview/page.tsx Pass questionBankContext to API
app/page.tsx questionBankText in FormState + session
components/generation/generation-toolbar.tsx Question Bank popover UI

Testing

  • pnpm build passes
  • ✅ Tested with a full exam paper → AI generates questions in similar style
  • ✅ Tested with a single question → AI directly references the original question
  • ✅ File import (.txt/.md) and paste both work
  • ✅ Clear button and active state indicator work correctly

- Add Question Bank pill button with popover in generation toolbar

- Support pasting reference questions or importing .txt/.md files

- Inject question bank context into outline generation prompt

- AI can draw original questions or generate new ones in the same style

- Add i18n keys for zh-CN and en-US

- Wire up full data flow: FormState -> session -> API -> prompt template
@YizukiAme YizukiAme force-pushed the feat/question-bank-reference branch from 94520e0 to 194bfce Compare March 16, 2026 20:35
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.

feat: Question Bank Reference for course generation

2 participants