Skip to content

Latest commit

ย 

History

11 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

StudyWise

๐ŸŒ English | ็ฎ€ไฝ“ไธญๆ–‡

AI-powered learning annotation assistant โ€” Chat with AI to generate study content, annotate any text, get instant AI answers, and review with auto-generated summaries and quizzes.

๐Ÿ‡จ๐Ÿ‡ณ ไธญๆ–‡็ฎ€ไป‹๏ผšStudyWise ๆ˜ฏไธ€ๆฌพ AI ๅญฆไน ๆ‰นๆณจๅŠฉๆ‰‹ใ€‚ไธŽ AI ๅฏน่ฏ็”Ÿๆˆๅญฆไน ๅ†…ๅฎน๏ผŒ้€‰ไธญๆ–‡ๅญ—ๆทปๅŠ ็ฌ”่ฎฐ/้—ฎ้ข˜๏ผŒAI ๅณๆ—ถ็ป“ๅˆไธŠไธ‹ๆ–‡่งฃ็ญ”๏ผŒๅญฆๅฎŒ่‡ชๅŠจ็”Ÿๆˆๆ€ป็ป“ไธŽๅคไน ้ข˜๏ผŒๅนถๆ”ฏๆŒๅฏผๅ‡บ็ฆป็บฟ HTMLใ€‚ๆ•ฐๆฎๅ…จ้ƒจๆœฌๅœฐๅญ˜ๅ‚จ๏ผˆSQLite๏ผ‰๏ผŒ่‡ชๅธฆ API Key ๅณๅฏไฝฟ็”จใ€‚ๅฎŒๆ•ดไธญๆ–‡ๆ–‡ๆกฃ่ง README.zh-CN.mdใ€‚

Stars Forks Build License Next.js TypeScript React TailwindCSS SQLite Drizzle ORM Made with

๐Ÿš€ Ready for your next learning session.


๐Ÿ“ธ Screenshots

โš ๏ธ Placeholder โ€” run npm run dev, take screenshots, and drop them into docs/screenshots/. Then update the image paths below.

Main learning interface Annotations & AI replies Summary & review quiz
Main interface Annotations & AI replies Summary & quiz

โœจ Features

  • ๐Ÿ’ฌ AI generates study content โ€” tell AI what you want to learn, and it produces structured HTML learning material in a single conversation.
  • ๐Ÿ“ Select-and-annotate โ€” highlight any text in the content to add a note or ask a question; notes (green) and questions (yellow) are visually distinct.
  • ๐Ÿค– Instant AI replies โ€” AI answers your questions with the surrounding content as context.
  • ๐Ÿ”— Two-way scrolling sync โ€” click a highlight and the annotation panel scrolls to it (and vice versa); scrolling one panel auto-scrolls the other.
  • ๐Ÿ”Ž Multi-turn follow-ups โ€” keep asking follow-up questions on any AI answer; the thread auto-collapses to the first reply.
  • ๐Ÿ“Š AI summary โ€” after learning, AI generates a knowledge summary based on your notes and questions.
  • โ“ Review quizzes โ€” auto-generated fill-in-the-blank / Q&A review questions with interactive answering.
  • ๐Ÿ“ค Export standalone HTML โ€” export content + annotations + summary + quiz into a single offline-readable HTML file.
  • ๐ŸŒ Multiple AI providers โ€” switchable providers (Volcengine DeepSeek / OpenAI-compatible / Claude) in one click.
  • ๐Ÿ’พ Local-first data โ€” everything is stored in local SQLite; your API key stays yours.

๐Ÿš€ Quick Start

Prerequisites

  • Node.js 20+ (CI runs on Node 24; developed and tested on Node 20/24)
  • npm (bundled with Node)
  • An API key from an OpenAI-compatible AI provider (Volcengine Ark recommended)

1. Clone the repo

git clone https://github.com/free1101/studywise.git
cd studywise

2. Install dependencies

npm install

3. Configure environment variables

