Skip to content

moming2k/AI-Learner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI Learning Wiki

English | 繁體中文 | 简体中文 | 日本語 | 한국어 | Español

A modern, immersive, and highly interactive learning platform where users can explore knowledge through AI-generated wiki pages and intelligent questioning.

AI Learning Wiki Interface Interactive interface of AI Learning Wiki, showcasing the Cash-Out Refinance topic page

Features

Dynamic Wiki System

  • AI-generated comprehensive wiki pages with rich formatting
  • Intelligent "Related Topics" sidebar for exploring connected concepts
  • Smart linking and progressive knowledge building
  • Context-aware content generation

AI-Powered Interaction

  • Natural language question input on every page
  • Context-aware answers based on current topic and learning path
  • Smart suggestions for related questions
  • Automatic detection of existing vs. new topics to avoid duplication

User Experience

  • Save learning sessions and custom knowledge bases
  • Breadcrumb navigation showing learning path history
  • Bookmarking favorite wiki pages
  • Search across all generated content
  • Responsive design optimized for desktop and tablet
  • Clean, minimal design with elegant gradients and smooth transitions

Knowledge Management

  • Behind-the-scenes mindmap structure organizing the knowledge graph
  • Intelligent content generation guided by knowledge structure
  • Persistent SQLite database storage for all pages and sessions
  • Multi-database support for organizing different learning libraries
  • Export-ready wiki pages

Getting Started

Prerequisites

Installation

  1. Clone the repository and install dependencies:
npm install
  1. Configure your OpenAI API:
    • Copy the sample environment file:
cp .env.sample .env.local
  • Edit .env.local and add your OpenAI API key:
OPENAI_API_KEY=sk-your-openai-api-key-here
  • Optional: Customize the model (default: gpt-5):
OPENAI_MODEL=gpt-4o  # Options: gpt-5, gpt-4o, gpt-4o-mini, gpt-4-turbo-preview, gpt-3.5-turbo
  • Optional: Use a different API endpoint (for Azure OpenAI or other providers):
OPENAI_API_BASE_URL=https://api.openai.com/v1  # default OpenAI endpoint
  1. Run the development server:
npm run dev
  1. Open http://localhost:3000 in your browser

Usage

  1. Start Learning: Enter any topic in the search box to generate a comprehensive wiki page
  2. Ask Questions: Use the question input to dive deeper into any concept
  3. Explore Related Topics: Click on related topics in the sidebar or page content
  4. Bookmark Pages: Save important pages for quick access later
  5. Track Progress: View your learning path in the sidebar breadcrumbs
  6. Search: Find previously generated content using the search function

Technology Stack

  • Frontend: Next.js 16, React 19, TypeScript
  • Styling: Tailwind CSS 4 with custom gradients and animations
  • Icons: Lucide React
  • Markdown: React Markdown for rich content rendering
  • AI: OpenAI API (supports GPT-5, GPT-4o, GPT-4o-mini, and GPT-3.5-turbo)
  • Storage: Server-side SQLite database with better-sqlite3

Architecture

Components

  • TopicSearch: Initial topic entry interface
  • WikiPage: Rich wiki page display with markdown rendering
  • QuestionInput: Prominent question input for every page
  • Sidebar: Navigation, bookmarks, and learning path

Core Systems

  • lib/ai-service.ts: AI-powered wiki generation and question answering
  • lib/storage.ts: Storage API client layer for pages, sessions, bookmarks, and mindmap
  • lib/db.ts: SQLite database layer with better-sqlite3
  • lib/types.ts: TypeScript type definitions
  • app/api/generate/route.ts: API endpoint for AI content generation
  • app/api/pages/route.ts: CRUD endpoint for wiki pages
  • app/api/sessions/route.ts: Learning sessions management
  • app/api/bookmarks/route.ts: Bookmarks management
  • app/api/mindmap/route.ts: Knowledge graph management

Data Flow

  1. User enters topic or question
  2. Check if content already exists in SQLite database via API
  3. If not, generate new content via AI API
  4. Update mindmap structure to maintain knowledge graph
  5. Save to SQLite database via API and update UI
  6. Track in learning session for navigation

Customization

API Configuration

Edit .env.local to customize:

  • Model selection: OPENAI_MODEL (default: gpt-5)
    • Options: gpt-5, gpt-4o, gpt-4o-mini, gpt-4-turbo-preview, gpt-3.5-turbo
    • Note: gpt-5 requires special access from OpenAI
  • API endpoint: OPENAI_API_BASE_URL (for Azure OpenAI or other providers)

Edit app/api/generate/route.ts for advanced settings:

  • Temperature (default: 0.7 for non-GPT-5 models)
  • Max completion tokens (default: 16000)
  • Response format (JSON object)
  • Request timeout (default: 2 minutes)

Styling

  • Modify app/globals.css for global styles
  • Update Tailwind classes in components for visual changes
  • Gradients use blue-indigo-purple palette

Content Generation

Edit prompts in lib/ai-service.ts to customize:

  • Wiki page structure and tone
  • Related topics suggestions
  • Question answering style

Features in Detail

Mindmap Knowledge Structure

  • Invisible graph structure organizing all topics
  • Parent-child relationships between pages
  • Depth tracking for knowledge hierarchy
  • Smart linking based on context

Learning Sessions

  • Automatic session creation on first topic
  • Breadcrumb navigation (last 10 pages)
  • Page count tracking
  • Session persistence in SQLite database
  • Survives browser restarts and page refreshes

Smart Deduplication

  • Exact match detection for topics
  • Similar question detection
  • Reuse existing content when possible
  • Consistent page IDs based on title + timestamp

Development

# Run development server
npm run dev

# Build for production
npm run build

# Start production server
npm start

# Lint code
npm run lint

Browser Support

Modern browsers with:

  • ES6+ JavaScript support
  • CSS Grid and Flexbox
  • Fetch API
  • Recommended: Latest Chrome, Firefox, Safari, or Edge

License

This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0) - see the LICENSE file for details.

The AGPL-3.0 is a free, copyleft license that requires anyone who runs a modified version of this software on a server to make the modified source code available to users.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •