Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

"DeepTutor: AI-Powered Personalized Learning Assistant"

License

NotificationsYou must be signed in to change notification settings

ppamoy/edu_agent

 
 

Repository files navigation

📚Massive Document Knowledge Q&A  •  🎨Interactive Learning Visualization
🎯Knowledge Reinforcement  •  🔍Deep Research & Idea Generation


📰 News

[2026.1.15] DeepTutorv0.5.0 is out! Fixed multiple environment configuration and stability issues. We recommend everyone to pull the latest version! 🎉

[2026.1.1] Happy New Year! Join ourDiscord Community,Wechat Community, orDiscussions - shape the future of DeepTutor! 💬

[2025.12.30] Visit ourOfficial Website for more details!

[2025.12.29] DeepTutor is now live! ✨

📦 Releases

[2026.1.15] Releasev0.5.0 - Unified LLM & Embedding services, RAG pipeline selection, and major enhancements to Home, History, QuestionGen & Settings modules -- Thanks to all the contributors!

History releases

[2026.1.9] Releasev0.4.1 with LLM Provider system overhaul, Question Generation robustness improvements, and codebase cleanup - Thanks to all the contributors!

[2026.1.9] Releasev0.4.0 with new code structure, multiple llm & embeddings support - Thanks to all the contributors!

[2026.1.5]v0.3.0 - Unified PromptManager architecture, CI/CD automation & pre-built Docker images on GHCR

[2026.1.2]v0.2.0 - Docker deployment, Next.js 16 & React 19 upgrade, WebSocket security & critical vulnerability fixes


Key Features of DeepTutor

📚 Massive Document Knowledge Q&A

Smart Knowledge Base: Upload textbooks, research papers, technical manuals, and domain-specific documents. Build a comprehensive AI-powered knowledge repository for instant access.
Multi-Agent Problem Solving: Dual-loop reasoning architecture with RAG, web search, and code execution -- delivering step-by-step solutions with precise citations.

🎨 Interactive Learning Visualization

Knowledge Simplification & Explanations: Transform complex concepts, knowledge, and algorithms into easy-to-understand visual aids, detailed step-by-step breakdowns, and engaging interactive demonstrations.
Personalized Q&A: Context-aware conversations that adapt to your learning progress, with interactive pages and session-based knowledge tracking.

🎯 Knowledge Reinforcement with Practice Exercise Generator

Intelligent Exercise Creation: Generate targeted quizzes, practice problems, and customized assessments tailored to your current knowledge level and specific learning objectives.
Authentic Exam Simulation: Upload reference exams to generate practice questions that perfectly match the original style, format, and difficulty—giving you realistic preparation for the actual test.

🔍 Deep Research & Idea Generation

Comprehensive Research & Literature Review: Conduct in-depth topic exploration with systematic analysis. Identify patterns, connect related concepts across disciplines, and synthesize existing research findings.
Novel Insight Discovery: Generate structured learning materials and uncover knowledge gaps. Identify promising new research directions through intelligent cross-domain knowledge synthesis.


All-in-One Tutoring System

📚 Massive Document Knowledge Q&A


Multi-agent Problem Solving with Exact Citations

🎨 Interactive Learning Visualization


Step-by-step Visual Explanations with Personal QAs.

🎯 Knowledge Reinforcement

Custom Questions
Auto-Validated Practice Questions Generation

Mimic Questions
Clone Exam Style for Authentic Practice

🔍 Deep Research & Idea Generation

Deep Research
Knowledge Extension from Textbook with RAG, Web and Paper-search

Automated IdeaGen
Brainstorming and Concept Synthesis with Dual-filter Workflow

Interactive IdeaGen
RAG and Web-search Powered Co-writer with Podcast Generation

🏗️ All-in-One Knowledge System

Personal Knowledge Base
Build and Organize Your Own Knowledge Repository

Personal Notebook
Your Contextual Memory for Learning Sessions

🌙 Use DeepTutor inDark Mode!


🏛️ DeepTutor's Framework

DeepTutor Full-Stack Workflow

💬 User Interface Layer

Intuitive Interaction: Simple bidirectional query-response flow for intuitive interaction.
Structured Output: Structured response generation that organizes complex information into actionable outputs.

🤖 Intelligent Agent Modules

Problem Solving & Assessment: Step-by-step problem solving and custom assessment generation.
Research & Learning: Deep Research for topic exploration and Guided Learning with visualization.
Idea Generation: Automated and interactive concept development with multi-source insights.

🔧 Tool Integration Layer

Information Retrieval: RAG hybrid retrieval, real-time web search, and academic paper databases.
Processing & Analysis: Python code execution, query item lookup, and PDF parsing for document analysis.

🧠 Knowledge & Memory Foundation

Knowledge Graph: Entity-relation mapping for semantic connections and knowledge discovery.
Vector Store: Embedding-based semantic search for intelligent content retrieval.
Memory System: Session state management and citation tracking for contextual continuity.

📋 Todo

🌟 Star to follow our future updates!

  • [ x ] Multi-linguistic support
  • [ x ] DeepTutor Community
  • [ x ] Video & Audio file support
  • [ x ] Atomic RAG pipeline customize
  • [ - ] Incremental Knowledge-base Edit
  • [ - ] Personalized Workspace
  • [ - ] DataBase Visualization
  • [ - ] Online Demo

🚀 Getting Started

Step 1: Pre-Configuration

① Clone Repository

git clone https://github.com/HKUDS/DeepTutor.gitcd DeepTutor

② Set Up Environment Variables

cp .env.example .env# Edit .env file with your API keys
📋Environment Variables Reference
VariableRequiredDescription
LLM_MODELYesModel name (e.g.,gpt-4o)
LLM_API_VERSIONNoAPI version for Azure OpenAI (e.g.,2024-02-15-preview)
LLM_API_KEYYesYour LLM API key
LLM_HOSTYesAPI endpoint URL
EMBEDDING_MODELYesEmbedding model name
EMBEDDING_API_VERSIONNoAPI version for Azure OpenAI Embeddings
EMBEDDING_API_KEYYesEmbedding API key
EMBEDDING_HOSTYesEmbedding API endpoint
BACKEND_PORTNoBackend port (default:8001)
FRONTEND_PORTNoFrontend port (default:3782)
NEXT_PUBLIC_API_BASENoFrontend API URL - Set this for remote/LAN access (e.g.,http://192.168.1.100:8001)
TTS_*NoText-to-Speech settings
SEARCH_PROVIDERNoSearch provider (options:perplexity,tavily,serper,jina,exa,baidu, default:perplexity)
SEARCH_API_KEYNoUnified API key for all search providers

💡Remote Access: If accessing from another device (e.g.,192.168.31.66:3782), add to.env:

NEXT_PUBLIC_API_BASE=http://192.168.31.66:8001

③ Configure Ports & LLM(Optional)

  • Ports: Set in.env file →BACKEND_PORT /FRONTEND_PORT (defaults: 8001/3782)
  • LLM: Editconfig/agents.yamltemperature /max_tokens per module
  • SeeConfiguration Docs for details

④ Try Demo Knowledge Bases(Optional)

📚Available Demos
  1. Download fromGoogle Drive
  2. Extract intodata/ directory

Demo KBs usetext-embedding-3-large withdimensions = 3072

⑤ Create Your Own Knowledge Base(After Launch)

  1. Go tohttp://localhost:3782/knowledge
  2. Click "New Knowledge Base" → Enter name → Upload PDF/TXT/MD files
  3. Monitor progress in terminal

Step 2: Choose Your Installation Method

🐳 Option A: Docker Deployment

No Python/Node.js setup required

Prerequisites:Docker &Docker Compose

Quick Start — Build from source:

docker compose up --build -d# Build and start (~5-10 min first run)docker compose logs -f# View logs

Or use pre-built image (faster):

# Linux/macOS (AMD64)docker run -d --name deeptutor \  -p 8001:8001 -p 3782:3782 \  --env-file .env \  -v$(pwd)/data:/app/data \  -v$(pwd)/config:/app/config:ro \  ghcr.io/hkuds/deeptutor:latest# Apple Silicon (ARM64): use ghcr.io/hkuds/deeptutor:latest-arm64# Windows PowerShell: use ${PWD} instead of $(pwd)

Common Commands:

docker compose up -d# Startdocker compose down# Stopdocker compose logs -f# View logsdocker compose up --build# Rebuild after changes
📋More Docker Options (Pre-built images, Cloud deployment, Custom ports)

Pre-built Image Architecture Reference:

ArchitectureImage TagUse Case
AMD64ghcr.io/hkuds/deeptutor:latestIntel/AMD (most servers, Windows/Linux PCs)
ARM64ghcr.io/hkuds/deeptutor:latest-arm64Apple Silicon, AWS Graviton, Raspberry Pi

💡 Rununame -m to check:x86_64 = AMD64,arm64/aarch64 = ARM64

Cloud Deployment — Must set external API URL:

docker run -d --name deeptutor \  -p 8001:8001 -p 3782:3782 \  -e NEXT_PUBLIC_API_BASE_EXTERNAL=https://your-server.com:8001 \  --env-file .env \  -v$(pwd)/data:/app/data \  ghcr.io/hkuds/deeptutor:latest

Custom Ports Example:

docker run -d --name deeptutor \  -p 9001:9001 -p 3000:3000 \  -e BACKEND_PORT=9001 \  -e FRONTEND_PORT=3000 \  -e NEXT_PUBLIC_API_BASE_EXTERNAL=https://your-server.com:9001 \  --env-file .env \  -v$(pwd)/data:/app/data \  ghcr.io/hkuds/deeptutor:latest

💻 Option B: Manual Installation

For development or non-Docker environments

Prerequisites: Python 3.10+, Node.js 18+

1. Set Up Environment:

# Using conda (Recommended)conda create -n deeptutor python=3.10&& conda activate deeptutor# Or using venvpython -m venv venv&&source venv/bin/activate# Windows: venv\Scripts\activate

2. Install Dependencies:

# One-click installation (Recommended)python scripts/install_all.py# Or: bash scripts/install_all.sh# Or manual installationpip install -r requirements.txtnpm install --prefix web

3. Launch:

python scripts/start_web.py# Start frontend + backend# Or: python scripts/start.py  # CLI only# Stop: Ctrl+C
🔧Start Frontend & Backend Separately

Backend (FastAPI):

python src/api/run_server.py# Or: uvicorn src.api.main:app --host 0.0.0.0 --port 8001 --reload

Frontend (Next.js):

cd web&& npm install&& npm run dev -- -p 3782

Note: Createweb/.env.local:

NEXT_PUBLIC_API_BASE=http://localhost:8001
ServiceDefault Port
Backend8001
Frontend3782

Access URLs

ServiceURLDescription
Frontendhttp://localhost:3782Main web interface
API Docshttp://localhost:8001/docsInteractive API documentation

📂 Data Storage

All user content and system data are stored in thedata/ directory:

data/├── knowledge_bases/              # Knowledge base storage└── user/                         # User activity data    ├── solve/                    # Problem solving results and artifacts    ├── question/                 # Generated questions    ├── research/                 # Research reports and cache    ├── co-writer/                # Interactive IdeaGen documents and audio files    ├── notebook/                 # Notebook records and metadata    ├── guide/                    # Guided learning sessions    ├── logs/                     # System logs    └── run_code_workspace/       # Code execution workspace

Results are automatically saved during all activities. Directories are created automatically as needed.

📦 Core Modules

🧠 Smart Solver
Architecture Diagram

Smart Solver Architecture

Intelligent problem-solving system based onAnalysis Loop + Solve Loop dual-loop architecture, supporting multi-mode reasoning and dynamic knowledge retrieval.

Core Features

FeatureDescription
Dual-Loop ArchitectureAnalysis Loop: InvestigateAgent → NoteAgent
Solve Loop: PlanAgent → ManagerAgent → SolveAgent → CheckAgent → Format
Multi-Agent CollaborationSpecialized agents: InvestigateAgent, NoteAgent, PlanAgent, ManagerAgent, SolveAgent, CheckAgent
Real-time StreamingWebSocket transmission with live reasoning process display
Tool IntegrationRAG (naive/hybrid), Web Search, Query Item, Code Execution
Persistent MemoryJSON-based memory files for context preservation
Citation ManagementStructured citations with reference tracking

Usage

  1. Visithttp://localhost:{frontend_port}/solver
  2. Select a knowledge base
  3. Enter your question, click "Solve"
  4. Watch the real-time reasoning process and final answer
Python API
importasynciofromsrc.agents.solveimportMainSolverasyncdefmain():solver=MainSolver(kb_name="ai_textbook")result=awaitsolver.solve(question="Calculate the linear convolution of x=[1,2,3] and h=[4,5]",mode="auto"    )print(result['formatted_solution'])asyncio.run(main())
Output Location
data/user/solve/solve_YYYYMMDD_HHMMSS/├── investigate_memory.json    # Analysis Loop memory├── solve_chain.json           # Solve Loop steps & tool records├── citation_memory.json       # Citation management├── final_answer.md            # Final solution (Markdown)├── performance_report.json    # Performance monitoring└── artifacts/                 # Code execution outputs

📝 Question Generator
Architecture Diagram

Question Generator Architecture

Dual-mode question generation system supportingcustom knowledge-based generation andreference exam paper mimicking with automatic validation.

Core Features

FeatureDescription
Custom ModeBackground KnowledgeQuestion PlanningGenerationSingle-Pass Validation
Analyzes question relevance without rejection logic
Mimic ModePDF UploadMinerU ParsingQuestion ExtractionStyle Mimicking
Generates questions based on reference exam structure
ReAct EngineQuestionGenerationAgent with autonomous decision-making (think → act → observe)
Validation AnalysisSingle-pass relevance analysis withkb_coverage andextension_points
Question TypesMultiple choice, fill-in-the-blank, calculation, written response, etc.
Batch GenerationParallel processing with progress tracking
Complete PersistenceAll intermediate files saved (background knowledge, plan, individual results)
Timestamped OutputMimic mode creates batch folders:mimic_YYYYMMDD_HHMMSS_{pdf_name}/

Usage

Custom Mode:

  1. Visithttp://localhost:{frontend_port}/question
  2. Fill in requirements (topic, difficulty, question type, count)
  3. Click "Generate Questions"
  4. View generated questions with validation reports

Mimic Mode:

  1. Visithttp://localhost:{frontend_port}/question
  2. Switch to "Mimic Exam" tab
  3. Upload PDF or provide parsed exam directory
  4. Wait for parsing → extraction → generation
  5. View generated questions alongside original references
Python API

Custom Mode - Full Pipeline:

importasynciofromsrc.agents.questionimportAgentCoordinatorasyncdefmain():coordinator=AgentCoordinator(kb_name="ai_textbook",output_dir="data/user/question"    )# Generate multiple questions from text requirementresult=awaitcoordinator.generate_questions_custom(requirement_text="Generate 3 medium-difficulty questions about deep learning basics",difficulty="medium",question_type="choice",count=3    )print(f"✅ Generated{result['completed']}/{result['requested']} questions")forqinresult['results']:print(f"- Relevance:{q['validation']['relevance']}")asyncio.run(main())

Mimic Mode - PDF Upload:

fromsrc.agents.question.tools.exam_mimicimportmimic_exam_questionsresult=awaitmimic_exam_questions(pdf_path="exams/midterm.pdf",kb_name="calculus",output_dir="data/user/question/mimic_papers",max_questions=5)print(f"✅ Generated{result['successful_generations']} questions")print(f"Output:{result['output_file']}")
Output Location

Custom Mode:

data/user/question/custom_YYYYMMDD_HHMMSS/├── background_knowledge.json      # RAG retrieval results├── question_plan.json              # Question planning├── question_1_result.json          # Individual question results├── question_2_result.json└── ...

Mimic Mode:

data/user/question/mimic_papers/└── mimic_YYYYMMDD_HHMMSS_{pdf_name}/    ├── {pdf_name}.pdf                              # Original PDF    ├── auto/{pdf_name}.md                          # MinerU parsed markdown    ├── {pdf_name}_YYYYMMDD_HHMMSS_questions.json  # Extracted questions    └── {pdf_name}_YYYYMMDD_HHMMSS_generated_questions.json  # Generated questions

🎓 Guided Learning
Architecture Diagram

Guided Learning Architecture

Personalized learning system based on notebook content, automatically generating progressive learning paths through interactive pages and smart Q&A.

Core Features

FeatureDescription
Multi-Agent ArchitectureLocateAgent: Identifies 3-5 progressive knowledge points
InteractiveAgent: Converts to visual HTML pages
ChatAgent: Provides contextual Q&A
SummaryAgent: Generates learning summaries
Smart Knowledge LocationAutomatic analysis of notebook content
Interactive PagesHTML page generation with bug fixing
Smart Q&AContext-aware answers with explanations
Progress TrackingReal-time status with session persistence
Cross-Notebook SupportSelect records from multiple notebooks

Usage Flow

  1. Select Notebook(s) — Choose one or multiple notebooks (cross-notebook selection supported)
  2. Generate Learning Plan — LocateAgent identifies 3-5 core knowledge points
  3. Start Learning — InteractiveAgent generates HTML visualization
  4. Learning Interaction — Ask questions, click "Next" to proceed
  5. Complete Learning — SummaryAgent generates learning summary
Output Location
data/user/guide/└── session_{session_id}.json    # Complete session state, knowledge points, chat history

✏️ Interactive IdeaGen (Co-Writer)
Architecture Diagram

Interactive IdeaGen Architecture

Intelligent Markdown editor supporting AI-assisted writing, auto-annotation, and TTS narration.

Core Features

FeatureDescription
Rich Text EditingFull Markdown syntax support with live preview
EditAgentRewrite: Custom instructions with optional RAG/web context
Shorten: Compress while preserving key information
Expand: Add details and context
Auto-AnnotationAutomatic key content identification and marking
NarratorAgentScript generation, TTS audio, multiple voices (Cherry, Stella, Annie, Cally, Eva, Bella)
Context EnhancementOptional RAG or web search for additional context
Multi-Format ExportMarkdown, PDF, etc.

Usage

  1. Visithttp://localhost:{frontend_port}/co_writer
  2. Enter or paste text in the editor
  3. Use AI features: Rewrite, Shorten, Expand, Auto Mark, Narrate
  4. Export to Markdown or PDF
Output Location
data/user/co-writer/├── audio/                    # TTS audio files│   └── {operation_id}.mp3├── tool_calls/               # Tool call history│   └── {operation_id}_{tool_type}.json└── history.json              # Edit history

🔬 Deep Research
Architecture Diagram

Deep Research Architecture

DR-in-KG (Deep Research in Knowledge Graph) — A systematic deep research system based onDynamic Topic Queue architecture, enabling multi-agent collaboration across three phases:Planning → Researching → Reporting.

Core Features

FeatureDescription
Three-Phase ArchitecturePhase 1 (Planning): RephraseAgent (topic optimization) + DecomposeAgent (subtopic decomposition)
Phase 2 (Researching): ManagerAgent (queue scheduling) + ResearchAgent (research decisions) + NoteAgent (info compression)
Phase 3 (Reporting): Deduplication → Three-level outline generation → Report writing with citations
Dynamic Topic QueueCore scheduling system with TopicBlock state management:PENDING → RESEARCHING → COMPLETED/FAILED. Supports dynamic topic discovery during research
Execution ModesSeries Mode: Sequential topic processing
Parallel Mode: Concurrent multi-topic processing withAsyncCitationManagerWrapper for thread-safe operations
Multi-Tool IntegrationRAG (hybrid/naive),Query Item (entity lookup),Paper Search,Web Search,Code Execution — dynamically selected by ResearchAgent
Unified Citation SystemCentralized CitationManager as single source of truth for citation ID generation, ref_number mapping, and deduplication
Preset Configurationsquick: Fast research (1-2 subtopics, 1-2 iterations)
medium/standard: Balanced depth (5 subtopics, 4 iterations)
deep: Thorough research (8 subtopics, 7 iterations)
auto: Agent autonomously decides depth

Citation System Architecture

The citation system follows a centralized design with CitationManager as the single source of truth:

┌─────────────────────────────────────────────────────────────────┐│                      CitationManager                            ││  ┌─────────────────┐  ┌─────────────────┐  ┌─────────────────┐  ││  │  ID Generation  │  │  ref_number Map │  │   Deduplication │  ││  │  PLAN-XX        │  │  citation_id →  │  │   (papers only) │  ││  │  CIT-X-XX       │  │  ref_number     │  │                 │  ││  └────────┬────────┘  └────────┬────────┘  └────────┬────────┘  │└───────────┼────────────────────┼────────────────────┼───────────┘            │                    │                    │     ┌──────┴──────┐      ┌──────┴──────┐      ┌──────┴──────┐     │DecomposeAgent│      │ReportingAgent│      │ References │     │ ResearchAgent│      │ (inline [N]) │      │  Section   │     │  NoteAgent   │      └─────────────┘      └────────────┘     └─────────────┘
ComponentDescription
ID FormatPLAN-XX (planning stage RAG queries) +CIT-X-XX (research stage, X=block number)
ref_number MappingSequential 1-based numbers built from sorted citation IDs, with paper deduplication
Inline CitationsSimple[N] format in LLM output, post-processed to clickable[[N]](#ref-N) links
Citation TableClear reference table provided to LLM:Cite as [1] → (RAG) query preview...
Post-processingAutomatic format conversion + validation to remove invalid citation references
Parallel SafetyThread-safe async methods (get_next_citation_id_async,add_citation_async) for concurrent execution

Parallel Execution Architecture

Whenexecution_mode: "parallel" is enabled, multiple topic blocks are researched concurrently:

┌─────────────────────────────────────────────────────────────────────────┐│                    Parallel Research Execution                          │├─────────────────────────────────────────────────────────────────────────┤│                                                                         ││   DynamicTopicQueue                    AsyncCitationManagerWrapper      ││   ┌─────────────────┐                  ┌─────────────────────────┐      ││   │ Topic 1 (PENDING)│ ──┐             │  Thread-safe wrapper    │      ││   │ Topic 2 (PENDING)│ ──┼──→ asyncio  │  for CitationManager    │      ││   │ Topic 3 (PENDING)│ ──┤   Semaphore │                         │      ││   │ Topic 4 (PENDING)│ ──┤   (max=5)   │  • get_next_citation_   │      ││   │ Topic 5 (PENDING)│ ──┘             │    id_async()           │      ││   └─────────────────┘                  │  • add_citation_async() │      ││            │                           └───────────┬─────────────┘      ││            ▼                                       │                    ││   ┌─────────────────────────────────────────────────────────────┐      ││   │              Concurrent ResearchAgent Tasks                  │      ││   │  ┌─────────┐  ┌─────────┐  ┌─────────┐  ┌─────────┐        │      ││   │  │ Task 1  │  │ Task 2  │  │ Task 3  │  │ Task 4  │  ...   │      ││   │  │(Topic 1)│  │(Topic 2)│  │(Topic 3)│  │(Topic 4)│        │      ││   │  └────┬────┘  └────┬────┘  └────┬────┘  └────┬────┘        │      ││   │       │            │            │            │              │      ││   │       └────────────┴────────────┴────────────┘              │      ││   │                         │                                    │      ││   │                         ▼                                    │      ││   │              AsyncManagerAgentWrapper                        │      ││   │              (Thread-safe queue updates)                     │      ││   └─────────────────────────────────────────────────────────────┘      ││                                                                         │└─────────────────────────────────────────────────────────────────────────┘
ComponentDescription
asyncio.SemaphoreLimits concurrent tasks tomax_parallel_topics (default: 5)
AsyncCitationManagerWrapperWraps CitationManager withasyncio.Lock() for thread-safe ID generation
AsyncManagerAgentWrapperEnsures queue state updates are atomic across parallel tasks
Real-time ProgressLive display of all active research tasks with status indicators

Agent Responsibilities

AgentPhaseResponsibility
RephraseAgentPlanningOptimizes user input topic, supports multi-turn user interaction for refinement
DecomposeAgentPlanningDecomposes topic into subtopics with RAG context, obtains citation IDs from CitationManager
ManagerAgentResearchingQueue state management, task scheduling, dynamic topic addition
ResearchAgentResearchingKnowledge sufficiency check, query planning, tool selection, requests citation IDs before each tool call
NoteAgentResearchingCompresses raw tool outputs into summaries, creates ToolTraces with pre-assigned citation IDs
ReportingAgentReportingBuilds citation map, generates three-level outline, writes report sections with citation tables, post-processes citations

Report Generation Pipeline

1. Build Citation Map     →  CitationManager.build_ref_number_map()2. Generate Outline       →  Three-level headings (H1 → H2 → H3)3. Write Sections         →  LLM uses [N] citations with provided citation table4. Post-process           →  Convert [N] → [[N]](#ref-N), validate references5. Generate References    →  Academic-style entries with collapsible source details

Usage

  1. Visithttp://localhost:{frontend_port}/research
  2. Enter research topic
  3. Select research mode (quick/medium/deep/auto)
  4. Watch real-time progress with parallel/series execution
  5. View structured report with clickable inline citations
  6. Export as Markdown or PDF (with proper page splitting and Mermaid diagram support)
CLI
# Quick mode (fast research)python src/agents/research/main.py --topic"Deep Learning Basics" --preset quick# Medium mode (balanced)python src/agents/research/main.py --topic"Transformer Architecture" --preset medium# Deep mode (thorough research)python src/agents/research/main.py --topic"Graph Neural Networks" --preset deep# Auto mode (agent decides depth)python src/agents/research/main.py --topic"Reinforcement Learning" --preset auto
Python API
importasynciofromsrc.agents.researchimportResearchPipelinefromsrc.core.coreimportget_llm_config,load_config_with_mainasyncdefmain():# Load configuration (main.yaml merged with any module-specific overrides)config=load_config_with_main("research_config.yaml")llm_config=get_llm_config()# Create pipeline (agent parameters loaded from agents.yaml automatically)pipeline=ResearchPipeline(config=config,api_key=llm_config["api_key"],base_url=llm_config["base_url"],kb_name="ai_textbook"# Optional: override knowledge base    )# Run researchresult=awaitpipeline.run(topic="Attention Mechanisms in Deep Learning")print(f"Report saved to:{result['final_report_path']}")asyncio.run(main())
Output Location
data/user/research/├── reports/                          # Final research reports│   ├── research_YYYYMMDD_HHMMSS.md   # Markdown report with clickable citations [[N]](#ref-N)│   └── research_*_metadata.json      # Research metadata and statistics└── cache/                            # Research process cache    └── research_YYYYMMDD_HHMMSS/        ├── queue.json                # DynamicTopicQueue state (TopicBlocks + ToolTraces)        ├── citations.json            # Citation registry with ID counters and ref_number mapping        │                             #   - citations: {citation_id: citation_info}        │                             #   - counters: {plan_counter, block_counters}        ├── step1_planning.json       # Planning phase results (subtopics + PLAN-XX citations)        ├── planning_progress.json    # Planning progress events        ├── researching_progress.json # Researching progress events        ├── reporting_progress.json   # Reporting progress events        ├── outline.json              # Three-level report outline structure        └── token_cost_summary.json   # Token usage statistics

Citation File Structure (citations.json):

{"research_id":"research_20241209_120000","citations": {"PLAN-01": {"citation_id":"PLAN-01","tool_type":"rag_hybrid","query":"...","summary":"..."},"CIT-1-01": {"citation_id":"CIT-1-01","tool_type":"paper_search","papers": [...],...}  },"counters": {"plan_counter":2,"block_counters": {"1":3,"2":2}  }}
Configuration Options

Key configuration inconfig/main.yaml (research section) andconfig/agents.yaml:

# config/agents.yaml - Agent LLM parametersresearch:temperature:0.5max_tokens:12000# config/main.yaml - Research settingsresearch:# Execution Moderesearching:execution_mode:"parallel"# "series" or "parallel"max_parallel_topics:5# Max concurrent topicsmax_iterations:5# Max iterations per topic# Tool Switchesenable_rag_hybrid:true# Hybrid RAG retrievalenable_rag_naive:true# Basic RAG retrievalenable_paper_search:true# Academic paper searchenable_web_search:true# Web search (also controlled by tools.web_search.enabled)enable_run_code:true# Code execution# Queue Limitsqueue:max_length:5# Maximum topics in queue# Reportingreporting:enable_inline_citations:true# Enable clickable [N] citations in report# Presets: quick, medium, deep, auto# Global tool switches in tools sectiontools:web_search:enabled:true# Global web search switch (higher priority)

💡 Automated IdeaGen
Architecture Diagram

Automated IdeaGen Architecture

Research idea generation system that extracts knowledge points from notebook records and generates research ideas through multi-stage filtering.

Core Features

FeatureDescription
MaterialOrganizerAgentExtracts knowledge points from notebook records
Multi-Stage FilteringLoose FilterExplore Ideas (5+ per point) →Strict FilterGenerate Markdown
Idea ExplorationInnovative thinking from multiple dimensions
Structured OutputOrganized markdown with knowledge points and ideas
Progress CallbacksReal-time updates for each stage

Usage

  1. Visithttp://localhost:{frontend_port}/ideagen
  2. Select a notebook with records
  3. Optionally provide user thoughts/preferences
  4. Click "Generate Ideas"
  5. View generated research ideas organized by knowledge points
Python API
importasynciofromsrc.agents.ideagenimportIdeaGenerationWorkflow,MaterialOrganizerAgentfromsrc.core.coreimportget_llm_configasyncdefmain():llm_config=get_llm_config()# Step 1: Extract knowledge points from materialsorganizer=MaterialOrganizerAgent(api_key=llm_config["api_key"],base_url=llm_config["base_url"]    )knowledge_points=awaitorganizer.extract_knowledge_points("Your learning materials or notebook content here"    )# Step 2: Generate research ideasworkflow=IdeaGenerationWorkflow(api_key=llm_config["api_key"],base_url=llm_config["base_url"]    )result=awaitworkflow.process(knowledge_points)print(result)# Markdown formatted research ideasasyncio.run(main())

📊 Dashboard + Knowledge Base Management

Unified system entry providing activity tracking, knowledge base management, and system status monitoring.

Key Features

FeatureDescription
Activity StatisticsRecent solving/generation/research records
Knowledge Base OverviewKB list, statistics, incremental updates
Notebook StatisticsNotebook counts, record distribution
Quick ActionsOne-click access to all modules

Usage

  • Web Interface: Visithttp://localhost:{frontend_port} to view system overview
  • Create KB: Click "New Knowledge Base", upload PDF/Markdown documents
  • View Activity: Check recent learning activities on Dashboard

📓 Notebook

Unified learning record management, connecting outputs from all modules to create a personalized learning knowledge base.

Core Features

FeatureDescription
Multi-Notebook ManagementCreate, edit, delete notebooks
Unified Record StorageIntegrate solving/generation/research/Interactive IdeaGen records
Categorization TagsAuto-categorize by type, knowledge base
Custom AppearanceColor, icon personalization

Usage

  1. Visithttp://localhost:{frontend_port}/notebook
  2. Create new notebook (set name, description, color, icon)
  3. After completing tasks in other modules, click "Add to Notebook"
  4. View and manage all records on the notebook page

📖 Module Documentation

ConfigurationData DirectoryAPI BackendCore Utilities
Knowledge BaseToolsWeb FrontendSolve Module
Question ModuleResearch ModuleInteractive IdeaGen ModuleGuide Module
Automated IdeaGen Module

❓ FAQ

Backend fails to start?

Checklist

  • Confirm Python version >= 3.10
  • Confirm all dependencies installed:pip install -r requirements.txt
  • Check if port 8001 is in use
  • Check.env file configuration

Solutions

  • Change port: SetBACKEND_PORT=9001 in.env file
  • Check logs: Review terminal error messages
Port occupied after Ctrl+C?

Problem

After pressing Ctrl+C during a running task (e.g., deep research), restarting shows "port already in use" error.

Cause

Ctrl+C sometimes only terminates the frontend process while the backend continues running in the background.

Solution

# macOS/Linux: Find and kill the processlsof -i :8001kill -9<PID># Windows: Find and kill the processnetstat -ano| findstr :8001taskkill /PID<PID> /F

Then restart the service withpython scripts/start_web.py.

npm: command not found error?

Problem

Runningscripts/start_web.py showsnpm: command not found or exit status 127.

Checklist

  • Check if npm is installed:npm --version
  • Check if Node.js is installed:node --version
  • Confirm conda environment is activated (if using conda)

Solutions

# Option A: Using Conda (Recommended)conda install -c conda-forge nodejs# Option B: Using Official Installer# Download from https://nodejs.org/# Option C: Using nvmnvm install 18nvm use 18

Verify Installation

node --version# Should show v18.x.x or highernpm --version# Should show version number
Long path names on Windows installation?

Problem

On Windows, you may encounter errors related to long file paths during installation, such as "The filename or extension is too long" or similar path length issues.

Cause

Windows has a default limitation on path lengths (260 characters), which can be exceeded by DeepTutor's nested directory structures and dependencies.

Solution

Enable long path support system-wide by running the following command in an Administrator Command Prompt:

reg add"HKLM\SYSTEM\CurrentControlSet\Control\FileSystem" /v LongPathsEnabled /t REG_DWORD /d1 /f

After running this command, restart your terminal for the changes to take effect.

Frontend cannot connect to backend?

Checklist

Solution

Create.env.local inweb directory:

NEXT_PUBLIC_API_BASE=http://localhost:8001
Docker: Frontend cannot connect in cloud deployment?

Problem

When deploying to a cloud server, the frontend shows connection errors like "Failed to fetch" or "NEXT_PUBLIC_API_BASE is not configured".

Cause

The default API URL islocalhost:8001, which points to the user's local machine in the browser, not your server.

Solution

Set theNEXT_PUBLIC_API_BASE_EXTERNAL environment variable to your server's public URL:

# Using docker rundocker run -d --name deeptutor \  -e NEXT_PUBLIC_API_BASE_EXTERNAL=https://your-server.com:8001 \  ... other options ...  ghcr.io/hkuds/deeptutor:latest# Or in .env fileNEXT_PUBLIC_API_BASE_EXTERNAL=https://your-server.com:8001

Custom Port Example:

# If using backend port 9001-e BACKEND_PORT=9001 \-e NEXT_PUBLIC_API_BASE_EXTERNAL=https://your-server.com:9001
Docker: How to use custom ports?

Solution

Set both the port environment variables AND the port mappings:

docker run -d --name deeptutor \  -p 9001:9001 -p 4000:4000 \  -e BACKEND_PORT=9001 \  -e FRONTEND_PORT=4000 \  -e NEXT_PUBLIC_API_BASE_EXTERNAL=http://localhost:9001 \  ... other env vars ...  ghcr.io/hkuds/deeptutor:latest

Important: The-p port mapping must match theBACKEND_PORT/FRONTEND_PORT values.

WebSocket connection fails?

Checklist

  • Confirm backend is running
  • Check firewall settings
  • Confirm WebSocket URL is correct

Solution

  • Check backend logs
  • Confirm URL format:ws://localhost:8001/api/v1/...
Settings page shows "Error loading data" with HTTPS reverse proxy?

Problem

When deploying behind an HTTPS reverse proxy (e.g., nginx), the Settings page shows "Error loading data" and browser DevTools reveals that HTTPS requests are being redirected to HTTP (307 redirect).

Cause

This issue has been fixed in v0.5.0+. If you're using an older version, the problem was caused by FastAPI's automatic trailing slash redirects generating HTTP URLs instead of preserving the original HTTPS protocol.

Solution (for v0.5.0+)

Update to the latest version. The fix disables automatic slash redirects to prevent protocol downgrade.

Recommended nginx Configuration

When using nginx as an HTTPS reverse proxy, use the following configuration:

# Frontendlocation /{proxy_passhttp://localhost:3782;proxy_set_header Host$host;proxy_set_header X-Real-IP$remote_addr;proxy_set_header X-Forwarded-For$proxy_add_x_forwarded_for;proxy_set_header X-Forwarded-Proto$scheme;}# Backend APIlocation /api/{proxy_passhttp://localhost:8001;proxy_set_header Host$host;proxy_set_header X-Real-IP$remote_addr;proxy_set_header X-Forwarded-For$proxy_add_x_forwarded_for;proxy_set_header X-Forwarded-Proto$scheme;  # Important: preserves originalprotocol}# WebSocket supportlocation /api/v1/{proxy_passhttp://localhost:8001;proxy_http_version 1.1;proxy_set_header Upgrade$http_upgrade;proxy_set_header Connection"upgrade";proxy_set_header Host$host;proxy_set_header X-Forwarded-Proto$scheme;}

Environment Variable

Set in.env:

NEXT_PUBLIC_API_BASE=https://your-domain.com:port

See:GitHub Issue #112

Where are module outputs stored?
ModuleOutput Path
Solvedata/user/solve/solve_YYYYMMDD_HHMMSS/
Questiondata/user/question/question_YYYYMMDD_HHMMSS/
Researchdata/user/research/reports/
Interactive IdeaGendata/user/co-writer/
Notebookdata/user/notebook/
Guidedata/user/guide/session_{session_id}.json
Logsdata/user/logs/
How to add a new knowledge base?

Web Interface

  1. Visithttp://localhost:{frontend_port}/knowledge
  2. Click "New Knowledge Base"
  3. Enter knowledge base name
  4. Upload PDF/TXT/MD documents
  5. System will process documents in background

CLI

python -m src.knowledge.start_kb init<kb_name> --docs<pdf_path>
How to incrementally add documents to existing KB?

CLI (Recommended)

python -m src.knowledge.add_documents<kb_name> --docs<new_document.pdf>

Benefits

  • Only processes new documents, saves time and API costs
  • Automatically merges with existing knowledge graph
  • Preserves all existing data
Numbered items extraction failed with uvloop.Loop error?

Problem

When initializing a knowledge base, you may encounter this error:

ValueError: Can't patch loop of type <class 'uvloop.Loop'>

This occurs because Uvicorn usesuvloop event loop by default, which is incompatible withnest_asyncio.

Solution

Use one of the following methods to extract numbered items:

# Option 1: Using the shell script (recommended)./scripts/extract_numbered_items.sh<kb_name># Option 2: Direct Python commandpython src/knowledge/extract_numbered_items.py --kb<kb_name> --base-dir ./data/knowledge_bases

This will extract numbered items (Definitions, Theorems, Equations, etc.) from your knowledge base without reinitializing it.

⭐ Star History

Stargazers   Forkers

Star History Chart

🤝 Contribution

We hope DeepTutor could become a gift for the community. 🎁

Contributors to HKUDS/DeepTutor

🔗 Related Projects

⚡ LightRAG🎨 RAG-Anything💻 DeepCode🔬 AI-Researcher
Simple and Fast RAGMultimodal RAGAI Code AssistantResearch Automation

Data Intelligence Lab @ HKU

⭐ Star us ·🐛 Report a bug ·💬 Discussions


This project is licensed under theAGPL-3.0 License.

✨ Thanks for visitingDeepTutor!

Views

About

"DeepTutor: AI-Powered Personalized Learning Assistant"

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python64.1%
  • TypeScript34.6%
  • Other1.3%

[8]ページ先頭

©2009-2026 Movatter.jp