Copy .env.example to .env.local and fill in your API key:

cp .env.example .env.local
Variable Description How to get
VOLCENGINE_API_KEY Volcengine Ark API key Volcengine Ark console
VOLCENGINE_ENDPOINT API endpoint (pre-filled) Leave as-is
VOLCENGINE_MODEL Model name (pre-filled) Leave as-is
OPENAI_API_KEY OpenAI (or any OpenAI-compatible endpoint) API key OpenAI platform
OPENAI_BASE_URL OpenAI-compatible endpoint URL (pre-filled) Leave as-is
OPENAI_MODEL Model name (pre-filled) Leave as-is
CLAUDE_API_KEY Anthropic Claude API key (ANTHROPIC_API_KEY also works) Anthropic console
CLAUDE_BASE_URL Anthropic OpenAI-compatible endpoint (pre-filled) Leave as-is
CLAUDE_MODEL Claude model name (pre-filled) Leave as-is
DEFAULT_AI_PROVIDER Default provider: volcengine / openai / claude Default volcengine

Three providers, one click โ€” switch via DEFAULT_AI_PROVIDER or the in-app status bar:

  • volcengine โ€” Volcengine Ark (DeepSeek, recommended for CN users)
  • openai โ€” OpenAI official or any OpenAI-compatible endpoint (DeepSeek official, Qwen, Kimi, GLM, Ollama, etc. โ€” just point OPENAI_BASE_URL at it)
  • claude โ€” Anthropic Claude via the official OpenAI-compatible endpoint

4. Start the dev server

npm run dev

Open http://localhost:3000 and start learning.


๐Ÿงฑ Tech Stack

Layer Choice
Framework Next.js 16 (App Router)
Language TypeScript (strict mode)
UI TailwindCSS + shadcn/ui
AI Volcengine DeepSeek (OpenAI-compatible)
Database SQLite + better-sqlite3
ORM Drizzle ORM
Annotation @recogito/react-text-annotator

๐Ÿ“ Project Structure

studywise/
โ”œโ”€โ”€ app/
โ”‚   โ”œโ”€โ”€ page.tsx                    # Main learning UI (three-pane layout)
โ”‚   โ”œโ”€โ”€ layout.tsx                  # Global layout
โ”‚   โ””โ”€โ”€ api/
โ”‚       โ”œโ”€โ”€ chat/route.ts           # AI conversation (streaming)
โ”‚       โ”œโ”€โ”€ contents/route.ts       # Save content
โ”‚       โ”œโ”€โ”€ annotations/            # Annotation CRUD
โ”‚       โ”‚   โ”œโ”€โ”€ route.ts
โ”‚       โ”‚   โ””โ”€โ”€ [id]/route.ts
โ”‚       โ”œโ”€โ”€ ai/
โ”‚       โ”‚   โ”œโ”€โ”€ reply/route.ts      # AI reply to annotation (multi-turn)
โ”‚       โ”‚   โ””โ”€โ”€ summarize/route.ts  # AI summary + review questions
โ”‚       โ”œโ”€โ”€ summaries/route.ts      # Persisted summary retrieval
โ”‚       โ””โ”€โ”€ export/route.ts         # Export standalone HTML
โ”œโ”€โ”€ components/
โ”‚   โ”œโ”€โ”€ ui/                         # shadcn/ui base components
โ”‚   โ”œโ”€โ”€ chat/                       # Chat panel & message
โ”‚   โ”œโ”€โ”€ content/                    # Content viewer + annotation popup
โ”‚   โ”œโ”€โ”€ annotation/                 # Annotation list & detail
โ”‚   โ”œโ”€โ”€ summary/                    # Summary + review quiz
โ”‚   โ”œโ”€โ”€ export/                     # Export dialog
โ”‚   โ””โ”€โ”€ layout/                     # Sidebar, resizable panel, status bar
โ”œโ”€โ”€ hooks/
โ”‚   โ”œโ”€โ”€ useAnnotations.ts           # Annotation CRUD hook
โ”‚   โ””โ”€โ”€ useChat.ts                  # AI chat hook
โ”œโ”€โ”€ lib/
โ”‚   โ”œโ”€โ”€ db.ts                       # Drizzle + SQLite connection
โ”‚   โ”œโ”€โ”€ schema.ts                   # DB schema & types
โ”‚   โ””โ”€โ”€ ai/
โ”‚       โ”œโ”€โ”€ providers.ts            # Unified AI provider interface
โ”‚       โ””โ”€โ”€ volcengine.ts           # Volcengine DeepSeek wrapper
โ”œโ”€โ”€ scripts/                        # Regression test scripts
โ”œโ”€โ”€ docs/screenshots/               # Place screenshots here
โ”œโ”€โ”€ AGENTS.md                       # Dev conventions
โ”œโ”€โ”€ LICENSE
โ””โ”€โ”€ package.json

๐Ÿ”ง How It Works

  1. Conversation โ†’ Content โ€” you chat with AI; when AI produces HTML learning material, the front-end extracts and renders it into the central content viewer.
  2. Annotate โ†’ Reply โ€” selecting text opens a popup to add a note/question; the annotation is stored in SQLite and AI replies with the surrounding content as context. Follow-up questions reuse the same endpoint with the previous reply for multi-turn coherence.
  3. Scroll Sync โ€” highlights and annotation cards share stable IDs; scrolling either panel reports the visible annotation and syncs the other side (with programmatic-scroll guards to prevent loops).
  4. Summarize & Export โ€” on completion, AI summarizes your notes/questions into a summary plus review questions (persisted to DB); the export endpoint merges content, annotations, summary, and quiz into one standalone HTML file.

๐Ÿ“š Docs

  • AGENTS.md โ€” development conventions, coding standards, and the self-check checklist.
  • question.txt โ€” an audit trail of bug reports, root-cause analysis, and fixes across multiple iterations (evidence of quality and rigor).
  • scripts/ โ€” regression tests:
    • node scripts/api-test.mjs โ€” API regression tests across all backend routes (needs the dev server running).
    • node scripts/frontend-logic-test.mjs โ€” dependency-free front-end logic contract tests (HTML extraction).

โ“ FAQ

How do I switch AI providers? Set DEFAULT_AI_PROVIDER in .env.local to volcengine, openai, or claude, configure the matching API key, and (optionally) select the provider from the in-app status bar. Any OpenAI-compatible endpoint works with the openai provider.

Where is my data stored? Locally in a SQLite database file (local.db) at the project root. Nothing leaves your machine except the AI API requests you make.

How do I deploy this? It's a standard Next.js app โ€” build with npm run build, then npm run start (or deploy to Vercel). Just make sure the SQLite file path is writable in your deployment environment and that your API key is set.


๐Ÿค Contributing

Contributions are welcome! Please:

  1. Read AGENTS.md to follow the conventions.
  2. Fork the repo and create a feature branch.
  3. Ensure npm run lint and npm run build pass, and run the regression tests in scripts/.
  4. Open a pull request describing the change.

โญ Support

If you find StudyWise useful, please give it a star โญ โ€” it helps more people discover the project and keeps the motivation going!

GitHub Stars


๐Ÿ“„ License

This project is licensed under the MIT License.


โš ๏ธ Disclaimer

  • Local data only โ€” all learning content, annotations, and summaries are stored locally in SQLite. We never upload your data to any server.
  • Bring your own API key โ€” StudyWise calls AI providers using your API key. You are responsible for the usage and cost of your own key.
  • This is an open-source learning demo project; use at your own discretion.

About

๐Ÿ“š AI ๅญฆไน ๆ‰นๆณจๅŠฉๆ‰‹ | AI-powered learning annotation assistant โ€” read, annotate, get instant AI replies, auto summaries & review quizzes. Next.js + TypeScript + TailwindCSS + Drizzle, MIT.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages