Skip to content

DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.

fix: lint

Pancake0d860a2d123b
diff --git a/.env.example b/.env.example
index d94630af2..0f7434669 100644
--- a/.env.example
+++ b/.env.example
@@ -125,4 +125,4 @@ DISABLE_SSL_VERIFY=false
# HF_HOME=/app/data/hf
# Force offline mode (requires models already downloaded into the cache)
-# HF_HUB_OFFLINE=1
\ No newline at end of file
+# HF_HUB_OFFLINE=1
diff --git a/.env.example_CN b/.env.example_CN
index 20e64690c..8a6dae19c 100644
--- a/.env.example_CN
+++ b/.env.example_CN
@@ -125,4 +125,4 @@ DISABLE_SSL_VERIFY=false
# HF_HOME=/app/data/hf
# 强制离线模式(前提:模型已在上述缓存目录中下载好)
-# HF_HUB_OFFLINE=1
\ No newline at end of file
+# HF_HUB_OFFLINE=1
diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml
index b8e2698f7..ff5664921 100644
--- a/.github/workflows/docker-publish.yml
+++ b/.github/workflows/docker-publish.yml
@@ -67,14 +67,14 @@ jobs:
id: version
run: |
VERSION="${{ github.event.inputs.version }}"
-
+
# Validate version format (e.g., 0.5.2, 1.0.0)
if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "❌ Error: Invalid version format '$VERSION'"
echo " Expected format: X.Y.Z (e.g., 0.5.2, 1.0.0)"
exit 1
fi
-
+
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "📌 Version: ${VERSION}"
echo "📌 Push latest: ${{ github.event.inputs.push_latest }}"
diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml
index 87fde353a..796833d31 100644
--- a/.github/workflows/docs.yaml
+++ b/.github/workflows/docs.yaml
@@ -2,7 +2,7 @@ name: Deploy Documentation
on:
push:
- branches: [main]
+ branches: [main, dev]
paths:
- 'docs/**'
- '.github/workflows/docs.yaml'
@@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
- uses: actions/checkout@v6
+ uses: actions/checkout@v4
with:
fetch-depth: 0
diff --git a/README.md b/README.md
index d75acaf26..a8430e245 100644
--- a/README.md
+++ b/README.md
@@ -45,11 +45,14 @@
### 📦 Releases
-> **[2026.1.18]** Release [v0.5.2](https://github.com/HKUDS/DeepTutor/releases/tag/v0.5.1) - Enhance RAG pipeline with Docling support and improve CI/CD workflows with several minor bugs fixed -- Thanks to all the feedbacks!
+> **[2026.1.23]** Release [v0.6.0](https://github.com/HKUDS/DeepTutor/releases/tag/v0.6.0) - Frontend session persistence, full Chinese support, Docker deployment updates, and minor bug fixes -- Thanks for all the feedback!
<details>
<summary>History releases</summary>
+> **[2026.1.18]** Release [v0.5.2](https://github.com/HKUDS/DeepTutor/releases/tag/v0.5.1) - Enhance RAG pipeline with Docling support and improve CI/CD workflows with several minor bugs fixed -- Thanks to all the feedbacks!
+
+
> **[2026.1.15]** Release [v0.5.0](https://github.com/HKUDS/DeepTutor/releases/tag/v0.5.0) - Unified LLM & Embedding services, RAG pipeline selection, and major enhancements to Home, History, QuestionGen & Settings modules -- Thanks to all the contributors!
> **[2026.1.9]** Release [v0.4.1](https://github.com/HKUDS/DeepTutor/releases/tag/v0.4.1) with LLM Provider system overhaul, Question Generation robustness improvements, and codebase cleanup - Thanks to all the contributors!
diff --git a/assets/README/README_AR.md b/assets/README/README_AR.md
index 294a0fee3..90360345b 100644
--- a/assets/README/README_AR.md
+++ b/assets/README/README_AR.md
@@ -5,12 +5,12 @@
# DeepTutor: مساعدك الشخصي للتعلم
[![Python](https://img.shields.io/badge/Python-3.10%2B-3776AB?style=flat-square&logo=python&logoColor=white)](https://www.python.org/downloads/)
-[![Next.js](https://img.shields.io/badge/Next.js-14-000000?style=flat-square&logo=next.js&logoColor=white)](https://nextjs.org/)
+[![Next.js](https://img.shields.io/badge/Next.js-16-000000?style=flat-square&logo=next.js&logoColor=white)](https://nextjs.org/)
[![FastAPI](https://img.shields.io/badge/FastAPI-0.100+-009688?style=flat-square&logo=fastapi&logoColor=white)](https://fastapi.tiangolo.com/)
-[![License](https://img.shields.io/badge/License-AGPL--3.0-blue?style=flat-square)](LICENSE)
-[![Discord](https://img.shields.io/badge/Discord-Join-7289DA?style=flat&logo=discord&logoColor=white)](https://discord.gg/aka9p9EW)
-[![Feishu](https://img.shields.io/badge/Feishu-Group-blue?style=flat)](./Communication.md)
-[![WeChat](https://img.shields.io/badge/WeChat-Group-green?style=flat&logo=wechat)](./Communication.md)
+[![License](https://img.shields.io/badge/License-AGPL--3.0-blue?style=flat-square)](../../LICENSE)
+[![Discord](https://img.shields.io/badge/Discord-Join-7289DA?style=flat&logo=discord&logoColor=white)](https://discord.gg/eRsjPgMU4t)
+[![Feishu](https://img.shields.io/badge/Feishu-Group-blue?style=flat)](../../Communication.md)
+[![WeChat](https://img.shields.io/badge/WeChat-Group-green?style=flat&logo=wechat)](https://github.com/HKUDS/DeepTutor/issues/78)
@@ -28,11 +28,11 @@
</div>
---
-> **[2026.1.1]** سنة جديدة سعيدة! انضم إلى [GitHub Discussions](https://github.com/HKUDS/DeepTutor/discussions) — ساهم في تشكيل مستقبل DeepTutor! 💬
+> **[2026.1.1]** سنة جديدة سعيدة! انضم إلى [مجتمع Discord](https://discord.gg/zpP9cssj)، أو [مجتمع WeChat](https://github.com/HKUDS/DeepTutor/issues/78)، أو [Discussions](https://github.com/HKUDS/DeepTutor/discussions) — ساهم في تشكيل مستقبل DeepTutor! 💬
> **[2025.12.30]** زر [موقعنا الرسمي](https://hkuds.github.io/DeepTutor/) لمزيد من التفاصيل!
-> **[2025.12.29]** DeepTutor v0.1 متاح الآن! ✨
+> **[2025.12.29]** DeepTutor متاح الآن! ✨
---
## الميزات الرئيسية لـ DeepTutor
@@ -229,24 +229,32 @@ cp .env.example .env
| المتغير | مطلوب | الوصف |
|:---|:---:|:---|
| `LLM_MODEL` | **نعم** | اسم النموذج (مثال: `gpt-4o`) |
+| `LLM_API_VERSION` | لا | إصدار API لـ Azure OpenAI (مثال: `2024-02-15-preview`) |
| `LLM_API_KEY` | **نعم** | مفتاح API الخاص بك لـ LLM |
| `LLM_HOST` | **نعم** | عنوان URL لنقطة نهاية API |
| `EMBEDDING_MODEL` | **نعم** | اسم نموذج التضمين |
+| `EMBEDDING_API_VERSION` | لا | إصدار API لـ Azure OpenAI Embeddings |
| `EMBEDDING_API_KEY` | **نعم** | مفتاح API للتضمين |
| `EMBEDDING_HOST` | **نعم** | نقطة نهاية API للتضمين |
| `BACKEND_PORT` | لا | منفذ الخلفية (افتراضي: `8001`) |
| `FRONTEND_PORT` | لا | منفذ الواجهة الأمامية (افتراضي: `3782`) |
+| `NEXT_PUBLIC_API_BASE` | لا | **عنوان API للواجهة الأمامية** — اضبطه للوصول عن بُعد/LAN (مثال: `http://192.168.1.100:8001`) |
| `TTS_*` | لا | إعدادات تحويل النص إلى كلام |
| `SEARCH_PROVIDER` | لا | مزود البحث (الخيارات: `perplexity`, `tavily`, `serper`, `jina`, `exa`, `baidu`، الافتراضي: `perplexity`) |
| `SEARCH_API_KEY` | لا | مفتاح API موحد للبحث |
+> 💡 **وصول عن بُعد**: إذا كنت تصل من جهاز آخر (مثلاً: `192.168.31.66:3782`)، أضف إلى `.env`:
+> ```bash
+> NEXT_PUBLIC_API_BASE=http://192.168.31.66:8001
+> ```
+
</details>
**③ تكوين المنافذ و LLM** *(اختياري)*
-- **المنافذ**: عدّل `config/main.yaml` → `server.backend_port` / `server.frontend_port`
+- **المنافذ**: اضبط في `.env` → `BACKEND_PORT` / `FRONTEND_PORT` (الافتراضي: 8001/3782)
- **LLM**: عدّل `config/agents.yaml` → `temperature` / `max_tokens` لكل وحدة
-- راجع [وثائق التكوين](config/README.md) للتفاصيل
+- راجع [وثائق التكوين](../../config/README.md) للتفاصيل
**④ تجربة قواعد المعرفة التجريبية** *(اختياري)*
@@ -288,18 +296,15 @@ cp .env.example .env
<summary><b>🚀 الخيار أ: صورة مسبقة البناء (الأسرع)</b></summary>
```bash
-# سحب وتشغيل الصورة المسبقة البناء (~30 ثانية)
+# يعمل على جميع الأنظمة: Docker يحدد المعمارية تلقائياً
docker run -d --name deeptutor \
-p 8001:8001 -p 3782:3782 \
- -e LLM_MODEL=gpt-4o \
- -e LLM_API_KEY=your-api-key \
- -e LLM_HOST=https://api.openai.com/v1 \
- -e EMBEDDING_MODEL=text-embedding-3-large \
- -e EMBEDDING_API_KEY=your-api-key \
- -e EMBEDDING_HOST=https://api.openai.com/v1 \
+ --env-file .env \
-v $(pwd)/data:/app/data \
-v $(pwd)/config:/app/config:ro \
ghcr.io/hkuds/deeptutor:latest
+
+# Windows PowerShell: استخدم ${PWD} بدلاً من $(pwd)
```
أو استخدام ملف `.env`:
@@ -455,11 +460,11 @@ data/
**قائمة التحقق**
- تأكد من إصدار Python >= 3.10
- تأكد من تثبيت جميع المتطلبات: `pip install -r requirements.txt`
-- تحقق مما إذا كان المنفذ 8001 قيد الاستخدام (قابل للتكوين في `config/main.yaml`)
+- تحقق مما إذا كان المنفذ 8001 قيد الاستخدام
- تحقق من تكوين ملف `.env`
**الحلول**
-- **تغيير المنفذ**: تحرير `config/main.yaml` server.backend_port
+- **تغيير المنفذ**: قم بتعيين `BACKEND_PORT=9001` في ملف `.env`
- **التحقق من السجلات**: مراجعة رسائل خطأ الطرفية
</details>
@@ -636,7 +641,7 @@ python src/knowledge/extract_numbered_items.py --kb <kb_name> --base-dir ./data/
## 📄 الترخيص
-هذا المشروع مرخص تحت **[AGPL-3.0](LICENSE)**.
+هذا المشروع مرخص تحت **[AGPL-3.0](../../LICENSE)**.
## ⭐ سجل النجوم
diff --git a/assets/README/README_CN.md b/assets/README/README_CN.md
index 2ecdcb542..5e99672a6 100644
--- a/assets/README/README_CN.md
+++ b/assets/README/README_CN.md
@@ -5,12 +5,14 @@
# DeepTutor: 您的个人学习助手
[![Python](https://img.shields.io/badge/Python-3.10%2B-3776AB?style=flat-square&logo=python&logoColor=white)](https://www.python.org/downloads/)
-[![Next.js](https://img.shields.io/badge/Next.js-14-000000?style=flat-square&logo=next.js&logoColor=white)](https://nextjs.org/)
[![FastAPI](https://img.shields.io/badge/FastAPI-0.100+-009688?style=flat-square&logo=fastapi&logoColor=white)](https://fastapi.tiangolo.com/)
-[![License](https://img.shields.io/badge/License-AGPL--3.0-blue?style=flat-square)](LICENSE)
-[![Discord](https://img.shields.io/badge/Discord-Join-7289DA?style=flat&logo=discord&logoColor=white)](https://discord.gg/aka9p9EW)
-[![Feishu](https://img.shields.io/badge/Feishu-Group-blue?style=flat)](./Communication.md)
-[![WeChat](https://img.shields.io/badge/WeChat-Group-green?style=flat&logo=wechat)](./Communication.md)
+[![React](https://img.shields.io/badge/React-19-61DAFB?style=flat-square&logo=react&logoColor=black)](https://react.dev/)
+[![Next.js](https://img.shields.io/badge/Next.js-16-000000?style=flat-square&logo=next.js&logoColor=white)](https://nextjs.org/)
+[![TailwindCSS](https://img.shields.io/badge/Tailwind-3.4-06B6D4?style=flat-square&logo=tailwindcss&logoColor=white)](https://tailwindcss.com/)
+[![License](https://img.shields.io/badge/License-AGPL--3.0-blue?style=flat-square)](../../LICENSE)
+[![Discord](https://img.shields.io/badge/Discord-Join-7289DA?style=flat&logo=discord&logoColor=white)](https://discord.gg/eRsjPgMU4t)
+[![Feishu](https://img.shields.io/badge/Feishu-Group-blue?style=flat)](../../Communication.md)
+[![WeChat](https://img.shields.io/badge/WeChat-Group-green?style=flat&logo=wechat)](https://github.com/HKUDS/DeepTutor/issues/78)
@@ -28,11 +30,30 @@
</div>
---
-> **[2026.1.1]** 新年快乐!加入我们的 [GitHub Discussions](https://github.com/HKUDS/DeepTutor/discussions) — 一起塑造 DeepTutor 的未来!💬
+> **[2026.1.1]** 新年快乐!加入我们的 [Discord 社区](https://discord.gg/zpP9cssj)、[WeChat 社区](https://github.com/HKUDS/DeepTutor/issues/78) 或 [Discussions](https://github.com/HKUDS/DeepTutor/discussions) — 一起塑造 DeepTutor 的未来!💬
> **[2025.12.30]** 访问我们的 [官方网站](https://hkuds.github.io/DeepTutor/) 获取更多详情!
-> **[2025.12.29]** DeepTutor v0.1 正式发布!✨
+> **[2025.12.29]** DeepTutor 正式发布!✨
+
+### 📦 Releases
+
+> **[2026.1.18]** 发布 [v0.5.2](https://github.com/HKUDS/DeepTutor/releases/tag/v0.5.1) - RAG 流水线新增 Docling 支持,并改进 CI/CD 工作流、修复若干小问题 —— 感谢大家的反馈!
+
+<details>
+<summary>历史版本</summary>
+
+> **[2026.1.15]** 发布 [v0.5.0](https://github.com/HKUDS/DeepTutor/releases/tag/v0.5.0) - 统一 LLM & Embedding 服务、RAG 流水线选择,并对 Home、History、QuestionGen、Settings 模块做了重大增强 —— 感谢所有贡献者!
+
+> **[2026.1.9]** 发布 [v0.4.1](https://github.com/HKUDS/DeepTutor/releases/tag/v0.4.1) - LLM Provider 系统重构、题目生成鲁棒性提升与代码清理 —— 感谢所有贡献者!
+
+> **[2026.1.9]** 发布 [v0.4.0](https://github.com/HKUDS/DeepTutor/releases/tag/v0.4.0) - 全新代码结构、多 LLM & Embeddings 支持 —— 感谢所有贡献者!
+
+> **[2026.1.5]** 发布 [v0.3.0](https://github.com/HKUDS/DeepTutor/releases/tag/v0.3.0) - 统一 PromptManager 架构、CI/CD 自动化与 GHCR 预构建 Docker 镜像
+
+> **[2026.1.2]** 发布 [v0.2.0](https://github.com/HKUDS/DeepTutor/releases/tag/v0.2.0) - Docker 部署、Next.js 16 & React 19 升级、WebSocket 安全与关键漏洞修复
+
+</details>
---
## DeepTutor 的核心功能
@@ -247,24 +268,32 @@ cp .env.example .env
| 变量 | 必需 | 描述 |
|:---|:---:|:---|
| `LLM_MODEL` | **是** | 模型名称(例如:`gpt-4o`) |
+| `LLM_API_VERSION` | 否 | Azure OpenAI 的 API 版本(例如:`2024-02-15-preview`) |
| `LLM_API_KEY` | **是** | 您的 LLM API 密钥 |
| `LLM_HOST` | **是** | API 端点 URL |
| `EMBEDDING_MODEL` | **是** | 嵌入模型名称 |
+| `EMBEDDING_API_VERSION` | 否 | Azure OpenAI Embeddings 的 API 版本 |
| `EMBEDDING_API_KEY` | **是** | 嵌入 API 密钥 |
| `EMBEDDING_HOST` | **是** | 嵌入 API 端点 |
| `BACKEND_PORT` | 否 | 后端端口(默认:`8001`) |
| `FRONTEND_PORT` | 否 | 前端端口(默认:`3782`) |
+| `NEXT_PUBLIC_API_BASE` | 否 | **前端 API URL** —— 远程/LAN 访问时设置(例如:`http://192.168.1.100:8001`) |
| `TTS_*` | 否 | 文本转语音设置 |
| `SEARCH_PROVIDER` | 否 | 搜索提供商(可选:`perplexity`, `tavily`, `serper`, `jina`, `exa`, `baidu`,默认:`perplexity`)|
| `SEARCH_API_KEY` | 否 | 统一的搜索 API 密钥 |
+> 💡 **远程访问**:如需从其他设备访问(例如:`192.168.31.66:3782`),请在 `.env` 中添加:
+> ```bash
+> NEXT_PUBLIC_API_BASE=http://192.168.31.66:8001
+> ```
+
</details>
**③ 配置端口和 LLM** *(可选)*
-- **端口**:编辑 `config/main.yaml` → `server.backend_port` / `server.frontend_port`
+- **端口**:在 `.env` 中设置 → `BACKEND_PORT` / `FRONTEND_PORT`(默认:8001/3782)
- **LLM**:编辑 `config/agents.yaml` → 每个模块的 `temperature` / `max_tokens`
-- 详细信息请参阅[配置文档](config/README.md)
+- 详细信息请参阅[配置文档](../../config/README.md)
**④ 试用演示知识库** *(可选)*
@@ -306,18 +335,15 @@ cp .env.example .env
<summary><b>🚀 方式 A:预构建镜像(最快)</b></summary>
```bash
-# 拉取并运行预构建镜像(约 30 秒)
+# 支持所有平台:Docker 会自动识别你的架构
docker run -d --name deeptutor \
-p 8001:8001 -p 3782:3782 \
- -e LLM_MODEL=gpt-4o \
- -e LLM_API_KEY=your-api-key \
- -e LLM_HOST=https://api.openai.com/v1 \
- -e EMBEDDING_MODEL=text-embedding-3-large \
- -e EMBEDDING_API_KEY=your-api-key \
- -e EMBEDDING_HOST=https://api.openai.com/v1 \
+ --env-file .env \
-v $(pwd)/data:/app/data \
-v $(pwd)/config:/app/config:ro \
ghcr.io/hkuds/deeptutor:latest
+
+# Windows PowerShell:使用 ${PWD} 替代 $(pwd)
```
或使用 `.env` 文件:
@@ -1132,11 +1158,11 @@ asyncio.run(main())
**检查清单**
- 确认 Python 版本 >= 3.10
- 确认已安装所有依赖:`pip install -r requirements.txt`
-- 检查端口 8001 是否被占用(可在 `config/main.yaml` 中配置)
+- 检查端口 8001 是否被占用
- 检查 `.env` 文件配置
**解决方案**
-- **更改端口**:编辑 `config/main.yaml` 中的 server.backend_port
+- **更改端口**:在 `.env` 文件中设置 `BACKEND_PORT=9001`
- **检查日志**:查看终端错误消息
</details>
@@ -1313,7 +1339,7 @@ python src/knowledge/extract_numbered_items.py --kb <kb_name> --base-dir ./data/
## 📄 许可证
-本项目采用 **[AGPL-3.0 许可证](LICENSE)**。
+本项目采用 **[AGPL-3.0 许可证](../../LICENSE)**。
## ⭐ Star 历史
diff --git a/assets/README/README_ES.md b/assets/README/README_ES.md
index 903aeb467..c1a8cca98 100644
--- a/assets/README/README_ES.md
+++ b/assets/README/README_ES.md
@@ -5,12 +5,12 @@
# DeepTutor: Tu Asistente Personal de Aprendizaje
[![Python](https://img.shields.io/badge/Python-3.10%2B-3776AB?style=flat-square&logo=python&logoColor=white)](https://www.python.org/downloads/)
-[![Next.js](https://img.shields.io/badge/Next.js-14-000000?style=flat-square&logo=next.js&logoColor=white)](https://nextjs.org/)
+[![Next.js](https://img.shields.io/badge/Next.js-16-000000?style=flat-square&logo=next.js&logoColor=white)](https://nextjs.org/)
[![FastAPI](https://img.shields.io/badge/FastAPI-0.100+-009688?style=flat-square&logo=fastapi&logoColor=white)](https://fastapi.tiangolo.com/)
-[![License](https://img.shields.io/badge/License-AGPL--3.0-blue?style=flat-square)](LICENSE)
-[![Discord](https://img.shields.io/badge/Discord-Join-7289DA?style=flat&logo=discord&logoColor=white)](https://discord.gg/aka9p9EW)
-[![Feishu](https://img.shields.io/badge/Feishu-Group-blue?style=flat)](./Communication.md)
-[![WeChat](https://img.shields.io/badge/WeChat-Group-green?style=flat&logo=wechat)](./Communication.md)
+[![License](https://img.shields.io/badge/License-AGPL--3.0-blue?style=flat-square)](../../LICENSE)
+[![Discord](https://img.shields.io/badge/Discord-Join-7289DA?style=flat&logo=discord&logoColor=white)](https://discord.gg/eRsjPgMU4t)
+[![Feishu](https://img.shields.io/badge/Feishu-Group-blue?style=flat)](../../Communication.md)
+[![WeChat](https://img.shields.io/badge/WeChat-Group-green?style=flat&logo=wechat)](https://github.com/HKUDS/DeepTutor/issues/78)
@@ -28,11 +28,11 @@
</div>
---
-> **[2026.1.1]** ¡Feliz Año Nuevo! Únete a nuestras [GitHub Discussions](https://github.com/HKUDS/DeepTutor/discussions) — ¡moldea el futuro de DeepTutor! 💬
+> **[2026.1.1]** ¡Feliz Año Nuevo! Únete a nuestra [Comunidad de Discord](https://discord.gg/zpP9cssj), [Comunidad de WeChat](https://github.com/HKUDS/DeepTutor/issues/78) o [Discussions](https://github.com/HKUDS/DeepTutor/discussions) — ¡moldea el futuro de DeepTutor! 💬
> **[2025.12.30]** ¡Visita nuestro [Sitio Web Oficial](https://hkuds.github.io/DeepTutor/) para más detalles!
-> **[2025.12.29]** ¡DeepTutor v0.1 ya está disponible! ✨
+> **[2025.12.29]** ¡DeepTutor ya está disponible! ✨
---
## Características Clave de DeepTutor
@@ -229,24 +229,32 @@ cp .env.example .env
| Variable | Requerido | Descripción |
|:---|:---:|:---|
| `LLM_MODEL` | **Sí** | Nombre del modelo (ej: `gpt-4o`) |
+| `LLM_API_VERSION` | No | Versión de API para Azure OpenAI (ej: `2024-02-15-preview`) |
| `LLM_API_KEY` | **Sí** | Su clave API de LLM |
| `LLM_HOST` | **Sí** | URL del endpoint de API |
| `EMBEDDING_MODEL` | **Sí** | Nombre del modelo de incrustación |
+| `EMBEDDING_API_VERSION` | No | Versión de API para Azure OpenAI Embeddings |
| `EMBEDDING_API_KEY` | **Sí** | Clave API de incrustación |
| `EMBEDDING_HOST` | **Sí** | Endpoint de API de incrustación |
| `BACKEND_PORT` | No | Puerto del backend (predeterminado: `8001`) |
| `FRONTEND_PORT` | No | Puerto del frontend (predeterminado: `3782`) |
+| `NEXT_PUBLIC_API_BASE` | No | **URL del API para el frontend** (configúrelo para acceso remoto/LAN, ej: `http://192.168.1.100:8001`) |
| `TTS_*` | No | Configuración de texto a voz |
| `SEARCH_PROVIDER` | No | Proveedor de búsqueda (opciones: `perplexity`, `tavily`, `serper`, `jina`, `exa`, `baidu`, predeterminado: `perplexity`) |
| `SEARCH_API_KEY` | No | Clave API unificada para búsqueda |
+> 💡 **Acceso remoto**: si accede desde otro dispositivo (ej.: `192.168.31.66:3782`), añada a `.env`:
+> ```bash
+> NEXT_PUBLIC_API_BASE=http://192.168.31.66:8001
+> ```
+
</details>
**③ Configurar Puertos y LLM** *(Opcional)*
-- **Puertos**: Edite `config/main.yaml` → `server.backend_port` / `server.frontend_port`
+- **Puertos**: Configure en `.env` → `BACKEND_PORT` / `FRONTEND_PORT` (predeterminado: 8001/3782)
- **LLM**: Edite `config/agents.yaml` → `temperature` / `max_tokens` por módulo
-- Consulte [Documentación de Configuración](config/README.md) para más detalles
+- Consulte [Documentación de Configuración](../../config/README.md) para más detalles
**④ Probar Bases de Conocimiento Demo** *(Opcional)*
@@ -288,18 +296,15 @@ cp .env.example .env
<summary><b>🚀 Opción A: Imagen Pre-construida (Más Rápido)</b></summary>
```bash
-# Descargar y ejecutar imagen pre-construida (~30 segundos)
+# Funciona en todas las plataformas: Docker detecta automáticamente su arquitectura
docker run -d --name deeptutor \
-p 8001:8001 -p 3782:3782 \
- -e LLM_MODEL=gpt-4o \
- -e LLM_API_KEY=your-api-key \
- -e LLM_HOST=https://api.openai.com/v1 \
- -e EMBEDDING_MODEL=text-embedding-3-large \
- -e EMBEDDING_API_KEY=your-api-key \
- -e EMBEDDING_HOST=https://api.openai.com/v1 \
+ --env-file .env \
-v $(pwd)/data:/app/data \
-v $(pwd)/config:/app/config:ro \
ghcr.io/hkuds/deeptutor:latest
+
+# Windows PowerShell: use ${PWD} en lugar de $(pwd)
```
O usar archivo `.env`:
@@ -403,7 +408,7 @@ python scripts/start.py
## 📄 Licencia
-Este proyecto está licenciado bajo la **[AGPL-3.0](LICENSE)**.
+Este proyecto está licenciado bajo la **[AGPL-3.0](../../LICENSE)**.
## ⭐ Historial de Stars
diff --git a/assets/README/README_FR.md b/assets/README/README_FR.md
index 972db299f..0b2fcff5d 100644
--- a/assets/README/README_FR.md
+++ b/assets/README/README_FR.md
@@ -5,12 +5,12 @@
# DeepTutor: Votre Assistant d'Apprentissage Personnel
[![Python](https://img.shields.io/badge/Python-3.10%2B-3776AB?style=flat-square&logo=python&logoColor=white)](https://www.python.org/downloads/)
-[![Next.js](https://img.shields.io/badge/Next.js-14-000000?style=flat-square&logo=next.js&logoColor=white)](https://nextjs.org/)
+[![Next.js](https://img.shields.io/badge/Next.js-16-000000?style=flat-square&logo=next.js&logoColor=white)](https://nextjs.org/)
[![FastAPI](https://img.shields.io/badge/FastAPI-0.100+-009688?style=flat-square&logo=fastapi&logoColor=white)](https://fastapi.tiangolo.com/)
-[![License](https://img.shields.io/badge/License-AGPL--3.0-blue?style=flat-square)](LICENSE)
-[![Discord](https://img.shields.io/badge/Discord-Join-7289DA?style=flat&logo=discord&logoColor=white)](https://discord.gg/aka9p9EW)
-[![Feishu](https://img.shields.io/badge/Feishu-Group-blue?style=flat)](./Communication.md)
-[![WeChat](https://img.shields.io/badge/WeChat-Group-green?style=flat&logo=wechat)](./Communication.md)
+[![License](https://img.shields.io/badge/License-AGPL--3.0-blue?style=flat-square)](../../LICENSE)
+[![Discord](https://img.shields.io/badge/Discord-Join-7289DA?style=flat&logo=discord&logoColor=white)](https://discord.gg/eRsjPgMU4t)
+[![Feishu](https://img.shields.io/badge/Feishu-Group-blue?style=flat)](../../Communication.md)
+[![WeChat](https://img.shields.io/badge/WeChat-Group-green?style=flat&logo=wechat)](https://github.com/HKUDS/DeepTutor/issues/78)
@@ -28,11 +28,11 @@
</div>
---
-> **[2026.1.1]** Bonne Année ! Rejoignez nos [GitHub Discussions](https://github.com/HKUDS/DeepTutor/discussions) — façonnez l'avenir de DeepTutor ! 💬
+> **[2026.1.1]** Bonne Année ! Rejoignez notre [Communauté Discord](https://discord.gg/zpP9cssj), notre [Communauté WeChat](https://github.com/HKUDS/DeepTutor/issues/78), ou [Discussions](https://github.com/HKUDS/DeepTutor/discussions) — façonnez l'avenir de DeepTutor ! 💬
> **[2025.12.30]** Visitez notre [Site Web Officiel](https://hkuds.github.io/DeepTutor/) pour plus de détails !
-> **[2025.12.29]** DeepTutor v0.1 est maintenant disponible ! ✨
+> **[2025.12.29]** DeepTutor est maintenant disponible ! ✨
---
## Caractéristiques Clés d'DeepTutor
@@ -229,24 +229,32 @@ cp .env.example .env
| Variable | Requis | Description |
|:---|:---:|:---|
| `LLM_MODEL` | **Oui** | Nom du modèle (ex: `gpt-4o`) |
+| `LLM_API_VERSION` | Non | Version d'API pour Azure OpenAI (ex: `2024-02-15-preview`) |
| `LLM_API_KEY` | **Oui** | Votre clé API LLM |
| `LLM_HOST` | **Oui** | URL du point de terminaison API |
| `EMBEDDING_MODEL` | **Oui** | Nom du modèle d'intégration |
+| `EMBEDDING_API_VERSION` | Non | Version d'API pour Azure OpenAI Embeddings |
| `EMBEDDING_API_KEY` | **Oui** | Clé API d'intégration |
| `EMBEDDING_HOST` | **Oui** | Point de terminaison API d'intégration |
| `BACKEND_PORT` | Non | Port backend (par défaut: `8001`) |
| `FRONTEND_PORT` | Non | Port frontend (par défaut: `3782`) |
+| `NEXT_PUBLIC_API_BASE` | Non | **URL de l'API côté frontend** (à définir pour l'accès distant/LAN, ex: `http://192.168.1.100:8001`) |
| `TTS_*` | Non | Paramètres de synthèse vocale |
| `SEARCH_PROVIDER` | Non | Fournisseur de recherche (options: `perplexity`, `tavily`, `serper`, `jina`, `exa`, `baidu`, défaut: `perplexity`) |
| `SEARCH_API_KEY` | Non | Clé API unifiée pour la recherche |
+> 💡 **Accès distant** : si vous accédez depuis un autre appareil (ex. `192.168.31.66:3782`), ajoutez dans `.env` :
+> ```bash
+> NEXT_PUBLIC_API_BASE=http://192.168.31.66:8001
+> ```
+
</details>
**③ Configurer les Ports et LLM** *(Optionnel)*
-- **Ports**: Éditez `config/main.yaml` → `server.backend_port` / `server.frontend_port`
+- **Ports**: Configurez dans `.env` → `BACKEND_PORT` / `FRONTEND_PORT` (par défaut: 8001/3782)
- **LLM**: Éditez `config/agents.yaml` → `temperature` / `max_tokens` par module
-- Voir [Documentation de Configuration](config/README.md) pour plus de détails
+- Voir [Documentation de Configuration](../../config/README.md) pour plus de détails
**④ Essayer les Bases de Connaissances Démo** *(Optionnel)*
@@ -288,18 +296,15 @@ cp .env.example .env
<summary><b>🚀 Option A: Image Pré-construite (Plus Rapide)</b></summary>
```bash
-# Télécharger et exécuter l'image pré-construite (~30 secondes)
+# Fonctionne sur toutes les plateformes : Docker détecte automatiquement votre architecture
docker run -d --name deeptutor \
-p 8001:8001 -p 3782:3782 \
- -e LLM_MODEL=gpt-4o \
- -e LLM_API_KEY=your-api-key \
- -e LLM_HOST=https://api.openai.com/v1 \
- -e EMBEDDING_MODEL=text-embedding-3-large \
- -e EMBEDDING_API_KEY=your-api-key \
- -e EMBEDDING_HOST=https://api.openai.com/v1 \
+ --env-file .env \
-v $(pwd)/data:/app/data \
-v $(pwd)/config:/app/config:ro \
ghcr.io/hkuds/deeptutor:latest
+
+# Windows PowerShell : utilisez ${PWD} au lieu de $(pwd)
```
Ou utiliser le fichier `.env`:
@@ -457,11 +462,11 @@ Tous les résultats sont automatiquement enregistrés lorsque vous effectuez n'i
**Liste de Vérification**
- Confirmez que la version Python >= 3.10
- Confirmez que toutes les dépendances sont installées: `pip install -r requirements.txt`
-- Vérifiez si le port 8001 est utilisé (configurable dans `config/main.yaml`)
+- Vérifiez si le port 8001 est utilisé
- Vérifiez la configuration du fichier `.env`
**Solutions**
-- **Changer le port**: Modifiez `config/main.yaml` server.backend_port
+- **Changer le port**: Définissez `BACKEND_PORT=9001` dans le fichier `.env`
- **Vérifier les journaux**: Vérifiez les messages d'erreur du terminal
</details>
@@ -638,7 +643,7 @@ Ceci extraira les éléments numérotés (Définitions, Théorèmes, Équations,
## 📄 Licence
-Ce projet est sous licence **[AGPL-3.0](LICENSE)**.
+Ce projet est sous licence **[AGPL-3.0](../../LICENSE)**.
## ⭐ Historique des Stars
diff --git a/assets/README/README_HI.md b/assets/README/README_HI.md
index 623efd7e8..fd876ef40 100644
--- a/assets/README/README_HI.md
+++ b/assets/README/README_HI.md
@@ -5,12 +5,12 @@
# DeepTutor: आपका व्यक्तिगत सीखने का सहायक
[![Python](https://img.shields.io/badge/Python-3.10%2B-3776AB?style=flat-square&logo=python&logoColor=white)](https://www.python.org/downloads/)
-[![Next.js](https://img.shields.io/badge/Next.js-14-000000?style=flat-square&logo=next.js&logoColor=white)](https://nextjs.org/)
+[![Next.js](https://img.shields.io/badge/Next.js-16-000000?style=flat-square&logo=next.js&logoColor=white)](https://nextjs.org/)
[![FastAPI](https://img.shields.io/badge/FastAPI-0.100+-009688?style=flat-square&logo=fastapi&logoColor=white)](https://fastapi.tiangolo.com/)
-[![License](https://img.shields.io/badge/License-AGPL--3.0-blue?style=flat-square)](LICENSE)
-[![Discord](https://img.shields.io/badge/Discord-Join-7289DA?style=flat&logo=discord&logoColor=white)](https://discord.gg/aka9p9EW)
-[![Feishu](https://img.shields.io/badge/Feishu-Group-blue?style=flat)](./Communication.md)
-[![WeChat](https://img.shields.io/badge/WeChat-Group-green?style=flat&logo=wechat)](./Communication.md)
+[![License](https://img.shields.io/badge/License-AGPL--3.0-blue?style=flat-square)](../../LICENSE)
+[![Discord](https://img.shields.io/badge/Discord-Join-7289DA?style=flat&logo=discord&logoColor=white)](https://discord.gg/eRsjPgMU4t)
+[![Feishu](https://img.shields.io/badge/Feishu-Group-blue?style=flat)](../../Communication.md)
+[![WeChat](https://img.shields.io/badge/WeChat-Group-green?style=flat&logo=wechat)](https://github.com/HKUDS/DeepTutor/issues/78)
@@ -28,11 +28,11 @@
</div>
---
-> **[2026.1.1]** नया साल मुबारक हो! हमारे [GitHub Discussions](https://github.com/HKUDS/DeepTutor/discussions) में शामिल हों — DeepTutor के भविष्य को आकार दें! 💬
+> **[2026.1.1]** नया साल मुबारक हो! हमारे [Discord समुदाय](https://discord.gg/zpP9cssj), [WeChat समुदाय](https://github.com/HKUDS/DeepTutor/issues/78), या [Discussions](https://github.com/HKUDS/DeepTutor/discussions) से जुड़ें — DeepTutor के भविष्य को आकार दें! 💬
> **[2025.12.30]** अधिक विवरण के लिए हमारी [आधिकारिक वेबसाइट](https://hkuds.github.io/DeepTutor/) पर जाएं!
-> **[2025.12.29]** DeepTutor v0.1 अब उपलब्ध है! ✨
+> **[2025.12.29]** DeepTutor अब उपलब्ध है! ✨
---
## DeepTutor की मुख्य विशेषताएं
@@ -229,24 +229,32 @@ cp .env.example .env
| चर | आवश्यक | विवरण |
|:---|:---:|:---|
| `LLM_MODEL` | **हाँ** | मॉडल नाम (उदा: `gpt-4o`) |
+| `LLM_API_VERSION` | नहीं | Azure OpenAI के लिए API संस्करण (उदा: `2024-02-15-preview`) |
| `LLM_API_KEY` | **हाँ** | आपकी LLM API कुंजी |
| `LLM_HOST` | **हाँ** | API एंडपॉइंट URL |
| `EMBEDDING_MODEL` | **हाँ** | एम्बेडिंग मॉडल नाम |
+| `EMBEDDING_API_VERSION` | नहीं | Azure OpenAI Embeddings के लिए API संस्करण |
| `EMBEDDING_API_KEY` | **हाँ** | एम्बेडिंग API कुंजी |
| `EMBEDDING_HOST` | **हाँ** | एम्बेडिंग API एंडपॉइंट |
| `BACKEND_PORT` | नहीं | बैकएंड पोर्ट (डिफ़ॉल्ट: `8001`) |
| `FRONTEND_PORT` | नहीं | फ्रंटएंड पोर्ट (डिफ़ॉल्ट: `3782`) |
+| `NEXT_PUBLIC_API_BASE` | नहीं | **फ्रंटएंड API URL** — रिमोट/LAN एक्सेस के लिए सेट करें (उदा: `http://192.168.1.100:8001`) |
| `TTS_*` | नहीं | टेक्स्ट-टू-स्पीच सेटिंग्स |
| `SEARCH_PROVIDER` | नहीं | खोज प्रदाता (विकल्प: `perplexity`, `tavily`, `serper`, `jina`, `exa`, `baidu`, डिफ़ॉल्ट: `perplexity`) |
| `SEARCH_API_KEY` | नहीं | खोज के लिए एकीकृत API कुंजी |
+> 💡 **रिमोट एक्सेस**: यदि आप दूसरे डिवाइस से एक्सेस कर रहे हैं (उदा: `192.168.31.66:3782`), तो `.env` में जोड़ें:
+> ```bash
+> NEXT_PUBLIC_API_BASE=http://192.168.31.66:8001
+> ```
+
</details>
**③ पोर्ट और LLM कॉन्फ़िगर करें** *(वैकल्पिक)*
-- **पोर्ट**: `config/main.yaml` संपादित करें → `server.backend_port` / `server.frontend_port`
+- **पोर्ट**: `.env` में सेट करें → `BACKEND_PORT` / `FRONTEND_PORT` (डिफ़ॉल्ट: 8001/3782)
- **LLM**: `config/agents.yaml` संपादित करें → प्रति मॉड्यूल `temperature` / `max_tokens`
-- विवरण के लिए [कॉन्फ़िगरेशन दस्तावेज़](config/README.md) देखें
+- विवरण के लिए [कॉन्फ़िगरेशन दस्तावेज़](../../config/README.md) देखें
**④ डेमो ज्ञान आधार आज़माएं** *(वैकल्पिक)*
@@ -288,18 +296,15 @@ cp .env.example .env
<summary><b>🚀 विकल्प A: पूर्व-निर्मित छवि (सबसे तेज़)</b></summary>
```bash
-# पूर्व-निर्मित छवि को खींचें और चलाएं (~30 सेकंड)
+# सभी प्लेटफॉर्म पर काम करता है — Docker आपकी आर्किटेक्चर को ऑटो-डिटेक्ट करता है
docker run -d --name deeptutor \
-p 8001:8001 -p 3782:3782 \
- -e LLM_MODEL=gpt-4o \
- -e LLM_API_KEY=your-api-key \
- -e LLM_HOST=https://api.openai.com/v1 \
- -e EMBEDDING_MODEL=text-embedding-3-large \
- -e EMBEDDING_API_KEY=your-api-key \
- -e EMBEDDING_HOST=https://api.openai.com/v1 \
+ --env-file .env \
-v $(pwd)/data:/app/data \
-v $(pwd)/config:/app/config:ro \
ghcr.io/hkuds/deeptutor:latest
+
+# Windows PowerShell: $(pwd) के बजाय ${PWD} का उपयोग करें
```
या `.env` फ़ाइल का उपयोग करें:
@@ -457,11 +462,11 @@ data/
**चेकलिस्ट**
- पुष्टि करें कि Python संस्करण >= 3.10
- पुष्टि करें कि सभी निर्भरताएं स्थापित हैं: `pip install -r requirements.txt`
-- जांचें कि पोर्ट 8001 उपयोग में है (`config/main.yaml` में कॉन्फ़िगर करने योग्य)
+- जांचें कि पोर्ट 8001 उपयोग में है
- `.env` फ़ाइल कॉन्फ़िगरेशन जांचें
**समाधान**
-- **पोर्ट बदलें**: `config/main.yaml` server.backend_port संपादित करें
+- **पोर्ट बदलें**: `.env` फ़ाइल में `BACKEND_PORT=9001` सेट करें
- **लॉग जांचें**: टर्मिनल त्रुटि संदेशों की समीक्षा करें
</details>
@@ -638,7 +643,7 @@ python src/knowledge/extract_numbered_items.py --kb <kb_name> --base-dir ./data/
## 📄 लाइसेंस
-यह प्रोजेक्ट **[AGPL-3.0](LICENSE)** लाइसेंस के तहत लाइसेंस प्राप्त है।
+यह प्रोजेक्ट **[AGPL-3.0](../../LICENSE)** लाइसेंस के तहत लाइसेंस प्राप्त है।
## ⭐ स्टार इतिहास
diff --git a/assets/README/README_JA.md b/assets/README/README_JA.md
index 41bfc2bdb..feab8937c 100644
--- a/assets/README/README_JA.md
+++ b/assets/README/README_JA.md
@@ -5,12 +5,12 @@
# DeepTutor: あなたのパーソナル学習アシスタント
[![Python](https://img.shields.io/badge/Python-3.10%2B-3776AB?style=flat-square&logo=python&logoColor=white)](https://www.python.org/downloads/)
-[![Next.js](https://img.shields.io/badge/Next.js-14-000000?style=flat-square&logo=next.js&logoColor=white)](https://nextjs.org/)
+[![Next.js](https://img.shields.io/badge/Next.js-16-000000?style=flat-square&logo=next.js&logoColor=white)](https://nextjs.org/)
[![FastAPI](https://img.shields.io/badge/FastAPI-0.100+-009688?style=flat-square&logo=fastapi&logoColor=white)](https://fastapi.tiangolo.com/)
-[![License](https://img.shields.io/badge/License-AGPL--3.0-blue?style=flat-square)](LICENSE)
-[![Discord](https://img.shields.io/badge/Discord-Join-7289DA?style=flat&logo=discord&logoColor=white)](https://discord.gg/aka9p9EW)
-[![Feishu](https://img.shields.io/badge/Feishu-Group-blue?style=flat)](./Communication.md)
-[![WeChat](https://img.shields.io/badge/WeChat-Group-green?style=flat&logo=wechat)](./Communication.md)
+[![License](https://img.shields.io/badge/License-AGPL--3.0-blue?style=flat-square)](../../LICENSE)
+[![Discord](https://img.shields.io/badge/Discord-Join-7289DA?style=flat&logo=discord&logoColor=white)](https://discord.gg/eRsjPgMU4t)
+[![Feishu](https://img.shields.io/badge/Feishu-Group-blue?style=flat)](../../Communication.md)
+[![WeChat](https://img.shields.io/badge/WeChat-Group-green?style=flat&logo=wechat)](https://github.com/HKUDS/DeepTutor/issues/78)
@@ -28,11 +28,11 @@
</div>
---
-> **[2026.1.1]** 新年あけましておめでとうございます![GitHub Discussions](https://github.com/HKUDS/DeepTutor/discussions) に参加して、DeepTutor の未来を一緒に創りましょう!💬
+> **[2026.1.1]** 新年あけましておめでとうございます![Discord コミュニティ](https://discord.gg/zpP9cssj)、[WeChat コミュニティ](https://github.com/HKUDS/DeepTutor/issues/78)、または [Discussions](https://github.com/HKUDS/DeepTutor/discussions) に参加して、DeepTutor の未来を一緒に創りましょう!💬
> **[2025.12.30]** 詳細は [公式ウェブサイト](https://hkuds.github.io/DeepTutor/) をご覧ください!
-> **[2025.12.29]** DeepTutor v0.1 がリリースされました!✨
+> **[2025.12.29]** DeepTutor が公開されました!✨
---
## DeepTutor の主要機能
@@ -247,24 +247,32 @@ cp .env.example .env
| 変数 | 必須 | 説明 |
|:---|:---:|:---|
| `LLM_MODEL` | **はい** | モデル名(例:`gpt-4o`) |
+| `LLM_API_VERSION` | いいえ | Azure OpenAI の API バージョン(例:`2024-02-15-preview`) |
| `LLM_API_KEY` | **はい** | LLM API キー |
| `LLM_HOST` | **はい** | API エンドポイント URL |
| `EMBEDDING_MODEL` | **はい** | 埋め込みモデル名 |
+| `EMBEDDING_API_VERSION` | いいえ | Azure OpenAI Embeddings の API バージョン |
| `EMBEDDING_API_KEY` | **はい** | 埋め込み API キー |
| `EMBEDDING_HOST` | **はい** | 埋め込み API エンドポイント |
| `BACKEND_PORT` | いいえ | バックエンドポート(デフォルト:`8001`) |
| `FRONTEND_PORT` | いいえ | フロントエンドポート(デフォルト:`3782`) |
+| `NEXT_PUBLIC_API_BASE` | いいえ | **フロントエンド用 API URL**(リモート/LAN アクセス時に設定。例:`http://192.168.1.100:8001`) |
| `TTS_*` | いいえ | テキスト読み上げ設定 |
| `SEARCH_PROVIDER` | いいえ | 検索プロバイダー(オプション:`perplexity`, `tavily`, `serper`, `jina`, `exa`, `baidu`、デフォルト:`perplexity`)|
| `SEARCH_API_KEY` | いいえ | 統一検索APIキー |
+> 💡 **リモートアクセス**:別デバイス(例:`192.168.31.66:3782`)からアクセスする場合は `.env` に追加します:
+> ```bash
+> NEXT_PUBLIC_API_BASE=http://192.168.31.66:8001
+> ```
+
</details>
**③ ポートと LLM を設定** *(オプション)*
-- **ポート**:`config/main.yaml` を編集 → `server.backend_port` / `server.frontend_port`
+- **ポート**:`.env` で `BACKEND_PORT` / `FRONTEND_PORT` を設定(デフォルト:8001/3782)
- **LLM**:`config/agents.yaml` を編集 → 各モジュールの `temperature` / `max_tokens`
-- 詳細は[設定ドキュメント](config/README.md)を参照
+- 詳細は[設定ドキュメント](../../config/README.md)を参照
**④ デモナレッジベースを試す** *(オプション)*
@@ -306,29 +314,15 @@ cp .env.example .env
<summary><b>🚀 オプション A: 事前構築済みイメージ(最速)</b></summary>
```bash
-# 事前構築済みイメージをプルして実行(約30秒)
-docker run -d --name deeptutor \
- -p 8001:8001 -p 3782:3782 \
- -e LLM_MODEL=gpt-4o \
- -e LLM_API_KEY=your-api-key \
- -e LLM_HOST=https://api.openai.com/v1 \
- -e EMBEDDING_MODEL=text-embedding-3-large \
- -e EMBEDDING_API_KEY=your-api-key \
- -e EMBEDDING_HOST=https://api.openai.com/v1 \
- -v $(pwd)/data:/app/data \
- -v $(pwd)/config:/app/config:ro \
- ghcr.io/hkuds/deeptutor:latest
-```
-
-または `.env` ファイルを使用:
-
-```bash
+# すべてのプラットフォームで動作(Docker がアーキテクチャを自動判別)
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
+
+# Windows PowerShell: $(pwd) の代わりに ${PWD} を使用
```
</details>
@@ -419,7 +413,7 @@ python scripts/start.py
## 📄 ライセンス
-このプロジェクトは **[AGPL-3.0 ライセンス](LICENSE)** でライセンスされています。
+このプロジェクトは **[AGPL-3.0 ライセンス](../../LICENSE)** でライセンスされています。
## ⭐ Star History
diff --git a/assets/README/README_PT.md b/assets/README/README_PT.md
index 16f0aa50e..ce336845b 100644
--- a/assets/README/README_PT.md
+++ b/assets/README/README_PT.md
@@ -5,12 +5,12 @@
# DeepTutor: Seu Assistente Pessoal de Aprendizado
[![Python](https://img.shields.io/badge/Python-3.10%2B-3776AB?style=flat-square&logo=python&logoColor=white)](https://www.python.org/downloads/)
-[![Next.js](https://img.shields.io/badge/Next.js-14-000000?style=flat-square&logo=next.js&logoColor=white)](https://nextjs.org/)
+[![Next.js](https://img.shields.io/badge/Next.js-16-000000?style=flat-square&logo=next.js&logoColor=white)](https://nextjs.org/)
[![FastAPI](https://img.shields.io/badge/FastAPI-0.100+-009688?style=flat-square&logo=fastapi&logoColor=white)](https://fastapi.tiangolo.com/)
-[![License](https://img.shields.io/badge/License-AGPL--3.0-blue?style=flat-square)](LICENSE)
-[![Discord](https://img.shields.io/badge/Discord-Join-7289DA?style=flat&logo=discord&logoColor=white)](https://discord.gg/aka9p9EW)
-[![Feishu](https://img.shields.io/badge/Feishu-Group-blue?style=flat)](./Communication.md)
-[![WeChat](https://img.shields.io/badge/WeChat-Group-green?style=flat&logo=wechat)](./Communication.md)
+[![License](https://img.shields.io/badge/License-AGPL--3.0-blue?style=flat-square)](../../LICENSE)
+[![Discord](https://img.shields.io/badge/Discord-Join-7289DA?style=flat&logo=discord&logoColor=white)](https://discord.gg/eRsjPgMU4t)
+[![Feishu](https://img.shields.io/badge/Feishu-Group-blue?style=flat)](../../Communication.md)
+[![WeChat](https://img.shields.io/badge/WeChat-Group-green?style=flat&logo=wechat)](https://github.com/HKUDS/DeepTutor/issues/78)
@@ -28,11 +28,11 @@
</div>
---
-> **[2026.1.1]** Feliz Ano Novo! Junte-se às nossas [GitHub Discussions](https://github.com/HKUDS/DeepTutor/discussions) — molde o futuro do DeepTutor! 💬
+> **[2026.1.1]** Feliz Ano Novo! Junte-se à nossa [Comunidade no Discord](https://discord.gg/zpP9cssj), à [Comunidade no WeChat](https://github.com/HKUDS/DeepTutor/issues/78), ou ao [Discussions](https://github.com/HKUDS/DeepTutor/discussions) — molde o futuro do DeepTutor! 💬
> **[2025.12.30]** Visite nosso [Site Oficial](https://hkuds.github.io/DeepTutor/) para mais detalhes!
-> **[2025.12.29]** DeepTutor v0.1 já está disponível! ✨
+> **[2025.12.29]** DeepTutor já está disponível! ✨
---
## Características Principais do DeepTutor
@@ -229,24 +229,32 @@ cp .env.example .env
| Variável | Obrigatório | Descrição |
|:---|:---:|:---|
| `LLM_MODEL` | **Sim** | Nome do modelo (ex: `gpt-4o`) |
+| `LLM_API_VERSION` | Não | Versão da API para Azure OpenAI (ex: `2024-02-15-preview`) |
| `LLM_API_KEY` | **Sim** | Sua chave API LLM |
| `LLM_HOST` | **Sim** | URL do endpoint da API |
| `EMBEDDING_MODEL` | **Sim** | Nome do modelo de incorporação |
+| `EMBEDDING_API_VERSION` | Não | Versão da API para Azure OpenAI Embeddings |
| `EMBEDDING_API_KEY` | **Sim** | Chave API de incorporação |
| `EMBEDDING_HOST` | **Sim** | Endpoint da API de incorporação |
| `BACKEND_PORT` | Não | Porta do backend (padrão: `8001`) |
| `FRONTEND_PORT` | Não | Porta do frontend (padrão: `3782`) |
+| `NEXT_PUBLIC_API_BASE` | Não | **URL da API do frontend** (defina para acesso remoto/LAN, ex: `http://192.168.1.100:8001`) |
| `TTS_*` | Não | Configurações de texto para voz |
| `SEARCH_PROVIDER` | Não | Provedor de busca (opções: `perplexity`, `tavily`, `serper`, `jina`, `exa`, `baidu`, padrão: `perplexity`) |
| `SEARCH_API_KEY` | Não | Chave API unificada para busca |
+> 💡 **Acesso remoto**: se estiver acessando de outro dispositivo (ex.: `192.168.31.66:3782`), adicione ao `.env`:
+> ```bash
+> NEXT_PUBLIC_API_BASE=http://192.168.31.66:8001
+> ```
+
</details>
**③ Configurar Portas e LLM** *(Opcional)*
-- **Portas**: Edite `config/main.yaml` → `server.backend_port` / `server.frontend_port`
+- **Portas**: Configure no `.env` → `BACKEND_PORT` / `FRONTEND_PORT` (padrão: 8001/3782)
- **LLM**: Edite `config/agents.yaml` → `temperature` / `max_tokens` por módulo
-- Consulte [Documentação de Configuração](config/README.md) para detalhes
+- Consulte [Documentação de Configuração](../../config/README.md) para detalhes
**④ Experimentar Bases de Conhecimento Demo** *(Opcional)*
@@ -288,18 +296,15 @@ cp .env.example .env
<summary><b>🚀 Opção A: Imagem Pré-construída (Mais Rápido)</b></summary>
```bash
-# Baixar e executar imagem pré-construída (~30 segundos)
+# Funciona em todas as plataformas — Docker detecta sua arquitetura automaticamente
docker run -d --name deeptutor \
-p 8001:8001 -p 3782:3782 \
- -e LLM_MODEL=gpt-4o \
- -e LLM_API_KEY=your-api-key \
- -e LLM_HOST=https://api.openai.com/v1 \
- -e EMBEDDING_MODEL=text-embedding-3-large \
- -e EMBEDDING_API_KEY=your-api-key \
- -e EMBEDDING_HOST=https://api.openai.com/v1 \
+ --env-file .env \
-v $(pwd)/data:/app/data \
-v $(pwd)/config:/app/config:ro \
ghcr.io/hkuds/deeptutor:latest
+
+# Windows PowerShell: use ${PWD} em vez de $(pwd)
```
Ou usar arquivo `.env`:
@@ -457,11 +462,11 @@ Todos os resultados são automaticamente salvos quando você realiza qualquer at
**Lista de Verificação**
- Confirme que a versão Python >= 3.10
- Confirme que todas as dependências estão instaladas: `pip install -r requirements.txt`
-- Verifique se a porta 8001 está em uso (configurável em `config/main.yaml`)
+- Verifique se a porta 8001 está em uso
- Verifique a configuração do arquivo `.env`
**Soluções**
-- **Mudar porta**: Edite `config/main.yaml` server.backend_port
+- **Mudar porta**: Defina `BACKEND_PORT=9001` no arquivo `.env`
- **Verificar logs**: Revise as mensagens de erro do terminal
</details>
@@ -638,7 +643,7 @@ Isso extrairá elementos numerados (Definições, Teoremas, Equações, etc.) da
## 📄 Licença
-Este projeto está licenciado sob **[AGPL-3.0](LICENSE)**.
+Este projeto está licenciado sob **[AGPL-3.0](../../LICENSE)**.
## ⭐ Histórico de Stars
diff --git a/assets/README/README_RU.md b/assets/README/README_RU.md
index d1918055c..73b74f12d 100644
--- a/assets/README/README_RU.md
+++ b/assets/README/README_RU.md
@@ -7,10 +7,10 @@
[![Python](https://img.shields.io/badge/Python-3.10%2B-3776AB?style=flat-square&logo=python&logoColor=white)](https://www.python.org/downloads/)
[![Next.js](https://img.shields.io/badge/Next.js-16-000000?style=flat-square&logo=next.js&logoColor=white)](https://nextjs.org/)
[![FastAPI](https://img.shields.io/badge/FastAPI-0.100+-009688?style=flat-square&logo=fastapi&logoColor=white)](https://fastapi.tiangolo.com/)
-[![License](https://img.shields.io/badge/License-AGPL--3.0-blue?style=flat-square)](LICENSE)
-[![Discord](https://img.shields.io/badge/Discord-Join-7289DA?style=flat&logo=discord&logoColor=white)](https://discord.gg/aka9p9EW)
-[![Feishu](https://img.shields.io/badge/Feishu-Group-blue?style=flat)](./Communication.md)
-[![WeChat](https://img.shields.io/badge/WeChat-Group-green?style=flat&logo=wechat)](./Communication.md)
+[![License](https://img.shields.io/badge/License-AGPL--3.0-blue?style=flat-square)](../../LICENSE)
+[![Discord](https://img.shields.io/badge/Discord-Join-7289DA?style=flat&logo=discord&logoColor=white)](https://discord.gg/eRsjPgMU4t)
+[![Feishu](https://img.shields.io/badge/Feishu-Group-blue?style=flat)](../../Communication.md)
+[![WeChat](https://img.shields.io/badge/WeChat-Group-green?style=flat&logo=wechat)](https://github.com/HKUDS/DeepTutor/issues/78)
@@ -28,13 +28,13 @@
</div>
---
-> **[2026.1.3]** Вышел DeepTutor [v0.2.0](https://github.com/HKUDS/DeepTutor/releases/tag/v0.2.0) - спасибо всем участникам! ❤️
+> **[2026.1.18]** Релиз [v0.5.2](https://github.com/HKUDS/DeepTutor/releases/tag/v0.5.1) — улучшение RAG-пайплайна (поддержка Docling) и улучшения CI/CD с исправлением нескольких мелких ошибок — спасибо за отзывы!
-> **[2026.1.1]** С Новым годом! Присоединяйтесь к нашим [обсуждениям на GitHub](https://github.com/HKUDS/DeepTutor/discussions) — формируйте будущее DeepTutor! 💬
+> **[2026.1.1]** С Новым годом! Присоединяйтесь к нашему [Discord-сообществу](https://discord.gg/zpP9cssj), [WeChat-сообществу](https://github.com/HKUDS/DeepTutor/issues/78) или [Discussions](https://github.com/HKUDS/DeepTutor/discussions) — формируйте будущее DeepTutor! 💬
> **[2025.12.30]** Посетите наш [официальный сайт](https://hkuds.github.io/DeepTutor/) для получения дополнительной информации!
-> **[2025.12.29]** DeepTutor v0.1 уже в сети! ✨
+> **[2025.12.29]** DeepTutor уже в сети! ✨
---
## Ключевые особенности DeepTutor
@@ -247,24 +247,32 @@ cp .env.example .env
| Переменная | Обязательно | Описание |
|:---|:---:|:---|
| `LLM_MODEL` | **Да** | Имя модели (например: `gpt-4o`) |
+| `LLM_API_VERSION` | Нет | Версия API для Azure OpenAI (например: `2024-02-15-preview`) |
| `LLM_API_KEY` | **Да** | Ваш API ключ LLM |
| `LLM_HOST` | **Да** | URL конечной точки API |
| `EMBEDDING_MODEL` | **Да** | Имя модели встраивания |
+| `EMBEDDING_API_VERSION` | Нет | Версия API для Azure OpenAI Embeddings |
| `EMBEDDING_API_KEY` | **Да** | API ключ встраивания |
| `EMBEDDING_HOST` | **Да** | Конечная точка API встраивания |
| `BACKEND_PORT` | Нет | Порт backend (по умолчанию: `8001`) |
| `FRONTEND_PORT` | Нет | Порт frontend (по умолчанию: `3782`) |
+| `NEXT_PUBLIC_API_BASE` | Нет | **URL API для фронтенда** — установите для удаленного/LAN-доступа (например: `http://192.168.1.100:8001`) |
| `TTS_*` | Нет | Настройки синтеза речи |
| `SEARCH_PROVIDER` | Нет | Провайдер поиска (варианты: `perplexity`, `tavily`, `serper`, `jina`, `exa`, `baidu`, по умолчанию: `perplexity`) |
| `SEARCH_API_KEY` | Нет | Единый API-ключ для поиска |
+> 💡 **Удаленный доступ**: если вы заходите с другого устройства (например: `192.168.31.66:3782`), добавьте в `.env`:
+> ```bash
+> NEXT_PUBLIC_API_BASE=http://192.168.31.66:8001
+> ```
+
</details>
**③ Настроить Порты и LLM** *(Опционально)*
-- **Порты**: Отредактируйте `config/main.yaml` → `server.backend_port` / `server.frontend_port`
+- **Порты**: Настройте в `.env` → `BACKEND_PORT` / `FRONTEND_PORT` (по умолчанию: 8001/3782)
- **LLM**: Отредактируйте `config/agents.yaml` → `temperature` / `max_tokens` для каждого модуля
-- См. [Документацию по конфигурации](config/README.md) для подробностей
+- См. [Документацию по конфигурации](../../config/README.md) для подробностей
**④ Попробовать демо базы знаний** *(Опционально)*
@@ -306,18 +314,15 @@ cp .env.example .env
<summary><b>🚀 Вариант A: Предварительно Собранный Образ (Быстрее Всего)</b></summary>
```bash
-# Загрузить и запустить предварительно собранный образ (~30 секунд)
+# Работает на всех платформах — Docker автоматически определяет вашу архитектуру
docker run -d --name deeptutor \
-p 8001:8001 -p 3782:3782 \
- -e LLM_MODEL=gpt-4o \
- -e LLM_API_KEY=your-api-key \
- -e LLM_HOST=https://api.openai.com/v1 \
- -e EMBEDDING_MODEL=text-embedding-3-large \
- -e EMBEDDING_API_KEY=your-api-key \
- -e EMBEDDING_HOST=https://api.openai.com/v1 \
+ --env-file .env \
-v $(pwd)/data:/app/data \
-v $(pwd)/config:/app/config:ro \
ghcr.io/hkuds/deeptutor:latest
+
+# Windows PowerShell: используйте ${PWD} вместо $(pwd)
```
Или использовать файл `.env`:
@@ -1128,11 +1133,11 @@ asyncio.run(main())
**Контрольный список**
- Подтвердите версию Python >= 3.10
- Подтвердите установку всех зависимостей: `pip install -r requirements.txt`
-- Проверьте, используется ли порт 8001 (настраивается в `config/main.yaml`)
+- Проверьте, используется ли порт 8001
- Проверьте конфигурацию файла `.env`
**Решения**
-- **Изменить порт**: Отредактируйте `config/main.yaml` server.backend_port
+- **Изменить порт**: Установите `BACKEND_PORT=9001` в файле `.env`
- **Проверить логи**: Просмотрите сообщения об ошибках в терминале
</details>
@@ -1305,7 +1310,7 @@ python src/knowledge/extract_numbered_items.py --kb <kb_name> --base-dir ./data/
## 📄 Лицензия
-Этот проект лицензирован по **[Лицензии AGPL-3.0](LICENSE)**.
+Этот проект лицензирован по **[Лицензии AGPL-3.0](../../LICENSE)**.
<!--
## ⭐ История звезд
diff --git a/assets/releases/ver0-5-2.md b/assets/releases/ver0-5-2.md
new file mode 100644
index 000000000..3ea0b62dd
--- /dev/null
+++ b/assets/releases/ver0-5-2.md
@@ -0,0 +1,27 @@
+# DeepTutor v0.5.2 Release Notes
+
+**Release Date:** 2026.01.18
+
+## Highlights
+
+### Docling Support for RAG-Anything
+
+Added alternative RAG-Anything initialization using **Docling** as the document parser:
+- For users whose local environment is not suitable for MinerU
+- Provides a lightweight alternative for document processing
+- Same multimodal graph capabilities with different backend
+
+### Logging System Optimization
+
+Refactored the logging system for better management:
+- Improved log output control across all modules
+- Better structured logging adapters
+- Enhanced console, file, and WebSocket handlers
+
+### Bug Fixes & Code Improvements
+
+- Optimized code structure across multiple modules
+- Fixed several bugs affecting user experience
+- Improved CI/CD workflows with Python 3.10/3.11 matrix testing
+
+**Full Changelog**: https://github.com/HKUDS/DeepTutor/compare/v0.5.1...v0.5.2
\ No newline at end of file
diff --git a/assets/releases/ver0-6-0.md b/assets/releases/ver0-6-0.md
new file mode 100644
index 000000000..6a548f4e2
--- /dev/null
+++ b/assets/releases/ver0-6-0.md
@@ -0,0 +1,42 @@
+# DeepTutor v0.6.0 Release Notes
+
+**Release Date:** 2026.01.23
+
+## Highlights
+
+### Frontend State Persistence
+
+Implemented robust session persistence across the application:
+- Solver, Guide, and other sessions now persist across browser refreshes
+- Improved state management with dedicated persistence layer
+- Better user experience with session continuity
+
+### Incremental Document Upload
+
+Enhanced knowledge base with incremental document processing:
+- Add new documents to existing knowledge bases without full re-indexing
+- Significant performance improvement for large document collections
+- Smarter document change detection
+
+### Flexible RAG Pipeline Import
+
+Refactored RAG initialization for better compatibility:
+- On-demand loading of RAG libraries (RAG-Anything, LlamaIndex)
+- Reduced startup time and memory footprint
+- Graceful fallback when optional dependencies are unavailable
+
+### Full Chinese Localization (i18n)
+
+Added complete Chinese language support for the web interface:
+- Comprehensive translation across all pages and components
+- Dynamic language switching without page reload
+- i18n audit tools for translation consistency
+
+### Bug Fixes & Improvements
+
+- Enhanced LLM retry mechanism for complex agent operations
+- Fixed temperature parameter handling issues
+- Docker build optimizations and npm compatibility fixes
+- Added `api_version` parameter for Azure OpenAI support
+
+**Full Changelog**: https://github.com/HKUDS/DeepTutor/compare/v0.5.2...v0.6.0
diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts
index 79603ad77..87841f4ef 100644
--- a/docs/.vitepress/config.mts
+++ b/docs/.vitepress/config.mts
@@ -4,19 +4,16 @@ export default defineConfig({
title: "DeepTutor",
description: "AI-Powered Personalized Learning Assistant",
- // GitHub Pages 部署配置
base: '/DeepTutor/',
head: [
['link', { rel: 'icon', href: '/DeepTutor/logo.png' }]
],
- // 忽略 localhost 链接检查(这些是示例地址,构建时不可访问)
ignoreDeadLinks: [
/^http:\/\/localhost/
],
- // 国际化配置
locales: {
root: {
label: 'English',
@@ -24,18 +21,24 @@ export default defineConfig({
themeConfig: {
nav: [
{ text: 'Home', link: '/' },
- { text: 'Guide', link: '/guide/getting-started' },
- { text: 'Features', link: '/features/overview' },
- { text: 'Roadmap', link: '/roadmap' },
+ { text: 'Guide', link: '/guide/pre-config' },
+ { text: 'Contribute', link: '/contribution' },
{ text: 'GitHub', link: 'https://github.com/HKUDS/DeepTutor' }
],
sidebar: {
'/guide/': [
{
- text: 'Guide',
+ text: 'Getting Started',
+ items: [
+ { text: 'Pre-Configuration', link: '/guide/pre-config' },
+ { text: 'Data Preparation', link: '/guide/data-preparation' },
+ { text: 'Local Installation', link: '/guide/local-start' },
+ { text: 'Docker Deployment', link: '/guide/docker-start' }
+ ]
+ },
+ {
+ text: 'Resources',
items: [
- { text: 'Quick Start', link: '/guide/getting-started' },
- { text: 'Configuration', link: '/guide/configuration' },
{ text: 'Troubleshooting', link: '/guide/troubleshooting' }
]
}
@@ -58,18 +61,24 @@ export default defineConfig({
themeConfig: {
nav: [
{ text: '首页', link: '/zh/' },
- { text: '指南', link: '/zh/guide/getting-started' },
- { text: '功能', link: '/zh/features/overview' },
- { text: '路线图', link: '/zh/roadmap' },
+ { text: '指南', link: '/zh/guide/pre-config' },
+ { text: '参与贡献', link: '/zh/contribution' },
{ text: 'GitHub', link: 'https://github.com/HKUDS/DeepTutor' }
],
sidebar: {
'/zh/guide/': [
{
- text: '指南',
+ text: '快速开始',
+ items: [
+ { text: '预配置', link: '/zh/guide/pre-config' },
+ { text: '数据准备', link: '/zh/guide/data-preparation' },
+ { text: '本地安装', link: '/zh/guide/local-start' },
+ { text: 'Docker 部署', link: '/zh/guide/docker-start' }
+ ]
+ },
+ {
+ text: '资源',
items: [
- { text: '快速开始', link: '/zh/guide/getting-started' },
- { text: '配置说明', link: '/zh/guide/configuration' },
{ text: '常见问题', link: '/zh/guide/troubleshooting' }
]
}
@@ -83,17 +92,9 @@ export default defineConfig({
message: '基于 AGPL-3.0 许可证发布',
copyright: '© 2025-2026 香港大学数据智能实验室'
},
- // 中文界面文本
- outline: {
- label: '本页目录'
- },
- docFooter: {
- prev: '上一篇',
- next: '下一篇'
- },
- lastUpdated: {
- text: '最后更新于'
- },
+ outline: { label: '本页目录' },
+ docFooter: { prev: '上一篇', next: '下一篇' },
+ lastUpdated: { text: '最后更新于' },
darkModeSwitchLabel: '外观',
sidebarMenuLabel: '菜单',
returnToTopLabel: '返回顶部',
@@ -104,10 +105,9 @@ export default defineConfig({
themeConfig: {
logo: '/logo.png',
-
socialLinks: [
{ icon: 'github', link: 'https://github.com/HKUDS/DeepTutor' },
- { icon: 'discord', link: 'https://discord.gg/zpP9cssj' },
+ { icon: 'discord', link: 'https://discord.gg/eRsjPgMU4t' },
{
icon: {
svg: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M8.691 2.188C3.891 2.188 0 5.476 0 9.53c0 2.212 1.17 4.203 3.002 5.55a.59.59 0 0 1 .213.665l-.39 1.48c-.019.07-.048.141-.048.213 0 .163.13.295.29.295a.32.32 0 0 0 .167-.054l1.903-1.114a.864.864 0 0 1 .717-.098 10.16 10.16 0 0 0 2.837.403c.276 0 .543-.027.811-.05-.857-2.578.157-4.972 1.932-6.446 1.703-1.415 3.882-1.98 5.853-1.838-.576-3.583-4.196-6.348-8.596-6.348zM5.785 5.991c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 0 1-1.162 1.178A1.17 1.17 0 0 1 4.623 7.17c0-.651.52-1.18 1.162-1.18zm5.813 0c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 0 1-1.162 1.178 1.17 1.17 0 0 1-1.162-1.178c0-.651.52-1.18 1.162-1.18zm5.34 2.867c-1.797-.052-3.746.512-5.28 1.786-1.72 1.428-2.687 3.72-1.78 6.22.942 2.453 3.666 4.229 6.884 4.229.826 0 1.622-.12 2.361-.336a.722.722 0 0 1 .598.082l1.584.926a.272.272 0 0 0 .14.047c.134 0 .24-.111.24-.247 0-.06-.023-.12-.038-.177l-.327-1.233a.49.49 0 0 1 .176-.554C23.048 18.276 24 16.577 24 14.71c0-3.38-3.251-6.136-7.062-5.852zm-2.073 2.703c.536 0 .97.44.97.983a.976.976 0 0 1-.97.983.976.976 0 0 1-.97-.983c0-.542.434-.983.97-.983zm4.146 0c.536 0 .97.44.97.983a.976.976 0 0 1-.97.983.976.976 0 0 1-.97-.983c0-.542.434-.983.97-.983z"/></svg>'
@@ -116,9 +116,6 @@ export default defineConfig({
ariaLabel: 'WeChat'
}
],
-
- search: {
- provider: 'local'
- }
+ search: { provider: 'local' }
}
})
diff --git a/docs/contribution.md b/docs/contribution.md
new file mode 100644
index 000000000..695cbb369
--- /dev/null
+++ b/docs/contribution.md
@@ -0,0 +1,104 @@
+# Make Contribution
+
+We hope DeepTutor could become a gift for the community. 🎁
+
+## Join Our Community
+
+<div class="community-links">
+ <a href="https://github.com/HKUDS/DeepTutor/issues/78" class="community-badge wechat">
+ 💬 WeChat Community
+ </a>
+ <a href="https://github.com/HKUDS/DeepTutor/issues/167" class="community-badge wechat-collab">
+ 🤝 WeChat Co-creators
+ </a>
+ <a href="https://discord.gg/eRsjPgMU4t" class="community-badge discord">
+ 🌐 Discord
+ </a>
+</div>
+
+## We Welcome Contributions!
+
+Whether you're fixing bugs, improving documentation, or adding new features, your contributions are valuable to us.
+
+### How to Contribute
+
+1. **Report Bugs** — Found a bug? Open an issue on GitHub with reproduction steps
+2. **Suggest Features** — Share ideas in GitHub Discussions or our community channels
+3. **Improve Docs** — Help us improve documentation, tutorials, and examples
+4. **Submit Code** — Fix bugs or implement new features through pull requests
+
+### Contribution Guidelines
+
+For detailed guidelines, see [CONTRIBUTING.md](https://github.com/HKUDS/DeepTutor/blob/dev/CONTRIBUTING.md).
+
+**Key Points:**
+
+- All contributions must be based on the `dev` branch
+- Run `pre-commit run --all-files` before submitting
+- Use conventional commit format: `feat:`, `fix:`, `docs:`, etc.
+
+### Quick Start
+
+```bash
+# Fork and clone
+git clone https://github.com/YOUR_USERNAME/DeepTutor.git
+cd DeepTutor
+
+# Create feature branch from dev
+git checkout dev && git pull origin dev
+git checkout -b feature/your-feature-name
+
+# Install pre-commit hooks
+pip install pre-commit && pre-commit install
+
+# Make changes, then submit PR to dev branch
+```
+
+## Our Contributors
+
+<a href="https://github.com/HKUDS/DeepTutor/graphs/contributors">
+ <img src="https://contrib.rocks/image?repo=HKUDS/DeepTutor&max=999" alt="Contributors" />
+</a>
+
+---
+
+Thank you for your interest in contributing to DeepTutor! 🚀
+
+<style>
+.community-links {
+ display: flex;
+ gap: 12px;
+ flex-wrap: wrap;
+ margin: 20px 0;
+}
+
+.community-badge {
+ display: inline-flex;
+ align-items: center;
+ padding: 10px 18px;
+ border-radius: 8px;
+ font-weight: 500;
+ font-size: 0.95rem;
+ text-decoration: none;
+ transition: all 0.2s ease;
+}
+
+.community-badge:hover {
+ transform: translateY(-2px);
+}
+
+.community-badge.wechat {
+ background: #07C160;
+ color: white;
+}
+
+.community-badge.wechat-collab {
+ background: #1AAD19;
+ color: white;
+}
+
+.community-badge.discord {
+ background: #5865F2;
+ color: white;
+}
+</style>
diff --git a/docs/guide/configuration.md b/docs/guide/configuration.md
deleted file mode 100644
index f459c0b60..000000000
--- a/docs/guide/configuration.md
+++ /dev/null
@@ -1,232 +0,0 @@
-# Configuration
-
-DeepTutor uses YAML configuration files and environment variables for easy customization.
-
-## 📁 Configuration Files
-
-```
-config/
-├── main.yaml # Main system configuration (paths, tools, module settings)
-├── agents.yaml # Unified agent parameters (temperature, max_tokens)
-└── README.md # Full documentation
-```
-
-| File | Purpose |
-|:-----|:--------|
-| `.env` | API keys, server ports, and service configuration |
-| `config/agents.yaml` | LLM parameters for each agent module |
-| `config/main.yaml` | Paths, tools, module settings |
-
-## 🔧 Server Configuration
-
-Server ports are configured in `.env` file:
-
-```bash
-# Server ports (defaults: 8001/3782)
-BACKEND_PORT=8001
-FRONTEND_PORT=3782
-
-# Remote access
-NEXT_PUBLIC_API_BASE=http://your-server-ip:8001
-
-# Web search (unified API key)
-SEARCH_PROVIDER=perplexity # Options: perplexity, tavily, serper, jina, exa, baidu
-SEARCH_API_KEY=your_search_api_key
-
-# TTS
-TTS_MODEL=
-TTS_URL=
-TTS_API_KEY=
-```
-
-### ☁️ Azure OpenAI Configuration
-
-When using Azure OpenAI, you must set the `LLM_API_VERSION` and provide the correct endpoint URL including the deployment name.
-
-```bash
-LLM_BINDING=azure_openai
-LLM_MODEL=gpt-4o # Your Azure deployment name
-LLM_HOST=https://{your-resource}.openai.azure.com/openai/deployments/{deployment-id}
-LLM_API_KEY=your_azure_api_key
-LLM_API_VERSION=2024-02-15-preview # Required for Azure
-```
-
-Similarly for embeddings:
-
-```bash
-EMBEDDING_BINDING=azure_openai
-EMBEDDING_MODEL=text-embedding-3-large # Your Azure deployment name
-EMBEDDING_HOST=https://{your-resource}.openai.azure.com/openai/deployments/{deployment-id}
-EMBEDDING_API_KEY=your_azure_api_key
-EMBEDDING_API_VERSION=2024-02-15-preview
-```
-
-## Agent Parameters
-
-Edit `config/agents.yaml`:
-
-```yaml
-# Solve Module - Problem solving agents
-solve:
- temperature: 0.3
- max_tokens: 8192
-
-# Research Module - Deep research agents
-research:
- temperature: 0.5
- max_tokens: 12000
-
-# Question Module - Question generation agents
-question:
- temperature: 0.7
- max_tokens: 4096
-
-# Guide Module - Learning guidance agents
-guide:
- temperature: 0.5
- max_tokens: 8192
-
-# IdeaGen Module - Idea generation agents
-ideagen:
- temperature: 0.7
- max_tokens: 4096
-
-# CoWriter Module - Collaborative writing agents
-co_writer:
- temperature: 0.7
- max_tokens: 4096
-```
-
-## 🔑 Environment Variables
-
-Create a `.env` file based on `.env.example`:
-
-```bash
-# ============================================================================
-# Server Configuration
-# ============================================================================
-BACKEND_PORT=8001 # Backend API port
-FRONTEND_PORT=3782 # Frontend web port
-
-# For remote/LAN access - set to your server's IP address
-# Example: http://192.168.1.100:8001 (if not set, defaults to localhost)
-# NEXT_PUBLIC_API_BASE=http://your-server-ip:8001
-
-# ============================================================================
-# LLM (Large Language Model) Configuration - Required
-# ============================================================================
-LLM_BINDING=openai # Provider type (see supported list below)
-LLM_MODEL=gpt-4o # e.g., gpt-4o, deepseek-chat, qwen-plus
-LLM_HOST=https://api.openai.com/v1
-LLM_API_KEY=your_api_key
-DISABLE_SSL_VERIFY=false # Set true for self-signed certificates
-
-# ============================================================================
-# Embedding Model Configuration - Required for Knowledge Base
-# ============================================================================
-EMBEDDING_BINDING=openai # Provider type (see supported list below)
-EMBEDDING_MODEL=text-embedding-3-large # e.g., text-embedding-3-large, nomic-embed-text
-EMBEDDING_DIMENSION=3072 # Important! Must match model dimensions
-EMBEDDING_HOST=https://api.openai.com/v1
-EMBEDDING_API_KEY=your_api_key
-
-# ============================================================================
-# Web Search Configuration - Optional
-# ============================================================================
-SEARCH_PROVIDER=perplexity # Options: perplexity, tavily, serper, jina, exa, baidu
-SEARCH_API_KEY=your_search_api_key # Unified API key for all search providers
-
-# ============================================================================
-# TTS (Text-to-Speech) Configuration - Optional
-# ============================================================================
-TTS_MODEL=
-TTS_URL=
-TTS_API_KEY=
-```
-
-## 🤗 HuggingFace / MinerU (Optional, for offline or mirrored networks)
-
-If your environment cannot access `huggingface.co` directly (common in restricted networks), MinerU may fail when it tries to download models from the HuggingFace Hub. DeepTutor reads your root `.env` (Docker Compose uses `env_file: .env`), so you can **optionally** add the following variables:
-
-```bash
-# ============================================================================
-# HuggingFace Hub / MinerU - Optional
-# ============================================================================
-# Use a HuggingFace mirror endpoint (if you have one)
-# HF_ENDPOINT=https://your-hf-mirror.example.com
-
-# Persist/cache directory (inside container). For Docker, consider mounting this path.
-# HF_HOME=/app/data/hf
-
-# Force offline mode (requires models already cached locally)
-# HF_HUB_OFFLINE=1
-```
-
-## 🔌 Supported Providers
-
-### LLM Providers
-
-| Provider | `LLM_BINDING` Value | Notes |
-|:---------|:--------------------|:------|
-| OpenAI | `openai` | GPT-4o, GPT-4, GPT-3.5, etc. |
-| Anthropic | `anthropic` | Claude 3.5, Claude 3, etc. |
-| Azure OpenAI | `azure_openai` | Enterprise deployments |
-| Ollama | `ollama` | Local models (auto adds `/v1` suffix) |
-| Groq | `groq` | Fast inference |
-| OpenRouter | `openrouter` | Multi-model gateway |
-| DeepSeek | `deepseek` | DeepSeek-V3, DeepSeek-R1 |
-| Google Gemini | `gemini` | OpenAI-compatible mode |
-
-### Embedding Providers
-
-| Provider | `EMBEDDING_BINDING` Value | Notes |
-|:---------|:--------------------------|:------|
-| OpenAI | `openai` | text-embedding-3-large/small |
-| Azure OpenAI | `azure_openai` | Enterprise deployments |
-| Jina AI | `jina` | jina-embeddings-v3 |
-| Cohere | `cohere` | embed-v3 series |
-| Ollama | `ollama` | Local embedding models |
-| LM Studio | `lm_studio` | Local inference server |
-| HuggingFace | `huggingface` | OpenAI-compatible endpoints |
-
-> **Note**: Ensure that `EMBEDDING_DIMENSION` matches your embedding model's output dimensions. The RAG module uses RAG-Anything—see [the repository](https://github.com/HKUDS/RAG-Anything) for details.
-
-## 🛠️ Tool Configuration
-
-Configure tool availability in `config/main.yaml`:
-
-```yaml
-tools:
- rag_tool:
- kb_base_dir: ./data/knowledge_bases
- default_kb: ai_textbook
- run_code:
- workspace: ./data/user/run_code_workspace
- web_search:
- enabled: true # Global switch for web search
- query_item:
- enabled: true
- max_results: 5
-```
-
-## 📂 Data Storage
-
-All user content and system data are stored in the `data/` directory:
-
-```
-data/
-├── knowledge_bases/ # Knowledge base storage
-└── user/ # User activity data
- ├── solve/ # Problem solving results
- ├── question/ # Generated questions
- ├── research/ # Research reports and cache
- ├── co_writer/ # Interactive IdeaGen documents
- ├── notebook/ # Notebook records
- ├── guide/ # Guided learning sessions
- ├── logs/ # System logs
- └── run_code_workspace/ # Code execution workspace
-```
-
-## 🔗 Advanced Configuration
-
-For the full configuration reference, see [config/README.md](https://github.com/HKUDS/DeepTutor/tree/main/config).
diff --git a/docs/guide/data-preparation.md b/docs/guide/data-preparation.md
new file mode 100644
index 000000000..7b502b06d
--- /dev/null
+++ b/docs/guide/data-preparation.md
@@ -0,0 +1,185 @@
+# Data Preparation
+
+DeepTutor provides demo knowledge bases and sample questions to help you get started quickly.
+
+## Demo Knowledge Bases
+
+We provide two pre-built knowledge bases on [Google Drive](https://drive.google.com/drive/folders/1iWwfZXiTuQKQqUYb5fGDZjLCeTUP6DA6?usp=sharing):
+
+### 1. Research Papers Collection
+
+<div class="info-card">
+ <div class="info-header">
+ <span class="info-icon">📄</span>
+ <span class="info-title">5 Research Papers (20-50 pages each)</span>
+ </div>
+ <div class="info-content">
+ <p>A curated collection of cutting-edge research papers from our lab, covering RAG and Agent fields.</p>
+ <p><strong>Included Papers:</strong></p>
+ <ul>
+ <li><a href="https://github.com/HKUDS/AI-Researcher">AI-Researcher</a> - Automated research paper generation</li>
+ <li><a href="https://github.com/HKUDS/AutoAgent">AutoAgent</a> - Autonomous agent framework</li>
+ <li><a href="https://github.com/HKUDS/RAG-Anything">RAG-Anything</a> - Multimodal RAG system</li>
+ <li><a href="https://github.com/HKUDS/LightRAG">LightRAG</a> - Simple and fast RAG</li>
+ <li><a href="https://github.com/HKUDS/VideoRAG">VideoRAG</a> - Video understanding with RAG</li>
+ </ul>
+ <p><strong>Best for:</strong> Research scenarios, broad knowledge coverage</p>
+ </div>
+</div>
+
+### 2. Data Science Textbook
+
+<div class="info-card">
+ <div class="info-header">
+ <span class="info-icon">📚</span>
+ <span class="info-title">8 Chapters, 296 Pages</span>
+ </div>
+ <div class="info-content">
+ <p>A comprehensive deep learning textbook from UC Berkeley.</p>
+ <p><strong>Source:</strong> <a href="https://ma-lab-berkeley.github.io/deep-representation-learning-book/">Deep Representation Learning Book</a></p>
+ <p><strong>Topics Covered:</strong></p>
+ <ul>
+ <li>Neural Network Fundamentals</li>
+ <li>Representation Learning</li>
+ <li>Deep Learning Architectures</li>
+ <li>Advanced Topics</li>
+ </ul>
+ <p><strong>Best for:</strong> Learning scenarios, deep knowledge depth</p>
+ </div>
+</div>
+
+## Download & Setup
+
+### Step 1: Download
+
+Visit our [Google Drive folder](https://drive.google.com/drive/folders/1iWwfZXiTuQKQqUYb5fGDZjLCeTUP6DA6?usp=sharing) and download:
+
+- `knowledge_bases.zip` - Pre-built knowledge bases with embeddings
+- `questions.zip` - Sample questions and usage examples (optional)
+
+### Step 2: Extract
+
+Extract the downloaded files into the `data/` directory:
+
+```
+DeepTutor/
+├── data/
+│ └── knowledge_bases/
+│ ├── research_papers/ # Research papers KB
+│ ├── data_science_book/ # Textbook KB
+│ └── kb_config.json # Knowledge base config
+└── user/ # User data (auto-created)
+```
+
+### Step 3: Verify
+
+After extracting, your knowledge bases will be automatically available when you start DeepTutor.
+
+::: warning Embedding Compatibility
+Our demo knowledge bases use `text-embedding-3-large` with `dimensions = 3072`.
+
+If your embedding model has different dimensions, you'll need to create your own knowledge base instead.
+:::
+
+## Creating Custom Knowledge Bases
+
+### Supported File Formats
+
+| Format | Extension | Notes |
+|:-------|:----------|:------|
+| PDF | `.pdf` | Supports text extraction and layout analysis |
+| Text | `.txt` | Plain text files |
+| Markdown | `.md` | Markdown with formatting support |
+
+### Via Web Interface
+
+1. Navigate to `http://localhost:3782/knowledge`
+2. Click **"New Knowledge Base"**
+3. Enter a unique name for your knowledge base
+4. Upload your documents (single or batch upload)
+5. Wait for processing to complete
+
+::: tip Processing Time
+- Small documents (< 10 pages): ~1 minute
+- Medium documents (10-100 pages): ~5-10 minutes
+- Large documents (100+ pages): May take longer
+:::
+
+### Via Command Line
+
+```bash
+# Initialize a new knowledge base with documents
+python -m src.knowledge.start_kb init <kb_name> --docs <pdf_path>
+
+# Add documents to existing knowledge base
+python -m src.knowledge.add_documents <kb_name> --docs <new_document.pdf>
+```
+
+## Data Storage Structure
+
+All user data is stored in the `data/` directory:
+
+```
+data/
+├── knowledge_bases/ # Knowledge base storage
+│ ├── <kb_name>/
+│ │ ├── documents/ # Original documents
+│ │ ├── chunks/ # Chunked content
+│ │ ├── embeddings/ # Vector embeddings
+│ │ └── graph/ # Knowledge graph data
+└── user/ # User activity data
+ ├── solve/ # Problem solving results
+ ├── question/ # Generated questions
+ ├── research/ # Research reports
+ ├── notebook/ # Notebook records
+ └── logs/ # System logs
+```
+
+---
+
+**Next Step:** [Local Installation →](/guide/local-start)
+
+<style>
+.info-card {
+ background: var(--vp-c-bg-soft);
+ border: 1px solid var(--vp-c-border);
+ border-radius: 12px;
+ padding: 20px;
+ margin: 16px 0;
+}
+
+.info-header {
+ display: flex;
+ align-items: center;
+ gap: 12px;
+ margin-bottom: 16px;
+}
+
+.info-icon {
+ font-size: 1.5rem;
+}
+
+.info-title {
+ font-size: 1.1rem;
+ font-weight: 600;
+ color: var(--vp-c-text-1);
+}
+
+.info-content {
+ color: var(--vp-c-text-2);
+ line-height: 1.7;
+}
+
+.info-content ul {
+ margin: 12px 0;
+ padding-left: 20px;
+}
+
+.info-content li {
+ margin: 6px 0;
+}
+
+.info-content a {
+ color: var(--vp-c-brand-1);
+}
+</style>
diff --git a/docs/guide/docker-start.md b/docs/guide/docker-start.md
new file mode 100644
index 000000000..f15a1b55b
--- /dev/null
+++ b/docs/guide/docker-start.md
@@ -0,0 +1,259 @@
+# Docker Deployment
+
+Docker deployment requires no Python or Node.js setup — everything runs in containers.
+
+## Prerequisites
+
+- **Docker** — [Install Docker](https://docs.docker.com/get-docker/)
+- **Docker Compose** — [Install Docker Compose](https://docs.docker.com/compose/install/)
+
+## Quick Start Options
+
+Choose your preferred deployment method:
+
+<div class="method-tabs">
+
+### Option A: Build from Source
+
+Build and run DeepTutor locally from the source code.
+
+```bash
+# Clone repository (if not done)
+git clone https://github.com/HKUDS/DeepTutor.git
+cd DeepTutor
+
+# Create and configure .env file
+cp .env.example .env
+# Edit .env with your API keys
+
+# Build and start
+docker compose up
+
+# First run takes ~11 minutes on Mac Mini M4
+```
+
+#### Common Commands
+
+```bash
+# Start in background
+docker compose up -d
+
+# Stop services
+docker compose down
+
+# View logs
+docker compose logs -f
+
+# Rebuild after code changes
+docker compose up --build
+
+# Clear cache and rebuild
+docker compose build --no-cache
+```
+
+</div>
+
+<div class="method-tabs">
+
+### Option B: Pull Pre-built Image (Faster)
+
+Use our official pre-built images from GitHub Container Registry.
+
+```bash
+# Works on all platforms - Docker auto-detects your architecture
+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
+```
+
+::: warning Windows PowerShell
+Use `${PWD}` instead of `$(pwd)`:
+
+```powershell
+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
+```
+:::
+
+</div>
+
+## Available Image Tags
+
+| Tag | Architectures | Description |
+|:----|:--------------|:------------|
+| `:latest` | AMD64 + ARM64 | Latest stable release (auto-detects architecture) |
+| `:v0.5.x` | AMD64 + ARM64 | Specific version (auto-detects architecture) |
+| `:v0.5.x-amd64` | AMD64 only | Explicit AMD64 image |
+| `:v0.5.x-arm64` | ARM64 only | Explicit ARM64 image |
+
+::: tip Multi-Architecture Support
+The `:latest` tag is a **multi-architecture image** — Docker automatically pulls the correct version for your system (Intel/AMD or Apple Silicon/ARM).
+:::
+
+## Cloud Deployment
+
+When deploying to a cloud server, you must set the external API URL:
+
+```bash
+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
+```
+
+::: warning Why is this needed?
+The default API URL is `localhost:8001`, which points to the user's local machine in the browser, not your server. Setting `NEXT_PUBLIC_API_BASE_EXTERNAL` ensures the frontend connects to your server's public address.
+:::
+
+## Custom Ports
+
+To use different ports:
+
+```bash
+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 \
+ --env-file .env \
+ -v $(pwd)/data:/app/data \
+ ghcr.io/hkuds/deeptutor:latest
+```
+
+::: warning Important
+The `-p` port mapping must match the `BACKEND_PORT`/`FRONTEND_PORT` values.
+:::
+
+## Access URLs
+
+| Service | URL | Description |
+|:---:|:---|:---|
+| **Frontend** | http://localhost:3782 | Main web interface |
+| **API Docs** | http://localhost:8001/docs | Interactive API documentation |
+
+## Container Management
+
+### View Running Containers
+
+```bash
+docker ps
+```
+
+### Stop Container
+
+```bash
+docker stop deeptutor
+```
+
+### Remove Container
+
+```bash
+docker rm deeptutor
+```
+
+### View Logs
+
+```bash
+# All logs
+docker logs deeptutor
+
+# Follow logs in real-time
+docker logs -f deeptutor
+
+# Last 100 lines
+docker logs --tail 100 deeptutor
+```
+
+## Troubleshooting
+
+### Frontend cannot connect in cloud deployment
+
+**Problem:** Frontend shows "Failed to fetch" or "NEXT_PUBLIC_API_BASE is not configured"
+
+**Solution:** Set `NEXT_PUBLIC_API_BASE_EXTERNAL` to your server's public URL:
+
+```bash
+-e NEXT_PUBLIC_API_BASE_EXTERNAL=https://your-server.com:8001
+```
+
+### Settings page shows "Error loading data" with HTTPS reverse proxy
+
+**Problem:** HTTPS requests are being redirected to HTTP (307 redirect)
+
+**Solution:** This issue has been fixed in v0.5.0+. Update to the latest version.
+
+**nginx Configuration:**
+
+```nginx
+# Frontend
+location / {
+ proxy_pass http://localhost:3782;
+ proxy_set_header Host $host;
+ proxy_set_header X-Forwarded-Proto $scheme;
+}
+
+# Backend API
+location /api/ {
+ proxy_pass http://localhost:8001;
+ proxy_set_header Host $host;
+ proxy_set_header X-Forwarded-Proto $scheme;
+}
+
+# WebSocket support
+location /api/v1/ {
+ proxy_pass http://localhost:8001;
+ proxy_http_version 1.1;
+ proxy_set_header Upgrade $http_upgrade;
+ proxy_set_header Connection "upgrade";
+ proxy_set_header X-Forwarded-Proto $scheme;
+}
+```
+
+### Data not persisting after restart
+
+**Solution:** Ensure you're mounting the data directory:
+
+```bash
+-v $(pwd)/data:/app/data
+```
+
+### HuggingFace models fail to download (restricted networks)
+
+**Solution:** Add HuggingFace configuration to your `.env`:
+
+```bash
+# Use a mirror endpoint
+HF_ENDPOINT=https://your-hf-mirror.example.com
+
+# Or force offline mode (requires pre-cached models)
+HF_HUB_OFFLINE=1
+```
+
+---
+
+**Next Step:** [Make Contribution →](/contribution)
+
+<style>
+.method-tabs {
+ background: var(--vp-c-bg-soft);
+ border: 1px solid var(--vp-c-border);
+ border-radius: 12px;
+ padding: 20px;
+ margin: 16px 0;
+}
+
+.method-tabs h3 {
+ margin-top: 0;
+ padding-top: 0;
+ border-top: none;
+}
+</style>
diff --git a/docs/guide/getting-started.md b/docs/guide/getting-started.md
deleted file mode 100644
index 8ac42f98b..000000000
--- a/docs/guide/getting-started.md
+++ /dev/null
@@ -1,149 +0,0 @@
-# Quick Start
-
-Get DeepTutor running in under 5 minutes.
-
-## Prerequisites
-
-- Python 3.10+
-- Node.js 18+
-- An LLM API key (OpenAI, Anthropic, DeepSeek, etc.)
-
-## Installation
-
-::: code-group
-
-```bash [Quick Install]
-# Clone and setup
-git clone https://github.com/HKUDS/DeepTutor.git
-cd DeepTutor
-
-## Step 1: Set Up Virtual Environment (Choose One Option)
-
-# Option A: Using conda (Recommended)
-conda create -n aitutor python=3.10
-conda activate aitutor
-
-# Option B: Using venv
-python -m venv venv
-# On Windows:
-venv\Scripts\activate
-# On macOS/Linux:
-source venv/bin/activate
-```
-
-## Step 2: Install Dependencies
-
-Run the automated installation script to install all required dependencies:
-
-```bash
-# Recommended: Automated Installation
-bash scripts/install_all.sh
-
-# Alternative: Manual Installation
-python scripts/install_all.py
-
-# Or Install Dependencies Manually
-pip install -r requirements.txt
-npm install
-```
-
-## Step 3: Set Up Environment Variables
-
-Create a `.env` file in the project root directory based on `.env.example`:
-
-```bash
-# Copy from .env.example template (if exists)
-cp .env.example .env
-
-# Then edit .env file with your API keys
-```
-
-## Step 4: Configure Ports and LLM Settings *(Optional)*
-
-By default, the application uses:
-- **Backend (FastAPI)**: `8001`
-- **Frontend (Next.js)**: `3782`
-
-You can modify these ports in your `.env` file:
-
-```bash
-BACKEND_PORT=8001
-FRONTEND_PORT=3782
-
-# For remote/LAN access, set your server's IP address:
-# NEXT_PUBLIC_API_BASE=http://192.168.1.100:8001
-```
-
-**LLM Configuration**: Agent settings for `temperature` and `max_tokens` are centralized in `config/agents.yaml`. Each module (guide, solve, research, question, ideagen, co_writer) has customizable parameters. See [Configuration](/guide/configuration) for details.
-
-## Step 5: Try Our Demos *(Optional)*
-
-Experience the system quickly with two pre-built knowledge bases and a collection of challenging questions with usage examples.
-
-<details>
-<summary><b>Research Papers Collection</b> — 5 papers (20-50 pages each)</summary>
-
-A curated collection of 5 research papers from our lab covering RAG and Agent fields. This demo showcases broad knowledge coverage for research scenarios.
-
-**Used Papers**: [AI-Researcher](https://github.com/HKUDS/AI-Researcher) | [AutoAgent](https://github.com/HKUDS/AutoAgent) | [RAG-Anything](https://github.com/HKUDS/RAG-Anything) | [LightRAG](https://github.com/HKUDS/LightRAG) | [VideoRAG](https://github.com/HKUDS/VideoRAG)
-
-</details>
-
-<details>
-<summary><b>Data Science Textbook</b> — 8 chapters, 296 pages</summary>
-
-A comprehensive data science textbook with challenging content. This demo showcases **deep knowledge depth** for learning scenarios.
-
-**Book Link**: [Deep Representation Learning Book](https://ma-lab-berkeley.github.io/deep-representation-learning-book/)
-</details>
-
-**Download and Setup:**
-
-1. Download the demo package: [Google Drive](https://drive.google.com/drive/folders/1iWwfZXiTuQKQqUYb5fGDZjLCeTUP6DA6?usp=sharing)
-2. Extract the compressed files directly into the `data/` directory
-3. Knowledge bases will be automatically available once you start the system
-
-> **Note:** Our **demo knowledge bases** use `text-embedding-3-large` with `dimensions = 3072`. Ensure your embeddings model has matching dimensions (3072) for compatibility.
-
-## Step 6: Launch the Application
-
-```bash
-# Activate virtual environment
-conda activate aitutor # or: source venv/bin/activate
-
-# Start web interface (frontend + backend)
-python scripts/start_web.py
-
-# Alternative: CLI interface only
-python scripts/start.py
-
-# Stop the service: Ctrl+C
-```
-
-## Step 7: Create Your Own Knowledge Base
-
-Create custom knowledge bases through the web interface with support for multiple file formats.
-
-1. **Access Knowledge Base**: Navigate to `http://localhost:3782/knowledge`
-2. **Create New Base**: Click "New Knowledge Base"
-3. **Configure Settings**: Enter a unique name for your knowledge base
-4. **Upload Content**: Add single or multiple files for batch processing
-5. **Monitor Progress**: Track processing status in the terminal running `start_web.py`
- - Large files may take several minutes to complete
- - Knowledge base becomes available once processing finishes
-
-> **Tips:** Large files may require several minutes to process. Multiple files can be uploaded simultaneously for efficient batch processing.
-
-## Access URLs
-
-| Service | URL | Description |
-|:---:|:---|:---|
-| **Frontend** | `http://localhost:3782` | Main web interface |
-| **API Docs** | `http://localhost:8001/docs` | Interactive API documentation |
-| **Health** | `http://localhost:8001/api/v1/knowledge/health` | System health check |
-
-## Next Steps
-
-- [Configuration →](/guide/configuration)
-- [Troubleshooting →](/guide/troubleshooting)
-- [Full Installation Guide →](https://github.com/HKUDS/DeepTutor#-getting-started)
diff --git a/docs/guide/local-start.md b/docs/guide/local-start.md
new file mode 100644
index 000000000..e015eec86
--- /dev/null
+++ b/docs/guide/local-start.md
@@ -0,0 +1,190 @@
+# Local Installation
+
+This guide covers manual installation for development or non-Docker environments.
+
+## Prerequisites
+
+- **Python 3.10+** — [Download](https://www.python.org/downloads/)
+- **Node.js 18+** — [Download](https://nodejs.org/)
+- **Git** — [Download](https://git-scm.com/)
+
+::: tip Windows Users
+If you encounter path length errors during installation, enable long path support:
+
+```cmd
+reg add "HKLM\SYSTEM\CurrentControlSet\Control\FileSystem" /v LongPathsEnabled /t REG_DWORD /d 1 /f
+```
+
+Restart your terminal after running this command.
+:::
+
+## Step 1: Set Up Virtual Environment
+
+Choose one of the following options:
+
+::: code-group
+
+```bash [Conda (Recommended)]
+# Create environment
+conda create -n deeptutor python=3.10
+
+# Activate environment
+conda activate deeptutor
+```
+
+```bash [venv]
+# Create environment
+python -m venv venv
+
+# Activate (Windows)
+venv\Scripts\activate
+
+# Activate (macOS/Linux)
+source venv/bin/activate
+```
+
+:::
+
+## Step 2: Install Dependencies
+
+### Option A: Automated Installation (Recommended)
+
+```bash
+# Using Python script
+python scripts/install_all.py
+
+# Or using shell script (macOS/Linux)
+bash scripts/install_all.sh
+```
+
+### Option B: Manual Installation
+
+```bash
+# Install Python dependencies
+pip install -r requirements.txt
+
+# Install Node.js dependencies
+npm install --prefix web
+```
+
+::: warning Common Issues
+If you see `npm: command not found`:
+
+```bash
+# Using Conda
+conda install -c conda-forge nodejs
+
+# Or install from https://nodejs.org/
+```
+:::
+
+## Step 3: Configure Environment
+
+Make sure you have completed the [Pre-Configuration](/guide/pre-config) steps:
+
+1. ✅ Created `.env` file with your API keys
+2. ✅ (Optional) Customized `config/agents.yaml`
+3. ✅ (Optional) Downloaded demo knowledge bases
+
+## Step 4: Launch Application
+
+### Start Web Interface (Recommended)
+
+```bash
+python scripts/start_web.py
+```
+
+This starts both the **frontend** (Next.js) and **backend** (FastAPI) servers.
+
+### Alternative: CLI Interface Only
+
+```bash
+python scripts/start.py
+```
+
+### Access URLs
+
+| Service | URL | Description |
+|:---:|:---|:---|
+| **Frontend** | http://localhost:3782 | Main web interface |
+| **API Docs** | http://localhost:8001/docs | Interactive API documentation |
+
+## Advanced: Start Services Separately
+
+For development, you may want to run frontend and backend separately:
+
+### Backend (FastAPI)
+
+```bash
+python src/api/run_server.py
+
+# Or with uvicorn directly
+uvicorn src.api.main:app --host 0.0.0.0 --port 8001 --reload
+```
+
+### Frontend (Next.js)
+
+First, create `web/.env.local`:
+
+```bash
+NEXT_PUBLIC_API_BASE=http://localhost:8001
+```
+
+Then start the development server:
+
+```bash
+cd web
+npm install
+npm run dev -- -p 3782
+```
+
+## Stopping the Service
+
+Press `Ctrl+C` in the terminal to stop the service.
+
+::: warning Port Still in Use?
+If you see "port already in use" after pressing Ctrl+C:
+
+**macOS/Linux:**
+```bash
+lsof -i :8001
+kill -9 <PID>
+```
+
+**Windows:**
+```bash
+netstat -ano | findstr :8001
+taskkill /PID <PID> /F
+```
+:::
+
+## Troubleshooting
+
+### Backend fails to start
+
+**Checklist:**
+- Confirm Python version >= 3.10: `python --version`
+- Confirm all dependencies installed: `pip install -r requirements.txt`
+- Check if port 8001 is in use
+- Verify `.env` file configuration
+
+### Frontend cannot connect to backend
+
+**Solutions:**
+1. Confirm backend is running: visit http://localhost:8001/docs
+2. Check browser console for error messages
+3. Create `web/.env.local` with:
+ ```bash
+ NEXT_PUBLIC_API_BASE=http://localhost:8001
+ ```
+
+### WebSocket connection fails
+
+**Checklist:**
+- Confirm backend is running
+- Check firewall settings
+- Verify WebSocket URL format: `ws://localhost:8001/api/v1/...`
+
+---
+
+**Next Step:** [Docker Deployment →](/guide/docker-start)
diff --git a/docs/guide/pre-config.md b/docs/guide/pre-config.md
new file mode 100644
index 000000000..4056263c6
--- /dev/null
+++ b/docs/guide/pre-config.md
@@ -0,0 +1,201 @@
+# Pre-Configuration
+
+Before starting DeepTutor, you need to complete the following setup steps.
+
+## 1. Clone Repository
+
+```bash
+git clone https://github.com/HKUDS/DeepTutor.git
+cd DeepTutor
+```
+
+## 2. Environment Variables Setup
+
+Create your `.env` file from the template:
+
+```bash
+cp .env.example .env
+```
+
+Then edit the `.env` file with your API keys:
+
+```bash
+# ============================================================================
+# Server Configuration
+# ============================================================================
+BACKEND_PORT=8001 # Backend API port
+FRONTEND_PORT=3782 # Frontend web port
+
+# For remote/LAN access - set to your server's IP address
+# NEXT_PUBLIC_API_BASE=http://192.168.1.100:8001
+
+# ============================================================================
+# LLM (Large Language Model) Configuration - Required
+# ============================================================================
+LLM_BINDING=openai # Provider: openai, anthropic, azure_openai, ollama, etc.
+LLM_MODEL=gpt-4o # Model name: gpt-4o, deepseek-chat, claude-3-5-sonnet, etc.
+LLM_HOST=https://api.openai.com/v1 # API endpoint URL
+LLM_API_KEY=your_api_key # Your LLM API key
+
+# ============================================================================
+# Embedding Model Configuration - Required for Knowledge Base
+# ============================================================================
+EMBEDDING_BINDING=openai # Provider type
+EMBEDDING_MODEL=text-embedding-3-large # Embedding model name
+EMBEDDING_DIMENSION=3072 # Must match model dimensions
+EMBEDDING_HOST=https://api.openai.com/v1 # API endpoint
+EMBEDDING_API_KEY=your_api_key # Embedding API key
+
+# ============================================================================
+# Web Search Configuration - Optional
+# ============================================================================
+SEARCH_PROVIDER=perplexity # Options: perplexity, tavily, serper, jina, exa, baidu
+SEARCH_API_KEY=your_search_api_key # API key for search provider
+```
+
+### Environment Variables Reference
+
+| Variable | Required | Description |
+|:---|:---:|:---|
+| `LLM_MODEL` | **Yes** | Model name (e.g., `gpt-4o`, `deepseek-chat`) |
+| `LLM_API_KEY` | **Yes** | Your LLM API key |
+| `LLM_HOST` | **Yes** | API endpoint URL |
+| `EMBEDDING_MODEL` | **Yes** | Embedding model name |
+| `EMBEDDING_DIMENSION` | **Yes** | Must match model output dimensions |
+| `EMBEDDING_API_KEY` | **Yes** | Embedding API key |
+| `EMBEDDING_HOST` | **Yes** | Embedding API endpoint |
+| `BACKEND_PORT` | No | Backend port (default: `8001`) |
+| `FRONTEND_PORT` | No | Frontend port (default: `3782`) |
+| `NEXT_PUBLIC_API_BASE` | No | Set for remote/LAN access |
+| `SEARCH_PROVIDER` | No | Web search provider |
+| `SEARCH_API_KEY` | No | Search API key |
+
+### Supported LLM Providers
+
+| Provider | `LLM_BINDING` Value | Notes |
+|:---------|:--------------------|:------|
+| OpenAI | `openai` | GPT-4o, GPT-4, GPT-3.5 |
+| Anthropic | `anthropic` | Claude 3.5, Claude 3 |
+| Azure OpenAI | `azure_openai` | Enterprise deployments |
+| Ollama | `ollama` | Local models |
+| DeepSeek | `deepseek` | DeepSeek-V3, DeepSeek-R1 |
+| Groq | `groq` | Fast inference |
+| OpenRouter | `openrouter` | Multi-model gateway |
+| Google Gemini | `gemini` | OpenAI-compatible mode |
+
+### Supported Embedding Providers
+
+| Provider | `EMBEDDING_BINDING` Value | Notes |
+|:---------|:--------------------------|:------|
+| OpenAI | `openai` | text-embedding-3-large/small |
+| Azure OpenAI | `azure_openai` | Enterprise deployments |
+| Jina AI | `jina` | jina-embeddings-v3 |
+| Cohere | `cohere` | embed-v3 series |
+| Ollama | `ollama` | Local embedding models |
+| LM Studio | `lm_studio` | Local inference server |
+| HuggingFace | `huggingface` | OpenAI-compatible endpoints |
+
+## 3. Configuration Files
+
+DeepTutor uses two YAML configuration files for customization:
+
+### `config/agents.yaml` - Agent Parameters
+
+This file controls LLM parameters for each module:
+
+```yaml
+# Solve Module - Problem solving agents
+solve:
+ temperature: 0.3
+ max_tokens: 8192
+
+# Research Module - Deep research agents
+research:
+ temperature: 0.5
+ max_tokens: 12000
+
+# Question Module - Question generation agents
+question:
+ temperature: 0.7
+ max_tokens: 4096
+
+# Guide Module - Learning guidance agents
+guide:
+ temperature: 0.5
+ max_tokens: 16192
+
+# IdeaGen Module - Idea generation agents
+ideagen:
+ temperature: 0.7
+ max_tokens: 4096
+
+# CoWriter Module - Collaborative writing agents
+co_writer:
+ temperature: 0.7
+ max_tokens: 4096
+```
+
+### `config/main.yaml` - System Settings
+
+This file controls paths, tools, and module-specific settings:
+
+```yaml
+# System language
+system:
+ language: en
+
+# Data paths
+paths:
+ user_data_dir: ./data/user
+ knowledge_bases_dir: ./data/knowledge_bases
+
+# Tool configuration
+tools:
+ rag_tool:
+ kb_base_dir: ./data/knowledge_bases
+ default_kb: ai_textbook
+ run_code:
+ workspace: ./data/user/run_code_workspace
+ web_search:
+ enabled: true
+ query_item:
+ enabled: true
+ max_results: 5
+
+# Module-specific settings
+research:
+ researching:
+ execution_mode: series # "series" or "parallel"
+ max_iterations: 5
+ enable_rag_hybrid: true
+ enable_paper_search: true
+ enable_web_search: true
+```
+
+> **Tip:** For most users, the default configuration works well. Only modify these files if you need specific customizations.
+
+## 4. Knowledge Base Preparation (Optional)
+
+You can use our pre-built demo knowledge bases to get started quickly.
+
+### Download Demo Knowledge Bases
+
+Download from [Google Drive](https://drive.google.com/drive/folders/1iWwfZXiTuQKQqUYb5fGDZjLCeTUP6DA6?usp=sharing) and extract into the `data/` directory.
+
+::: info Important
+The demo knowledge bases use `text-embedding-3-large` with `dimensions = 3072`. Make sure your embedding model has matching dimensions.
+:::
+
+### Create Your Own Knowledge Base
+
+After launching DeepTutor:
+
+1. Navigate to `http://localhost:3782/knowledge`
+2. Click **"New Knowledge Base"**
+3. Enter a unique name
+4. Upload PDF/TXT/MD files
+5. Monitor progress in the terminal
+
+---
+
+**Next Step:** [Data Preparation →](/guide/data-preparation)
diff --git a/docs/index.md b/docs/index.md
index 5e587a387..3e892b379 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -4,34 +4,28 @@ layout: home
hero:
name: "DeepTutor"
text: "Your AI Learning Companion"
- tagline: Transform any document into an interactive learning experience
+ tagline: Transform any document into an interactive learning experience with multi-agent intelligence
image:
src: /logo.png
alt: DeepTutor
actions:
- theme: brand
- text: Quick Start →
- link: /guide/getting-started
+ text: Get Started →
+ link: /guide/pre-config
- theme: alt
text: GitHub
link: https://github.com/HKUDS/DeepTutor
- - theme: alt
- text: 🚀 Roadmap
- link: /roadmap
features:
- icon: 📚
title: Massive Document Q&A
details: Upload textbooks, papers, and manuals. Build AI-powered knowledge repositories with RAG and knowledge graph integration.
- - icon: 🎨
- title: Interactive Visualization
- details: Transform complex concepts into visual aids with step-by-step breakdowns and engaging interactive demonstrations.
- icon: 🧠
title: Smart Problem Solving
- details: Dual-loop reasoning with step-by-step solutions and precise citations from your documents.
+ details: Dual-loop reasoning architecture with multi-agent collaboration, delivering step-by-step solutions with precise citations.
- icon: 🎯
title: Practice Generator
- details: Generate custom quizzes or mimic real exams from your uploaded materials.
+ details: Generate custom quizzes based on your knowledge base, or mimic real exam styles for authentic practice.
- icon: 🎓
title: Guided Learning
details: Personalized learning paths with interactive visualizations and adaptive explanations.
@@ -40,74 +34,44 @@ features:
details: Systematic topic exploration with web search, paper retrieval, and literature synthesis.
- icon: 💡
title: Idea Generation
- details: Automated and interactive concept development with multi-source insights and novelty evaluation.
+ details: AI-assisted brainstorming with knowledge extraction and multi-stage filtering.
---
## Why DeepTutor?
-DeepTutor transforms how students interact with educational materials through a unified multi-agent architecture. Unlike traditional tools, it provides:
-
-- **Deep Understanding** - Not just answers, but guided learning journeys with visual explanations
-- **Multi-Modal Support** - PDF, LaTeX, images, code execution, and more
-- **Knowledge Graph** - Semantic connections powered by LightRAG for better comprehension
-- **All-in-One Platform** - Problem solving, question generation, research, and idea generation
-
-## Quick Demo
-
-```bash
-# Clone and setup
-git clone https://github.com/HKUDS/DeepTutor.git
-cd DeepTutor
-
-# Install dependencies
-bash scripts/install_all.sh
-
-# Start the application
-python scripts/start_web.py
-```
+- **Deep Understanding** — Not just answers, but guided learning journeys with visual explanations
+- **Multi-Modal Support** — PDF, LaTeX, images, code execution, and more
+- **Knowledge Graph** — Semantic connections powered by LightRAG for better comprehension
+- **All-in-One Platform** — Problem solving, question generation, research, and idea generation in one place
<style>
:root {
--vp-home-hero-name-color: transparent;
--vp-home-hero-name-background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
--vp-home-hero-image-background-image: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.2) 50%, rgba(240, 147, 251, 0.15) 100%);
- --vp-home-hero-image-filter: blur(68px);
+ --vp-home-hero-image-filter: blur(72px);
}
.dark {
--vp-home-hero-image-background-image: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 50%, rgba(240, 147, 251, 0.1) 100%);
}
-/* DeepTutor 标题更大 */
.VPHero .name {
- font-size: 4rem !important;
+ font-size: 4.5rem !important;
line-height: 1.1 !important;
}
.VPHero .text {
- font-size: 2.2rem !important;
+ font-size: 2.4rem !important;
font-weight: 600 !important;
- color: var(--vp-c-text-1);
}
@media (max-width: 768px) {
.VPHero .name {
- font-size: 2.8rem !important;
+ font-size: 3rem !important;
}
.VPHero .text {
- font-size: 1.6rem !important;
+ font-size: 1.8rem !important;
}
}
-
-/* Hero 区域 Roadmap 按钮特殊样式 */
-.VPButton.alt[href="/roadmap"] {
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
- color: white !important;
- border: none !important;
-}
-
-.VPButton.alt[href="/roadmap"]:hover {
- box-shadow: 0 4px 16px rgba(102, 126, 234, 0.5);
- transform: translateY(-2px);
-}
</style>
diff --git a/docs/zh/contribution.md b/docs/zh/contribution.md
new file mode 100644
index 000000000..ce9f25a81
--- /dev/null
+++ b/docs/zh/contribution.md
@@ -0,0 +1,104 @@
+# 参与贡献
+
+我们希望 DeepTutor 能成为送给社区的礼物。🎁
+
+## 加入我们的社区
+
+<div class="community-links">
+ <a href="https://github.com/HKUDS/DeepTutor/issues/78" class="community-badge wechat">
+ 💬 微信社区群
+ </a>
+ <a href="https://github.com/HKUDS/DeepTutor/issues/167" class="community-badge wechat-collab">
+ 🤝 微信共创群
+ </a>
+ <a href="https://discord.gg/eRsjPgMU4t" class="community-badge discord">
+ 🌐 Discord
+ </a>
+</div>
+
+## 我们欢迎贡献!
+
+无论您是修复 bug、改进文档还是添加新功能,您的贡献对我们都很有价值。
+
+### 如何贡献
+
+1. **报告 Bug** — 发现了 bug?在 GitHub 上开一个 issue,附上复现步骤
+2. **建议功能** — 在 GitHub Discussions 或我们的社区渠道分享想法
+3. **改进文档** — 帮助我们改进文档、教程和示例
+4. **提交代码** — 通过 Pull Request 修复 bug 或实现新功能
+
+### 贡献指南
+
+详细指南请参阅 [CONTRIBUTING.md](https://github.com/HKUDS/DeepTutor/blob/dev/CONTRIBUTING.md)。
+
+**要点:**
+
+- 所有贡献必须基于 `dev` 分支
+- 提交前运行 `pre-commit run --all-files`
+- 使用约定式提交格式:`feat:`、`fix:`、`docs:` 等
+
+### 快速入门
+
+```bash
+# Fork 并克隆
+git clone https://github.com/YOUR_USERNAME/DeepTutor.git
+cd DeepTutor
+
+# 从 dev 创建功能分支
+git checkout dev && git pull origin dev
+git checkout -b feature/your-feature-name
+
+# 安装预提交钩子
+pip install pre-commit && pre-commit install
+
+# 进行更改,然后向 dev 分支提交 PR
+```
+
+## 我们的贡献者
+
+<a href="https://github.com/HKUDS/DeepTutor/graphs/contributors">
+ <img src="https://contrib.rocks/image?repo=HKUDS/DeepTutor&max=999" alt="贡献者" />
+</a>
+
+---
+
+感谢您对 DeepTutor 贡献的兴趣!🚀
+
+<style>
+.community-links {
+ display: flex;
+ gap: 12px;
+ flex-wrap: wrap;
+ margin: 20px 0;
+}
+
+.community-badge {
+ display: inline-flex;
+ align-items: center;
+ padding: 10px 18px;
+ border-radius: 8px;
+ font-weight: 500;
+ font-size: 0.95rem;
+ text-decoration: none;
+ transition: all 0.2s ease;
+}
+
+.community-badge:hover {
+ transform: translateY(-2px);
+}
+
+.community-badge.wechat {
+ background: #07C160;
+ color: white;
+}
+
+.community-badge.wechat-collab {
+ background: #1AAD19;
+ color: white;
+}
+
+.community-badge.discord {
+ background: #5865F2;
+ color: white;
+}
+</style>
diff --git a/docs/zh/guide/configuration.md b/docs/zh/guide/configuration.md
deleted file mode 100644
index 42524981b..000000000
--- a/docs/zh/guide/configuration.md
+++ /dev/null
@@ -1,99 +0,0 @@
-# 配置说明
-
-## 配置文件
-
-| 文件 | 用途 |
-|:-----|:--------|
-| `.env` | API 密钥、端口、服务商 |
-| `config/agents.yaml` | LLM 参数(temperature、max_tokens)|
-| `config/main.yaml` | 路径、工具、模块设置 |
-
-## 环境变量
-
-### 必需配置
-
-```bash
-# LLM
-LLM_MODEL=gpt-4o
-LLM_API_KEY=your_api_key
-LLM_HOST=https://api.openai.com/v1
-
-# Embedding
-EMBEDDING_MODEL=text-embedding-3-large
-EMBEDDING_API_KEY=your_api_key
-EMBEDDING_HOST=https://api.openai.com/v1
-EMBEDDING_DIMENSION=3072
-```
-
-### 可选配置
-
-```bash
-# 服务端口(默认:8001/3782)
-BACKEND_PORT=8001
-FRONTEND_PORT=3782
-
-# 远程访问
-NEXT_PUBLIC_API_BASE=http://your-server-ip:8001
-
-# 网络搜索(统一 API Key)
-SEARCH_PROVIDER=perplexity # 可选:perplexity, tavily, serper, jina, exa, baidu
-SEARCH_API_KEY=your_search_api_key
-
-# TTS 语音合成
-TTS_MODEL=
-TTS_URL=
-TTS_API_KEY=
-```
-
-## 🤗 HuggingFace / MinerU(可选:离线/镜像网络)
-
-如果你的环境无法直接访问 `huggingface.co`(比如内网/校园网/离线环境),MinerU 在尝试从 HuggingFace Hub 下载模型时可能会失败。DeepTutor 会读取根目录 `.env`(并且 `docker-compose.yml` 通过 `env_file: .env` 注入到容器),因此你可以在 `.env` 里**按需添加**下面这些变量:
-
-```bash
-# ============================================================================
-# HuggingFace Hub / MinerU - 可选
-# ============================================================================
-# 使用 HuggingFace 镜像站点(如果你有可用的镜像域名)
-# HF_ENDPOINT=https://your-hf-mirror.example.com
-
-# 缓存目录(容器内路径)。Docker 建议把该目录挂载出来以便复用缓存。
-# HF_HOME=/app/data/hf
-
-# 强制离线模式(前提:模型已在本地缓存中)
-# HF_HUB_OFFLINE=1
-```
-
-## Agent 参数
-
-编辑 `config/agents.yaml`:
-
-```yaml
-solve:
- temperature: 0.3
- max_tokens: 8192
-
-research:
- temperature: 0.5
- max_tokens: 12000
-
-question:
- temperature: 0.7
- max_tokens: 4096
-```
-
-## 数据存储位置
-
-```text
-data/
-├── knowledge_bases/ # 你上传的文档
-└── user/
- ├── solve/ # 解题输出
- ├── question/ # 生成的题目
- ├── research/ # 研究报告
- ├── guide/ # 学习会话
- └── logs/ # 系统日志
-```
-
----
-
-📖 **完整参考**: [config/README.md](https://github.com/HKUDS/DeepTutor/tree/main/config)
diff --git a/docs/zh/guide/data-preparation.md b/docs/zh/guide/data-preparation.md
new file mode 100644
index 000000000..e148c40b1
--- /dev/null
+++ b/docs/zh/guide/data-preparation.md
@@ -0,0 +1,185 @@
+# 数据准备
+
+DeepTutor 提供示例知识库和样例问题,帮助您快速上手。
+
+## 示例知识库
+
+我们在 [Google Drive](https://drive.google.com/drive/folders/1iWwfZXiTuQKQqUYb5fGDZjLCeTUP6DA6?usp=sharing) 上提供两个预构建的知识库:
+
+### 1. 研究论文合集
+
+<div class="info-card">
+ <div class="info-header">
+ <span class="info-icon">📄</span>
+ <span class="info-title">5 篇研究论文(每篇 20-50 页)</span>
+ </div>
+ <div class="info-content">
+ <p>来自我们实验室的前沿研究论文精选集,涵盖 RAG 和 Agent 领域。</p>
+ <p><strong>包含论文:</strong></p>
+ <ul>
+ <li><a href="https://github.com/HKUDS/AI-Researcher">AI-Researcher</a> - 自动化研究论文生成</li>
+ <li><a href="https://github.com/HKUDS/AutoAgent">AutoAgent</a> - 自主智能体框架</li>
+ <li><a href="https://github.com/HKUDS/RAG-Anything">RAG-Anything</a> - 多模态 RAG 系统</li>
+ <li><a href="https://github.com/HKUDS/LightRAG">LightRAG</a> - 简洁快速的 RAG</li>
+ <li><a href="https://github.com/HKUDS/VideoRAG">VideoRAG</a> - 基于 RAG 的视频理解</li>
+ </ul>
+ <p><strong>适用场景:</strong> 研究场景,广泛知识覆盖</p>
+ </div>
+</div>
+
+### 2. 数据科学教材
+
+<div class="info-card">
+ <div class="info-header">
+ <span class="info-icon">📚</span>
+ <span class="info-title">8 章,296 页</span>
+ </div>
+ <div class="info-content">
+ <p>来自加州大学伯克利分校的综合深度学习教材。</p>
+ <p><strong>来源:</strong> <a href="https://ma-lab-berkeley.github.io/deep-representation-learning-book/">Deep Representation Learning Book</a></p>
+ <p><strong>涵盖主题:</strong></p>
+ <ul>
+ <li>神经网络基础</li>
+ <li>表示学习</li>
+ <li>深度学习架构</li>
+ <li>高级主题</li>
+ </ul>
+ <p><strong>适用场景:</strong> 学习场景,深度知识挖掘</p>
+ </div>
+</div>
+
+## 下载与设置
+
+### 步骤 1:下载
+
+访问我们的 [Google Drive 文件夹](https://drive.google.com/drive/folders/1iWwfZXiTuQKQqUYb5fGDZjLCeTUP6DA6?usp=sharing) 并下载:
+
+- `knowledge_bases.zip` - 包含嵌入的预构建知识库
+- `questions.zip` - 样例问题和使用示例(可选)
+
+### 步骤 2:解压
+
+将下载的文件解压到 `data/` 目录:
+
+```
+DeepTutor/
+├── data/
+│ └── knowledge_bases/
+│ ├── research_papers/ # 研究论文知识库
+│ ├── data_science_book/ # 教材知识库
+│ └── kb_config.json # 知识库配置
+└── user/ # 用户数据(自动创建)
+```
+
+### 步骤 3:验证
+
+解压后,启动 DeepTutor 时您的知识库将自动可用。
+
+::: warning 嵌入兼容性
+我们的示例知识库使用 `text-embedding-3-large`,`dimensions = 3072`。
+
+如果您的嵌入模型具有不同的维度,您需要创建自己的知识库。
+:::
+
+## 创建自定义知识库
+
+### 支持的文件格式
+
+| 格式 | 扩展名 | 说明 |
+|:-------|:----------|:------|
+| PDF | `.pdf` | 支持文本提取和版面分析 |
+| 文本 | `.txt` | 纯文本文件 |
+| Markdown | `.md` | 支持格式化的 Markdown |
+
+### 通过 Web 界面
+
+1. 导航到 `http://localhost:3782/knowledge`
+2. 点击 **"New Knowledge Base"**
+3. 为您的知识库输入唯一名称
+4. 上传您的文档(单个或批量上传)
+5. 等待处理完成
+
+::: tip 处理时间
+- 小文档(< 10 页):约 1 分钟
+- 中等文档(10-100 页):约 5-10 分钟
+- 大文档(100+ 页):可能需要更长时间
+:::
+
+### 通过命令行
+
+```bash
+# 使用文档初始化新知识库
+python -m src.knowledge.start_kb init <kb_name> --docs <pdf_path>
+
+# 向现有知识库添加文档
+python -m src.knowledge.add_documents <kb_name> --docs <new_document.pdf>
+```
+
+## 数据存储结构
+
+所有用户数据存储在 `data/` 目录中:
+
+```
+data/
+├── knowledge_bases/ # 知识库存储
+│ ├── <kb_name>/
+│ │ ├── documents/ # 原始文档
+│ │ ├── chunks/ # 分块内容
+│ │ ├── embeddings/ # 向量嵌入
+│ │ └── graph/ # 知识图谱数据
+└── user/ # 用户活动数据
+ ├── solve/ # 解题结果
+ ├── question/ # 生成的题目
+ ├── research/ # 研究报告
+ ├── notebook/ # 笔记本记录
+ └── logs/ # 系统日志
+```
+
+---
+
+**下一步:** [本地安装 →](/zh/guide/local-start)
+
+<style>
+.info-card {
+ background: var(--vp-c-bg-soft);
+ border: 1px solid var(--vp-c-border);
+ border-radius: 12px;
+ padding: 20px;
+ margin: 16px 0;
+}
+
+.info-header {
+ display: flex;
+ align-items: center;
+ gap: 12px;
+ margin-bottom: 16px;
+}
+
+.info-icon {
+ font-size: 1.5rem;
+}
+
+.info-title {
+ font-size: 1.1rem;
+ font-weight: 600;
+ color: var(--vp-c-text-1);
+}
+
+.info-content {
+ color: var(--vp-c-text-2);
+ line-height: 1.7;
+}
+
+.info-content ul {
+ margin: 12px 0;
+ padding-left: 20px;
+}
+
+.info-content li {
+ margin: 6px 0;
+}
+
+.info-content a {
+ color: var(--vp-c-brand-1);
+}
+</style>
diff --git a/docs/zh/guide/docker-start.md b/docs/zh/guide/docker-start.md
new file mode 100644
index 000000000..110042538
--- /dev/null
+++ b/docs/zh/guide/docker-start.md
@@ -0,0 +1,259 @@
+# Docker 部署
+
+Docker 部署无需 Python 或 Node.js 设置——一切都在容器中运行。
+
+## 前提条件
+
+- **Docker** — [安装 Docker](https://docs.docker.com/get-docker/)
+- **Docker Compose** — [安装 Docker Compose](https://docs.docker.com/compose/install/)
+
+## 快速启动选项
+
+选择您喜欢的部署方式:
+
+<div class="method-tabs">
+
+### 选项 A:从源码构建
+
+从源代码本地构建并运行 DeepTutor。
+
+```bash
+# 克隆仓库(如果尚未完成)
+git clone https://github.com/HKUDS/DeepTutor.git
+cd DeepTutor
+
+# 创建并配置 .env 文件
+cp .env.example .env
+# 编辑 .env 填入您的 API 密钥
+
+# 构建并启动
+docker compose up
+
+# 首次运行在 Mac Mini M4 上约需 11 分钟
+```
+
+#### 常用命令
+
+```bash
+# 后台启动
+docker compose up -d
+
+# 停止服务
+docker compose down
+
+# 查看日志
+docker compose logs -f
+
+# 代码更改后重建
+docker compose up --build
+
+# 清除缓存并重建
+docker compose build --no-cache
+```
+
+</div>
+
+<div class="method-tabs">
+
+### 选项 B:拉取预构建镜像(更快)
+
+使用我们在 GitHub Container Registry 上的官方预构建镜像。
+
+```bash
+# 适用于所有平台 - Docker 自动检测您的架构
+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
+```
+
+::: warning Windows PowerShell
+使用 `${PWD}` 代替 `$(pwd)`:
+
+```powershell
+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
+```
+:::
+
+</div>
+
+## 可用镜像标签
+
+| 标签 | 架构 | 说明 |
+|:----|:--------------|:------------|
+| `:latest` | AMD64 + ARM64 | 最新稳定版(自动检测架构) |
+| `:v0.5.x` | AMD64 + ARM64 | 特定版本(自动检测架构) |
+| `:v0.5.x-amd64` | 仅 AMD64 | 显式 AMD64 镜像 |
+| `:v0.5.x-arm64` | 仅 ARM64 | 显式 ARM64 镜像 |
+
+::: tip 多架构支持
+`:latest` 标签是**多架构镜像**——Docker 会自动为您的系统(Intel/AMD 或 Apple Silicon/ARM)拉取正确的版本。
+:::
+
+## 云端部署
+
+部署到云服务器时,必须设置外部 API URL:
+
+```bash
+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
+```
+
+::: warning 为什么需要这样做?
+默认 API URL 是 `localhost:8001`,在浏览器中这指向用户的本地机器,而不是您的服务器。设置 `NEXT_PUBLIC_API_BASE_EXTERNAL` 确保前端连接到您服务器的公共地址。
+:::
+
+## 自定义端口
+
+使用不同的端口:
+
+```bash
+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 \
+ --env-file .env \
+ -v $(pwd)/data:/app/data \
+ ghcr.io/hkuds/deeptutor:latest
+```
+
+::: warning 重要
+`-p` 端口映射必须与 `BACKEND_PORT`/`FRONTEND_PORT` 值匹配。
+:::
+
+## 访问地址
+
+| 服务 | URL | 说明 |
+|:---:|:---|:---|
+| **前端** | http://localhost:3782 | 主 Web 界面 |
+| **API 文档** | http://localhost:8001/docs | 交互式 API 文档 |
+
+## 容器管理
+
+### 查看运行中的容器
+
+```bash
+docker ps
+```
+
+### 停止容器
+
+```bash
+docker stop deeptutor
+```
+
+### 删除容器
+
+```bash
+docker rm deeptutor
+```
+
+### 查看日志
+
+```bash
+# 所有日志
+docker logs deeptutor
+
+# 实时跟踪日志
+docker logs -f deeptutor
+
+# 最后 100 行
+docker logs --tail 100 deeptutor
+```
+
+## 故障排除
+
+### 云端部署时前端无法连接
+
+**问题:** 前端显示 "Failed to fetch" 或 "NEXT_PUBLIC_API_BASE is not configured"
+
+**解决方案:** 将 `NEXT_PUBLIC_API_BASE_EXTERNAL` 设置为您服务器的公共 URL:
+
+```bash
+-e NEXT_PUBLIC_API_BASE_EXTERNAL=https://your-server.com:8001
+```
+
+### 使用 HTTPS 反向代理时设置页面显示 "Error loading data"
+
+**问题:** HTTPS 请求被重定向到 HTTP(307 重定向)
+
+**解决方案:** 此问题已在 v0.5.0+ 中修复。请更新到最新版本。
+
+**nginx 配置:**
+
+```nginx
+# 前端
+location / {
+ proxy_pass http://localhost:3782;
+ proxy_set_header Host $host;
+ proxy_set_header X-Forwarded-Proto $scheme;
+}
+
+# 后端 API
+location /api/ {
+ proxy_pass http://localhost:8001;
+ proxy_set_header Host $host;
+ proxy_set_header X-Forwarded-Proto $scheme;
+}
+
+# WebSocket 支持
+location /api/v1/ {
+ proxy_pass http://localhost:8001;
+ proxy_http_version 1.1;
+ proxy_set_header Upgrade $http_upgrade;
+ proxy_set_header Connection "upgrade";
+ proxy_set_header X-Forwarded-Proto $scheme;
+}
+```
+
+### 重启后数据未保留
+
+**解决方案:** 确保挂载了数据目录:
+
+```bash
+-v $(pwd)/data:/app/data
+```
+
+### HuggingFace 模型下载失败(受限网络)
+
+**解决方案:** 在 `.env` 中添加 HuggingFace 配置:
+
+```bash
+# 使用镜像端点
+HF_ENDPOINT=https://your-hf-mirror.example.com
+
+# 或强制离线模式(需要预缓存的模型)
+HF_HUB_OFFLINE=1
+```
+
+---
+
+**下一步:** [参与贡献 →](/zh/contribution)
+
+<style>
+.method-tabs {
+ background: var(--vp-c-bg-soft);
+ border: 1px solid var(--vp-c-border);
+ border-radius: 12px;
+ padding: 20px;
+ margin: 16px 0;
+}
+
+.method-tabs h3 {
+ margin-top: 0;
+ padding-top: 0;
+ border-top: none;
+}
+</style>
diff --git a/docs/zh/guide/getting-started.md b/docs/zh/guide/getting-started.md
deleted file mode 100644
index 87c7f32ab..000000000
--- a/docs/zh/guide/getting-started.md
+++ /dev/null
@@ -1,78 +0,0 @@
-# 快速开始
-
-5 分钟内让 DeepTutor 运行起来。
-
-## 环境要求
-
-- Python 3.10+
-- Node.js 18+
-- 一个 LLM API 密钥(OpenAI、Anthropic、DeepSeek 等)
-
-## 安装
-
-::: code-group
-
-```bash [快速安装]
-# 克隆并设置
-git clone https://github.com/HKUDS/DeepTutor.git
-cd DeepTutor
-
-# 配置 API 密钥
-cp .env.example .env
-# 编辑 .env 填入你的 API 密钥
-
-# 安装并启动
-bash scripts/install_all.sh
-python scripts/start_web.py
-```
-
-```bash [Docker]
-docker run -d --name deeptutor \
- -p 8001:8001 -p 3782:3782 \
- -e LLM_MODEL=gpt-4o \
- -e LLM_API_KEY=your-key \
- -e LLM_HOST=https://api.openai.com/v1 \
- -e EMBEDDING_MODEL=text-embedding-3-large \
- -e EMBEDDING_API_KEY=your-key \
- -e EMBEDDING_HOST=https://api.openai.com/v1 \
- ghcr.io/hkuds/deeptutor:latest
-```
-
-:::
-
-## `.env` 核心变量
-
-```bash
-# 必需
-LLM_MODEL=gpt-4o
-LLM_API_KEY=your_api_key
-LLM_HOST=https://api.openai.com/v1
-
-EMBEDDING_MODEL=text-embedding-3-large
-EMBEDDING_API_KEY=your_api_key
-EMBEDDING_HOST=https://api.openai.com/v1
-```
-
-> 📖 **完整配置选项**: 参见 [配置说明](/zh/guide/configuration) 或 [README](https://github.com/HKUDS/DeepTutor#step-1-pre-configuration)
-
-## 访问地址
-
-| 服务 | 地址 |
-|:--------|:----|
-| **Web 应用** | http://localhost:3782 |
-| **API 文档** | http://localhost:8001/docs |
-
-## 创建第一个知识库
-
-1. 访问 http://localhost:3782/knowledge
-2. 点击 **"新建知识库"**
-3. 上传 PDF、TXT 或 Markdown 文件
-4. 等待处理完成
-
-完成!现在可以开始使用 **智能解题**、**题目生成** 或 **深度研究** 等模块。
-
-## 下一步
-
-- [配置说明 →](/zh/guide/configuration)
-- [常见问题 →](/zh/guide/troubleshooting)
-- [完整安装指南 →](https://github.com/HKUDS/DeepTutor#-getting-started)
diff --git a/docs/zh/guide/local-start.md b/docs/zh/guide/local-start.md
new file mode 100644
index 000000000..64dee562d
--- /dev/null
+++ b/docs/zh/guide/local-start.md
@@ -0,0 +1,190 @@
+# 本地安装
+
+本指南介绍用于开发或非 Docker 环境的手动安装。
+
+## 前提条件
+
+- **Python 3.10+** — [下载](https://www.python.org/downloads/)
+- **Node.js 18+** — [下载](https://nodejs.org/)
+- **Git** — [下载](https://git-scm.com/)
+
+::: tip Windows 用户
+如果在安装过程中遇到路径长度错误,请启用长路径支持:
+
+```cmd
+reg add "HKLM\SYSTEM\CurrentControlSet\Control\FileSystem" /v LongPathsEnabled /t REG_DWORD /d 1 /f
+```
+
+运行此命令后重启终端。
+:::
+
+## 步骤 1:设置虚拟环境
+
+选择以下选项之一:
+
+::: code-group
+
+```bash [Conda(推荐)]
+# 创建环境
+conda create -n deeptutor python=3.10
+
+# 激活环境
+conda activate deeptutor
+```
+
+```bash [venv]
+# 创建环境
+python -m venv venv
+
+# 激活 (Windows)
+venv\Scripts\activate
+
+# 激活 (macOS/Linux)
+source venv/bin/activate
+```
+
+:::
+
+## 步骤 2:安装依赖
+
+### 选项 A:自动安装(推荐)
+
+```bash
+# 使用 Python 脚本
+python scripts/install_all.py
+
+# 或使用 shell 脚本 (macOS/Linux)
+bash scripts/install_all.sh
+```
+
+### 选项 B:手动安装
+
+```bash
+# 安装 Python 依赖
+pip install -r requirements.txt
+
+# 安装 Node.js 依赖
+npm install --prefix web
+```
+
+::: warning 常见问题
+如果看到 `npm: command not found`:
+
+```bash
+# 使用 Conda
+conda install -c conda-forge nodejs
+
+# 或从 https://nodejs.org/ 安装
+```
+:::
+
+## 步骤 3:配置环境
+
+确保您已完成[预配置](/zh/guide/pre-config)步骤:
+
+1. ✅ 创建了包含 API 密钥的 `.env` 文件
+2. ✅ (可选)自定义了 `config/agents.yaml`
+3. ✅ (可选)下载了示例知识库
+
+## 步骤 4:启动应用
+
+### 启动 Web 界面(推荐)
+
+```bash
+python scripts/start_web.py
+```
+
+这将同时启动 **前端**(Next.js)和 **后端**(FastAPI)服务器。
+
+### 替代方案:仅 CLI 界面
+
+```bash
+python scripts/start.py
+```
+
+### 访问地址
+
+| 服务 | URL | 说明 |
+|:---:|:---|:---|
+| **前端** | http://localhost:3782 | 主 Web 界面 |
+| **API 文档** | http://localhost:8001/docs | 交互式 API 文档 |
+
+## 高级:分别启动服务
+
+对于开发,您可能想要分别运行前端和后端:
+
+### 后端(FastAPI)
+
+```bash
+python src/api/run_server.py
+
+# 或直接使用 uvicorn
+uvicorn src.api.main:app --host 0.0.0.0 --port 8001 --reload
+```
+
+### 前端(Next.js)
+
+首先,创建 `web/.env.local`:
+
+```bash
+NEXT_PUBLIC_API_BASE=http://localhost:8001
+```
+
+然后启动开发服务器:
+
+```bash
+cd web
+npm install
+npm run dev -- -p 3782
+```
+
+## 停止服务
+
+在终端中按 `Ctrl+C` 停止服务。
+
+::: warning 端口仍在使用?
+如果按 Ctrl+C 后看到"端口已在使用":
+
+**macOS/Linux:**
+```bash
+lsof -i :8001
+kill -9 <PID>
+```
+
+**Windows:**
+```bash
+netstat -ano | findstr :8001
+taskkill /PID <PID> /F
+```
+:::
+
+## 故障排除
+
+### 后端启动失败
+
+**检查清单:**
+- 确认 Python 版本 >= 3.10:`python --version`
+- 确认所有依赖已安装:`pip install -r requirements.txt`
+- 检查端口 8001 是否被占用
+- 验证 `.env` 文件配置
+
+### 前端无法连接后端
+
+**解决方案:**
+1. 确认后端正在运行:访问 http://localhost:8001/docs
+2. 检查浏览器控制台的错误信息
+3. 创建 `web/.env.local`:
+ ```bash
+ NEXT_PUBLIC_API_BASE=http://localhost:8001
+ ```
+
+### WebSocket 连接失败
+
+**检查清单:**
+- 确认后端正在运行
+- 检查防火墙设置
+- 验证 WebSocket URL 格式:`ws://localhost:8001/api/v1/...`
+
+---
+
+**下一步:** [Docker 部署 →](/zh/guide/docker-start)
diff --git a/docs/zh/guide/pre-config.md b/docs/zh/guide/pre-config.md
new file mode 100644
index 000000000..5708c2b8f
--- /dev/null
+++ b/docs/zh/guide/pre-config.md
@@ -0,0 +1,201 @@
+# 预配置
+
+在启动 DeepTutor 之前,您需要完成以下设置步骤。
+
+## 1. 克隆仓库
+
+```bash
+git clone https://github.com/HKUDS/DeepTutor.git
+cd DeepTutor
+```
+
+## 2. 环境变量配置
+
+从模板创建 `.env` 文件:
+
+```bash
+cp .env.example .env
+```
+
+然后编辑 `.env` 文件,填入您的 API 密钥:
+
+```bash
+# ============================================================================
+# 服务器配置
+# ============================================================================
+BACKEND_PORT=8001 # 后端 API 端口
+FRONTEND_PORT=3782 # 前端 Web 端口
+
+# 远程/局域网访问 - 设置为您服务器的 IP 地址
+# NEXT_PUBLIC_API_BASE=http://192.168.1.100:8001
+
+# ============================================================================
+# LLM (大语言模型) 配置 - 必填
+# ============================================================================
+LLM_BINDING=openai # 提供商: openai, anthropic, azure_openai, ollama 等
+LLM_MODEL=gpt-4o # 模型名: gpt-4o, deepseek-chat, claude-3-5-sonnet 等
+LLM_HOST=https://api.openai.com/v1 # API 端点 URL
+LLM_API_KEY=your_api_key # 您的 LLM API 密钥
+
+# ============================================================================
+# 嵌入模型配置 - 知识库必填
+# ============================================================================
+EMBEDDING_BINDING=openai # 提供商类型
+EMBEDDING_MODEL=text-embedding-3-large # 嵌入模型名称
+EMBEDDING_DIMENSION=3072 # 必须与模型维度匹配
+EMBEDDING_HOST=https://api.openai.com/v1 # API 端点
+EMBEDDING_API_KEY=your_api_key # 嵌入 API 密钥
+
+# ============================================================================
+# 网络搜索配置 - 可选
+# ============================================================================
+SEARCH_PROVIDER=perplexity # 选项: perplexity, tavily, serper, jina, exa, baidu
+SEARCH_API_KEY=your_search_api_key # 搜索提供商的 API 密钥
+```
+
+### 环境变量参考
+
+| 变量 | 必填 | 说明 |
+|:---|:---:|:---|
+| `LLM_MODEL` | **是** | 模型名称 (如 `gpt-4o`, `deepseek-chat`) |
+| `LLM_API_KEY` | **是** | 您的 LLM API 密钥 |
+| `LLM_HOST` | **是** | API 端点 URL |
+| `EMBEDDING_MODEL` | **是** | 嵌入模型名称 |
+| `EMBEDDING_DIMENSION` | **是** | 必须与模型输出维度匹配 |
+| `EMBEDDING_API_KEY` | **是** | 嵌入 API 密钥 |
+| `EMBEDDING_HOST` | **是** | 嵌入 API 端点 |
+| `BACKEND_PORT` | 否 | 后端端口 (默认: `8001`) |
+| `FRONTEND_PORT` | 否 | 前端端口 (默认: `3782`) |
+| `NEXT_PUBLIC_API_BASE` | 否 | 设置用于远程/局域网访问 |
+| `SEARCH_PROVIDER` | 否 | 网络搜索提供商 |
+| `SEARCH_API_KEY` | 否 | 搜索 API 密钥 |
+
+### 支持的 LLM 提供商
+
+| 提供商 | `LLM_BINDING` 值 | 说明 |
+|:---------|:--------------------|:------|
+| OpenAI | `openai` | GPT-4o, GPT-4, GPT-3.5 |
+| Anthropic | `anthropic` | Claude 3.5, Claude 3 |
+| Azure OpenAI | `azure_openai` | 企业部署 |
+| Ollama | `ollama` | 本地模型 |
+| DeepSeek | `deepseek` | DeepSeek-V3, DeepSeek-R1 |
+| Groq | `groq` | 快速推理 |
+| OpenRouter | `openrouter` | 多模型网关 |
+| Google Gemini | `gemini` | OpenAI 兼容模式 |
+
+### 支持的嵌入提供商
+
+| 提供商 | `EMBEDDING_BINDING` 值 | 说明 |
+|:---------|:--------------------------|:------|
+| OpenAI | `openai` | text-embedding-3-large/small |
+| Azure OpenAI | `azure_openai` | 企业部署 |
+| Jina AI | `jina` | jina-embeddings-v3 |
+| Cohere | `cohere` | embed-v3 系列 |
+| Ollama | `ollama` | 本地嵌入模型 |
+| LM Studio | `lm_studio` | 本地推理服务器 |
+| HuggingFace | `huggingface` | OpenAI 兼容端点 |
+
+## 3. 配置文件
+
+DeepTutor 使用两个 YAML 配置文件进行自定义:
+
+### `config/agents.yaml` - Agent 参数
+
+此文件控制每个模块的 LLM 参数:
+
+```yaml
+# 解题模块 - 问题求解 agents
+solve:
+ temperature: 0.3
+ max_tokens: 8192
+
+# 研究模块 - 深度研究 agents
+research:
+ temperature: 0.5
+ max_tokens: 12000
+
+# 题目模块 - 题目生成 agents
+question:
+ temperature: 0.7
+ max_tokens: 4096
+
+# 引导模块 - 学习引导 agents
+guide:
+ temperature: 0.5
+ max_tokens: 16192
+
+# 灵感生成模块 - 想法生成 agents
+ideagen:
+ temperature: 0.7
+ max_tokens: 4096
+
+# 协作写作模块 - 协作写作 agents
+co_writer:
+ temperature: 0.7
+ max_tokens: 4096
+```
+
+### `config/main.yaml` - 系统设置
+
+此文件控制路径、工具和模块特定设置:
+
+```yaml
+# 系统语言
+system:
+ language: en
+
+# 数据路径
+paths:
+ user_data_dir: ./data/user
+ knowledge_bases_dir: ./data/knowledge_bases
+
+# 工具配置
+tools:
+ rag_tool:
+ kb_base_dir: ./data/knowledge_bases
+ default_kb: ai_textbook
+ run_code:
+ workspace: ./data/user/run_code_workspace
+ web_search:
+ enabled: true
+ query_item:
+ enabled: true
+ max_results: 5
+
+# 模块特定设置
+research:
+ researching:
+ execution_mode: series # "series" 或 "parallel"
+ max_iterations: 5
+ enable_rag_hybrid: true
+ enable_paper_search: true
+ enable_web_search: true
+```
+
+> **提示:** 对于大多数用户,默认配置已经足够好用。只有在需要特定自定义时才修改这些文件。
+
+## 4. 知识库准备(可选)
+
+您可以使用我们预构建的示例知识库来快速开始。
+
+### 下载示例知识库
+
+从 [Google Drive](https://drive.google.com/drive/folders/1iWwfZXiTuQKQqUYb5fGDZjLCeTUP6DA6?usp=sharing) 下载并解压到 `data/` 目录。
+
+::: info 重要提示
+示例知识库使用 `text-embedding-3-large`,`dimensions = 3072`。请确保您的嵌入模型具有匹配的维度。
+:::
+
+### 创建您自己的知识库
+
+启动 DeepTutor 后:
+
+1. 导航到 `http://localhost:3782/knowledge`
+2. 点击 **"New Knowledge Base"**
+3. 输入唯一的名称
+4. 上传 PDF/TXT/MD 文件
+5. 在终端中监控进度
+
+---
+
+**下一步:** [数据准备 →](/zh/guide/data-preparation)
diff --git a/docs/zh/index.md b/docs/zh/index.md
index 1133c34f2..5cf53712c 100644
--- a/docs/zh/index.md
+++ b/docs/zh/index.md
@@ -4,28 +4,28 @@ layout: home
hero:
name: "DeepTutor"
text: "你的 AI 学习伙伴"
- tagline: 将任何文档转化为互动学习体验
+ tagline: 将任何文档转化为多智能体驱动的互动学习体验
image:
src: /logo.png
alt: DeepTutor
actions:
- theme: brand
text: 快速开始 →
- link: /zh/guide/getting-started
+ link: /zh/guide/pre-config
- theme: alt
text: GitHub
link: https://github.com/HKUDS/DeepTutor
- - theme: alt
- text: 🚀 路线图
- link: /zh/roadmap
features:
+ - icon: 📚
+ title: 海量文档问答
+ details: 上传教材、论文和手册,构建基于 RAG 和知识图谱的 AI 知识库。
- icon: 🧠
title: 智能解题
- details: 双循环推理架构,提供逐步解答和文档精准引用。
+ details: 双循环推理架构配合多智能体协作,提供带有精准文档引用的逐步解答。
- icon: 🎯
title: 题目生成
- details: 基于上传材料生成自定义测验或模拟真实考试。
+ details: 基于知识库生成自定义测验,或模拟真实考试风格进行练习。
- icon: 🎓
title: 引导学习
details: 个性化学习路径,配合交互式可视化和自适应讲解。
@@ -33,55 +33,45 @@ features:
title: 深度研究
details: 系统化主题探索,整合网络搜索、论文检索和文献综合。
- icon: 💡
- title: 想法生成
- details: 自动化概念综合和新颖性评估,助力头脑风暴。
- - icon: ✏️
- title: 协作写作
- details: AI 辅助写作,智能编辑、自动标注和语音朗读。
+ title: 灵感生成
+ details: AI 辅助头脑风暴,知识提取与多阶段筛选。
---
+## 为什么选择 DeepTutor?
+
+- **深度理解** — 不只是答案,而是带有可视化讲解的引导式学习之旅
+- **多模态支持** — PDF、LaTeX、图片、代码执行等全面支持
+- **知识图谱** — 基于 LightRAG 的语义连接,实现更好的理解
+- **一站式平台** — 解题、题目生成、研究、灵感生成集于一体
+
<style>
:root {
--vp-home-hero-name-color: transparent;
--vp-home-hero-name-background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
--vp-home-hero-image-background-image: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.2) 50%, rgba(240, 147, 251, 0.15) 100%);
- --vp-home-hero-image-filter: blur(68px);
+ --vp-home-hero-image-filter: blur(72px);
}
.dark {
--vp-home-hero-image-background-image: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 50%, rgba(240, 147, 251, 0.1) 100%);
}
-/* DeepTutor 标题更大 */
.VPHero .name {
- font-size: 4rem !important;
+ font-size: 4.5rem !important;
line-height: 1.1 !important;
}
.VPHero .text {
- font-size: 2.2rem !important;
+ font-size: 2.4rem !important;
font-weight: 600 !important;
- color: var(--vp-c-text-1);
}
@media (max-width: 768px) {
.VPHero .name {
- font-size: 2.8rem !important;
+ font-size: 3rem !important;
}
.VPHero .text {
- font-size: 1.6rem !important;
+ font-size: 1.8rem !important;
}
}
-
-/* Hero 区域 Roadmap 按钮特殊样式 */
-.VPButton.alt[href="/DeepTutor/zh/roadmap"] {
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
- color: white !important;
- border: none !important;
-}
-
-.VPButton.alt[href="/DeepTutor/zh/roadmap"]:hover {
- box-shadow: 0 4px 16px rgba(102, 126, 234, 0.5);
- transform: translateY(-2px);
-}
</style>
diff --git a/scripts/audit_prompts.py b/scripts/audit_prompts.py
index 7efcd2100..29db1e47d 100644
--- a/scripts/audit_prompts.py
+++ b/scripts/audit_prompts.py
@@ -16,15 +16,14 @@ Usage:
from __future__ import annotations
import argparse
-import re
-import sys
from dataclasses import dataclass
from pathlib import Path
+import re
+import sys
from typing import Any, Iterable
import yaml
-
PROJECT_ROOT = Path(__file__).resolve().parents[1]
AGENTS_DIR = PROJECT_ROOT / "src" / "agents"
@@ -178,4 +177,3 @@ def main() -> int:
if __name__ == "__main__":
raise SystemExit(main())
-
diff --git a/scripts/sync_prompts_from_en.py b/scripts/sync_prompts_from_en.py
index ad5160682..544489ea5 100644
--- a/scripts/sync_prompts_from_en.py
+++ b/scripts/sync_prompts_from_en.py
@@ -15,13 +15,12 @@ NOTE: This tool does NOT translate. It inserts TODO markers to be manually rewri
from __future__ import annotations
import argparse
-import sys
from pathlib import Path
+import sys
from typing import Any
import yaml
-
PROJECT_ROOT = Path(__file__).resolve().parents[1]
AGENTS_DIR = PROJECT_ROOT / "src" / "agents"
@@ -54,7 +53,9 @@ def _merge_missing(en_obj: Any, zh_obj: Any) -> tuple[Any, int]:
zh_obj[k] = f"<<TODO_TRANSLATE>> {v}"
else:
# For non-string nodes, insert scaffold recursively
- zh_obj[k], inc = _merge_missing(v, {} if isinstance(v, dict) else [] if isinstance(v, list) else None)
+ zh_obj[k], inc = _merge_missing(
+ v, {} if isinstance(v, dict) else [] if isinstance(v, list) else None
+ )
added += inc
else:
zh_obj[k], inc = _merge_missing(v, zh_obj[k])
@@ -136,10 +137,11 @@ def main() -> int:
if args.write:
print(f"Updated {total_files} file(s), added {total_added} key(s).")
else:
- print(f"Dry-run: would update {total_files} file(s), add {total_added} key(s). Use --write to apply.")
+ print(
+ f"Dry-run: would update {total_files} file(s), add {total_added} key(s). Use --write to apply."
+ )
return 0
if __name__ == "__main__":
raise SystemExit(main())
-
diff --git a/src/agents/solve/__init__.py b/src/agents/solve/__init__.py
index d0f00f105..03a5db1f1 100644
--- a/src/agents/solve/__init__.py
+++ b/src/agents/solve/__init__.py
@@ -33,9 +33,6 @@ from .analysis_loop import (
# Main controller
from .main_solver import MainSolver
-
-# Session management
-from .session_manager import SolverSessionManager, get_solver_session_manager
from .memory import (
InvestigateMemory,
KnowledgeItem,
@@ -45,6 +42,9 @@ from .memory import (
ToolCallRecord,
)
+# Session management
+from .session_manager import SolverSessionManager, get_solver_session_manager
+
# Solve loop
from .solve_loop import (
ManagerAgent,
diff --git a/src/agents/solve/session_manager.py b/src/agents/solve/session_manager.py
index 764169c81..e739a88de 100644
--- a/src/agents/solve/session_manager.py
+++ b/src/agents/solve/session_manager.py
@@ -112,7 +112,8 @@ class SolverSessionManager:
"title": title[:100], # Limit title length
"messages": [],
"kb_name": kb_name,
- "token_stats": token_stats or {
+ "token_stats": token_stats
+ or {
"model": "Unknown",
"calls": 0,
"tokens": 0,
diff --git a/src/api/routers/co_writer.py b/src/api/routers/co_writer.py
index 2cf5f5f83..3ae4833ff 100644
--- a/src/api/routers/co_writer.py
+++ b/src/api/routers/co_writer.py
@@ -23,8 +23,8 @@ from src.agents.co_writer.edit_agent import (
from src.agents.co_writer.narrator_agent import NarratorAgent
from src.logging import get_logger
from src.services.config import load_config_with_main
-from src.services.tts import get_tts_config
from src.services.settings.interface_settings import get_ui_language
+from src.services.tts import get_tts_config
router = APIRouter()
diff --git a/src/api/routers/knowledge.py b/src/api/routers/knowledge.py
index 4d0eb8dd6..1219239f2 100644
--- a/src/api/routers/knowledge.py
+++ b/src/api/routers/knowledge.py
@@ -145,7 +145,7 @@ async def run_upload_processing_task(
folder_id: str = None,
):
"""Background task for processing uploaded files.
-
+
Args:
kb_name: Knowledge base name
base_dir: Base directory for knowledge bases
@@ -182,7 +182,7 @@ async def run_upload_processing_task(
# Stage files and check for duplicates
staged_files = adder.add_documents(uploaded_file_paths, allow_duplicates=False)
-
+
if not staged_files:
logger.info(f"[{task_id}] No new files to process (all duplicates or invalid)")
progress_tracker.update(
diff --git a/src/knowledge/add_documents.py b/src/knowledge/add_documents.py
index 74a1f68e1..7d845cbc9 100644
--- a/src/knowledge/add_documents.py
+++ b/src/knowledge/add_documents.py
@@ -27,14 +27,14 @@ from typing import Any, Dict, List
from dotenv import load_dotenv
-# Load LLM config early to ensure OPENAI_API_KEY env var is set before LightRAG imports
-# This is critical because LightRAG reads os.environ["OPENAI_API_KEY"] directly
-from src.services.llm.config import get_llm_config as _early_config_load # noqa: F401
-
from src.knowledge.extract_numbered_items import process_content_list
from src.logging import LightRAGLogContext, get_logger
from src.services.llm import get_llm_config
+# Load LLM config early to ensure OPENAI_API_KEY env var is set before LightRAG imports
+# This is critical because LightRAG reads os.environ["OPENAI_API_KEY"] directly
+from src.services.llm.config import get_llm_config as _early_config_load # noqa: F401
+
logger = get_logger("KnowledgeInit")
# Default base directory for knowledge bases
@@ -43,7 +43,7 @@ DEFAULT_BASE_DIR = "./data/knowledge_bases"
class DocumentAdder:
"""Add documents to existing knowledge base with Hash-validation.
-
+
Supports multiple RAG providers with lazy loading to avoid unnecessary imports:
- llamaindex: Only imports llama_index modules
- lightrag: Only imports lightrag modules (no raganything)
@@ -86,7 +86,7 @@ class DocumentAdder:
self.api_key = api_key
self.base_url = base_url
self.progress_tracker = progress_tracker
-
+
# IMPORTANT: rag_provider parameter is IGNORED for incremental add
# We always use the provider from KB metadata to ensure consistency
# This prevents mixing different index formats in the same KB
@@ -98,15 +98,15 @@ class DocumentAdder:
)
logger.info(f"Incremental add will use provider: {provider} (from KB metadata)")
self._ensure_working_directories()
-
+
def _get_provider_from_metadata(self) -> str:
"""
Get the RAG provider from KB metadata.
-
+
This is the ONLY source of truth for incremental adds - we must use
the same provider that was used during initialization to ensure
data consistency and correct storage format.
-
+
Returns:
Provider name (llamaindex, lightrag, raganything, raganything_docling)
"""
@@ -119,12 +119,12 @@ class DocumentAdder:
return provider
except Exception as e:
logger.warning(f"Failed to read provider from metadata: {e}")
-
+
# Fallback: detect from storage structure
llamaindex_storage = self.kb_dir / "llamaindex_storage"
if llamaindex_storage.exists():
return "llamaindex"
-
+
# Default to raganything for backward compatibility
return "raganything"
@@ -214,7 +214,7 @@ class DocumentAdder:
async def process_new_documents(self, new_files: List[Path]):
"""
Async phase: Ingests files into the RAG system.
-
+
Uses lazy loading to only import dependencies for the actual provider:
- llamaindex: Only imports llama_index
- lightrag: Only imports lightrag (no raganything)
@@ -245,7 +245,7 @@ class DocumentAdder:
Lazy imports llama_index only when needed.
"""
logger.info("Using LlamaIndex incremental add...")
-
+
# Lazy import llama_index
try:
from src.services.rag.pipelines.llamaindex import LlamaIndexPipeline
@@ -262,11 +262,11 @@ class DocumentAdder:
pipeline = LlamaIndexPipeline(kb_base_dir=str(self.base_dir))
file_paths = [str(f) for f in new_files]
-
+
# Use the new add_documents method for incremental add
processed_files = []
total_files = len(file_paths)
-
+
for idx, file_path in enumerate(file_paths, 1):
doc_file = Path(file_path)
try:
@@ -277,7 +277,7 @@ class DocumentAdder:
current=idx,
total=total_files,
)
-
+
# Use add_documents for incremental add
success = await pipeline.add_documents(self.kb_name, [file_path])
if success:
@@ -288,7 +288,7 @@ class DocumentAdder:
logger.error(f" ✗ Failed to index: {doc_file.name}")
except Exception as e:
logger.exception(f" ✗ Failed {doc_file.name}: {e}")
-
+
return processed_files
async def _process_lightrag(self, new_files: List[Path]) -> List[Path]:
@@ -297,7 +297,7 @@ class DocumentAdder:
Lazy imports lightrag only when needed - does NOT require raganything.
"""
logger.info("Using LightRAG incremental add (text-only)...")
-
+
# Lazy import lightrag
try:
from lightrag import LightRAG
@@ -308,9 +308,13 @@ class DocumentAdder:
f"Install with: pip install lightrag. Error: {e}"
) from e
- from src.services.rag.components.routing import FileTypeRouter
- from src.services.embedding import get_embedding_client, get_embedding_config, reset_embedding_client
+ from src.services.embedding import (
+ get_embedding_client,
+ get_embedding_config,
+ reset_embedding_client,
+ )
from src.services.llm import get_llm_client
+ from src.services.rag.components.routing import FileTypeRouter
# Pre-import progress stage if needed
ProgressStage: Any = None
@@ -343,8 +347,9 @@ class DocumentAdder:
embedding_func=embedding_func,
)
await rag.initialize_storages()
-
+
from lightrag.kg.shared_storage import initialize_pipeline_status
+
await initialize_pipeline_status()
# Classify files
@@ -423,17 +428,19 @@ class DocumentAdder:
return processed_files
- async def _process_raganything(self, new_files: List[Path], parser: str = "mineru") -> List[Path]:
+ async def _process_raganything(
+ self, new_files: List[Path], parser: str = "mineru"
+ ) -> List[Path]:
"""
Incremental add for RAGAnything pipeline (multimodal).
Lazy imports raganything only when needed.
-
+
Args:
parser: "mineru" for RAGAnything, "docling" for RAGAnything Docling
"""
parser_name = "MinerU" if parser == "mineru" else "Docling"
logger.info(f"Using RAGAnything incremental add with {parser_name} parser...")
-
+
# Lazy import raganything
try:
# Add RAG-Anything to path if needed
@@ -441,22 +448,26 @@ class DocumentAdder:
raganything_path = project_root.parent / "raganything" / "RAG-Anything"
if raganything_path.exists() and str(raganything_path) not in sys.path:
sys.path.insert(0, str(raganything_path))
-
- from raganything import RAGAnything, RAGAnythingConfig
+
from lightrag.utils import EmbeddingFunc
+ from raganything import RAGAnything, RAGAnythingConfig
except ImportError as e:
raise ImportError(
f"RAGAnything dependencies not installed. "
f"Please install raganything package. Error: {e}"
) from e
+ from src.services.embedding import (
+ get_embedding_client,
+ get_embedding_config,
+ reset_embedding_client,
+ )
+ from src.services.llm import get_llm_client
from src.services.rag.components.routing import FileTypeRouter
from src.services.rag.utils.image_migration import (
cleanup_parser_output_dirs,
migrate_images_and_update_paths,
)
- from src.services.embedding import get_embedding_client, get_embedding_config, reset_embedding_client
- from src.services.llm import get_llm_client
# Pre-import progress stage if needed
ProgressStage: Any = None
@@ -542,7 +553,7 @@ class DocumentAdder:
)
# Step 2: Migrate images
- logger.info(f" Step 2/3: Migrating images...")
+ logger.info(" Step 2/3: Migrating images...")
updated_content_list, num_migrated = await migrate_images_and_update_paths(
content_list=content_list,
source_base_dir=self.content_list_dir,
@@ -557,7 +568,7 @@ class DocumentAdder:
json.dump(updated_content_list, f, ensure_ascii=False, indent=2)
# Step 3: Insert into RAG
- logger.info(f" Step 3/3: Inserting into knowledge graph...")
+ logger.info(" Step 3/3: Inserting into knowledge graph...")
await rag.insert_content_list(
content_list=updated_content_list,
file_path=str(doc_file),
@@ -612,10 +623,11 @@ class DocumentAdder:
async def _extract_text_basic(self, file_path: Path) -> str:
"""Basic text extraction for LightRAG (text-only pipeline)."""
suffix = file_path.suffix.lower()
-
+
if suffix == ".pdf":
try:
import fitz # PyMuPDF
+
doc = fitz.open(file_path)
texts = []
for page in doc:
@@ -745,7 +757,7 @@ class DocumentAdder:
def update_metadata(self, added_count: int):
"""Update metadata after incremental add.
-
+
Note: We do NOT update rag_provider here - incremental adds must use
the same provider as the original initialization for consistency.
"""
diff --git a/src/knowledge/initializer.py b/src/knowledge/initializer.py
index 81bc9d7b2..98aa0dc76 100644
--- a/src/knowledge/initializer.py
+++ b/src/knowledge/initializer.py
@@ -91,6 +91,7 @@ class KnowledgeBaseInitializer:
def _get_file_hash(self, file_path: Path) -> str:
"""Calculate SHA-256 hash of a file."""
import hashlib
+
sha256_hash = hashlib.sha256()
chunk_size = 65536 # 64KB
with open(file_path, "rb") as f:
diff --git a/src/services/llm/capabilities.py b/src/services/llm/capabilities.py
index ff95a5cd1..035dc4b5b 100644
--- a/src/services/llm/capabilities.py
+++ b/src/services/llm/capabilities.py
@@ -348,4 +348,5 @@ __all__ = [
"has_thinking_tags",
"supports_tools",
"requires_api_version",
- "get_effective_temperature",]
+ "get_effective_temperature",
+]
diff --git a/src/services/llm/cloud_provider.py b/src/services/llm/cloud_provider.py
index 41712751a..fab533437 100644
--- a/src/services/llm/cloud_provider.py
+++ b/src/services/llm/cloud_provider.py
@@ -296,9 +296,7 @@ async def _openai_stream(
data = {
"model": model,
"messages": msg_list,
- "temperature": get_effective_temperature(
- binding, model, kwargs.get("temperature", 0.7)
- ),
+ "temperature": get_effective_temperature(binding, model, kwargs.get("temperature", 0.7)),
"stream": True,
}
diff --git a/src/services/rag/pipelines/llamaindex.py b/src/services/rag/pipelines/llamaindex.py
index 1fae7528d..4a0fd1add 100644
--- a/src/services/rag/pipelines/llamaindex.py
+++ b/src/services/rag/pipelines/llamaindex.py
@@ -295,32 +295,30 @@ class LlamaIndexPipeline:
async def add_documents(self, kb_name: str, file_paths: List[str], **kwargs) -> bool:
"""
Incrementally add documents to an existing LlamaIndex KB.
-
+
If the storage directory exists, loads the existing index and inserts
new documents. Otherwise, creates a new index.
-
+
Args:
kb_name: Knowledge base name
file_paths: List of file paths to add
**kwargs: Additional arguments
-
+
Returns:
True if successful
"""
- self.logger.info(
- f"Adding {len(file_paths)} documents to KB '{kb_name}' using LlamaIndex"
- )
-
+ self.logger.info(f"Adding {len(file_paths)} documents to KB '{kb_name}' using LlamaIndex")
+
kb_dir = Path(self.kb_base_dir) / kb_name
storage_dir = kb_dir / "llamaindex_storage"
-
+
try:
# Parse new documents
documents = []
for file_path in file_paths:
file_path = Path(file_path)
self.logger.info(f"Parsing: {file_path.name}")
-
+
# Extract text based on file type
if file_path.suffix.lower() == ".pdf":
text = self._extract_pdf_text(file_path)
@@ -331,7 +329,7 @@ class LlamaIndexPipeline:
except UnicodeDecodeError:
with open(file_path, "r", encoding="latin-1") as f:
text = f.read()
-
+
if text.strip():
doc = Document(
text=text,
@@ -344,50 +342,51 @@ class LlamaIndexPipeline:
self.logger.info(f"Loaded: {file_path.name} ({len(text)} chars)")
else:
self.logger.warning(f"Skipped empty document: {file_path.name}")
-
+
if not documents:
self.logger.warning("No valid documents to add")
return False
-
+
loop = asyncio.get_event_loop()
-
+
if storage_dir.exists():
# Load existing index and insert new documents
self.logger.info(f"Loading existing index from {storage_dir}...")
-
+
def load_and_insert():
storage_context = StorageContext.from_defaults(persist_dir=str(storage_dir))
index = load_index_from_storage(storage_context)
-
+
# Insert new documents
for doc in documents:
index.insert(doc)
-
+
# Persist updated index
index.storage_context.persist(persist_dir=str(storage_dir))
return len(documents)
-
+
num_added = await loop.run_in_executor(None, load_and_insert)
self.logger.info(f"Added {num_added} documents to existing index")
else:
# Create new index (first time)
self.logger.info(f"Creating new index with {len(documents)} documents...")
storage_dir.mkdir(parents=True, exist_ok=True)
-
+
def create_index():
index = VectorStoreIndex.from_documents(documents, show_progress=True)
index.storage_context.persist(persist_dir=str(storage_dir))
return len(documents)
-
+
num_added = await loop.run_in_executor(None, create_index)
self.logger.info(f"Created new index with {num_added} documents")
-
+
self.logger.info(f"Successfully added documents to KB '{kb_name}'")
return True
-
+
except Exception as e:
self.logger.error(f"Failed to add documents: {e}")
import traceback
+
self.logger.error(traceback.format_exc())
return False
diff --git a/src/services/settings/__init__.py b/src/services/settings/__init__.py
index 8c122139e..ae25286e3 100644
--- a/src/services/settings/__init__.py
+++ b/src/services/settings/__init__.py
@@ -1,2 +1 @@
"""User interface (UI) settings helpers."""
-
diff --git a/src/services/settings/interface_settings.py b/src/services/settings/interface_settings.py
index de0ff62e6..85edab724 100644
--- a/src/services/settings/interface_settings.py
+++ b/src/services/settings/interface_settings.py
@@ -11,11 +11,8 @@ import json
from pathlib import Path
from typing import Any
-
PROJECT_ROOT = Path(__file__).resolve().parents[3]
-INTERFACE_SETTINGS_FILE = (
- PROJECT_ROOT / "data" / "user" / "settings" / "interface.json"
-)
+INTERFACE_SETTINGS_FILE = PROJECT_ROOT / "data" / "user" / "settings" / "interface.json"
DEFAULT_UI_SETTINGS: dict[str, Any] = {
"theme": "light",
@@ -79,4 +76,3 @@ def get_ui_language(default: str = "en") -> str:
"""
settings = get_ui_settings()
return _normalize_language(settings.get("language"), default)
-
diff --git a/tests/core/test_prompt_parity.py b/tests/core/test_prompt_parity.py
index ae31e318a..76a234f48 100644
--- a/tests/core/test_prompt_parity.py
+++ b/tests/core/test_prompt_parity.py
@@ -1,12 +1,11 @@
from __future__ import annotations
-import re
from pathlib import Path
+import re
from typing import Any, Iterable
import yaml
-
PROJECT_ROOT = Path(__file__).resolve().parents[2]
AGENTS_DIR = PROJECT_ROOT / "src" / "agents"
@@ -84,9 +83,7 @@ def test_prompts_key_and_placeholder_parity():
for lang_name, target_file in candidates:
if not target_file.exists():
- failures.append(
- f"[MISSING {lang_name}] {module_dir.name}: {rel.as_posix()}"
- )
+ failures.append(f"[MISSING {lang_name}] {module_dir.name}: {rel.as_posix()}")
continue
target_obj = _load_yaml(target_file)
@@ -114,4 +111,3 @@ def test_prompts_key_and_placeholder_parity():
failures.append("\n".join(msg))
assert not failures, "Prompt parity failures:\n" + "\n\n".join(failures)
-
diff --git a/tests/services/rag/test_rag_pipelines.py b/tests/services/rag/test_rag_pipelines.py
index ede85ee51..9b499816a 100644
--- a/tests/services/rag/test_rag_pipelines.py
+++ b/tests/services/rag/test_rag_pipelines.py
@@ -172,6 +172,7 @@ class TestPipelineFactory(unittest.IsolatedAsyncioTestCase):
async def test_get_pipeline_llamaindex(self):
"""Test getting LlamaIndex pipeline"""
from src.services.rag.factory import get_pipeline
+
try:
pipeline = get_pipeline("llamaindex")
except ValueError as e:
@@ -184,7 +185,6 @@ class TestPipelineFactory(unittest.IsolatedAsyncioTestCase):
self.assertTrue(hasattr(pipeline, "delete"))
print(f"\n✓ LlamaIndex pipeline created: {type(pipeline).__name__}")
-
async def test_get_pipeline_invalid(self):
"""Test getting invalid pipeline raises error"""
from src.services.rag.factory import get_pipeline
@@ -369,8 +369,6 @@ class TestLightRAGPipeline(unittest.IsolatedAsyncioTestCase, RAGPipelineTestBase
print("\n⚠ Note: LightRAG pipeline requires RAG-Anything for search/indexing")
-
-
class TestRAGToolWithProviders(unittest.IsolatedAsyncioTestCase, RAGPipelineTestBase):
"""Test rag_tool.py with different providers"""
diff --git a/web/.env.local b/web/.env.local
index 0b6543af3..8840a64d6 100644
--- a/web/.env.local
+++ b/web/.env.local
@@ -3,7 +3,7 @@
# ============================================
# This file is automatically updated based on config/main.yaml
# and environment variables (NEXT_PUBLIC_API_BASE, NEXT_PUBLIC_API_BASE_EXTERNAL)
-#
+#
# To configure for remote access, set in your .env file:
# NEXT_PUBLIC_API_BASE=http://your-server-ip:8001
# ============================================
diff --git a/web/app/guide/hooks/useGuideSession.ts b/web/app/guide/hooks/useGuideSession.ts
index 28dd3b16b..908d3a49c 100644
--- a/web/app/guide/hooks/useGuideSession.ts
+++ b/web/app/guide/hooks/useGuideSession.ts
@@ -31,7 +31,9 @@ export function useGuideSession() {
const isHydrated = useRef(false);
// Initialize with defaults (same on server and client)
- const [sessionState, setSessionState] = useState<SessionState>(INITIAL_SESSION_STATE);
+ const [sessionState, setSessionState] = useState<SessionState>(
+ INITIAL_SESSION_STATE,
+ );
const [chatMessages, setChatMessages] = useState<ChatMessage[]>([]);
const [isLoading, setIsLoading] = useState(false);
const [loadingMessage, setLoadingMessage] = useState("");
@@ -40,8 +42,8 @@ export function useGuideSession() {
const saveSessionState = useMemo(
() =>
debounce((state: SessionState) => {
- const toSave = persistState(state, GUIDE_SESSION_EXCLUDE);
- saveToStorage(STORAGE_KEYS.GUIDE_SESSION, toSave);
+ const toSave = persistState(state, GUIDE_SESSION_EXCLUDE);
+ saveToStorage(STORAGE_KEYS.GUIDE_SESSION, toSave);
}, 500),
[],
);
@@ -60,14 +62,14 @@ export function useGuideSession() {
const persistedSession = loadFromStorage<Partial<SessionState>>(
STORAGE_KEYS.GUIDE_SESSION,
- {}
+ {},
);
const persistedChat = loadFromStorage<ChatMessage[]>(GUIDE_CHAT_KEY, []);
if (Object.keys(persistedSession).length > 0) {
// eslint-disable-next-line react-hooks/set-state-in-effect -- hydration restore
setSessionState((prev) =>
- mergeWithDefaults(persistedSession, prev, GUIDE_SESSION_EXCLUDE)
+ mergeWithDefaults(persistedSession, prev, GUIDE_SESSION_EXCLUDE),
);
}
diff --git a/web/app/guide/page.tsx b/web/app/guide/page.tsx
index aecc04392..2185b1d5c 100644
--- a/web/app/guide/page.tsx
+++ b/web/app/guide/page.tsx
@@ -141,7 +141,9 @@ export default function GuidePage() {
<button
onClick={() => setSidebarCollapsed(!sidebarCollapsed)}
className="p-2 bg-white dark:bg-slate-800 border border-slate-200 dark:border-slate-600 rounded-lg shadow-sm hover:bg-slate-50 dark:hover:bg-slate-700 transition-all"
- title={sidebarCollapsed ? t("Expand sidebar") : t("Collapse sidebar")}
+ title={
+ sidebarCollapsed ? t("Expand sidebar") : t("Collapse sidebar")
+ }
>
{sidebarCollapsed ? (
<ChevronRight className="w-4 h-4 text-slate-600 dark:text-slate-300" />
diff --git a/web/app/history/page.tsx b/web/app/history/page.tsx
index 1cd8413f7..136d3b7f1 100644
--- a/web/app/history/page.tsx
+++ b/web/app/history/page.tsx
@@ -99,14 +99,16 @@ export default function HistoryPage() {
const [solverSessions, setSolverSessions] = useState<SolverSession[]>([]);
const [loading, setLoading] = useState(true);
const [loadingSessionId, setLoadingSessionId] = useState<string | null>(null);
- const [loadingSolverSessionId, setLoadingSolverSessionId] = useState<string | null>(null);
+ const [loadingSolverSessionId, setLoadingSolverSessionId] = useState<
+ string | null
+ >(null);
const [selectedEntry, setSelectedEntry] = useState<HistoryEntry | null>(null);
const [selectedChatSession, setSelectedChatSession] = useState<string | null>(
null,
);
- const [selectedSolverSession, setSelectedSolverSession] = useState<string | null>(
- null,
- );
+ const [selectedSolverSession, setSelectedSolverSession] = useState<
+ string | null
+ >(null);
const [filterType, setFilterType] = useState<string>("all");
const [searchQuery, setSearchQuery] = useState("");
@@ -114,7 +116,10 @@ export default function HistoryPage() {
setLoading(true);
try {
// Fetch regular activity history
- if (filterType === "all" || (filterType !== "chat" && filterType !== "solve")) {
+ if (
+ filterType === "all" ||
+ (filterType !== "chat" && filterType !== "solve")
+ ) {
const typeParam = filterType !== "all" ? `&type=${filterType}` : "";
const res = await fetch(
apiUrl(`/api/v1/dashboard/recent?limit=50${typeParam}`),
@@ -221,7 +226,8 @@ export default function HistoryPage() {
dateKey = formatDate(date, uiSettings.language, {
month: "long",
day: "numeric",
- year: date.getFullYear() !== today.getFullYear() ? "numeric" : undefined,
+ year:
+ date.getFullYear() !== today.getFullYear() ? "numeric" : undefined,
});
}
@@ -311,7 +317,9 @@ export default function HistoryPage() {
<div className="w-8 h-8 border-2 border-blue-500 border-t-transparent rounded-full animate-spin mx-auto mb-4"></div>
{t("Loading")}...
</div>
- ) : filteredEntries.length === 0 && chatSessions.length === 0 && solverSessions.length === 0 ? (
+ ) : filteredEntries.length === 0 &&
+ chatSessions.length === 0 &&
+ solverSessions.length === 0 ? (
<div className="p-12 text-center">
<div className="w-16 h-16 bg-slate-50 dark:bg-slate-700 rounded-full flex items-center justify-center mx-auto mb-4">
<History className="w-8 h-8 text-slate-300 dark:text-slate-500" />
@@ -521,7 +529,9 @@ export default function HistoryPage() {
.map((session) => (
<div
key={session.session_id}
- onClick={() => setSelectedSolverSession(session.session_id)}
+ onClick={() =>
+ setSelectedSolverSession(session.session_id)
+ }
className="px-5 py-4 hover:bg-slate-50 dark:hover:bg-slate-700/50 transition-colors group cursor-pointer"
>
<div className="flex gap-4">
@@ -555,11 +565,12 @@ export default function HistoryPage() {
KB: {session.kb_name}
</span>
)}
- {session.token_stats?.cost !== undefined && session.token_stats.cost > 0 && (
- <span className="text-xs text-amber-500">
- ${session.token_stats.cost.toFixed(4)}
- </span>
- )}
+ {session.token_stats?.cost !== undefined &&
+ session.token_stats.cost > 0 && (
+ <span className="text-xs text-amber-500">
+ ${session.token_stats.cost.toFixed(4)}
+ </span>
+ )}
</div>
{session.last_message && (
<p className="text-sm text-slate-500 dark:text-slate-400 truncate mt-1">
@@ -583,7 +594,9 @@ export default function HistoryPage() {
e.stopPropagation();
handleLoadSolverSession(session.session_id);
}}
- disabled={loadingSolverSessionId === session.session_id}
+ disabled={
+ loadingSolverSessionId === session.session_id
+ }
className="px-3 py-1.5 text-xs font-medium bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 rounded-lg hover:bg-blue-200 dark:hover:bg-blue-900/50 transition-colors flex items-center gap-1.5 disabled:opacity-50"
>
{loadingSolverSessionId === session.session_id ? (
diff --git a/web/app/ideagen/page.tsx b/web/app/ideagen/page.tsx
index ccb6f622c..e77fe981d 100644
--- a/web/app/ideagen/page.tsx
+++ b/web/app/ideagen/page.tsx
@@ -339,10 +339,9 @@ export default function IdeaGenPage() {
const combinedIdea: ResearchIdea = {
id: "combined",
knowledge_point: t("Collection of Research Ideas"),
- description: t("Research ideas containing {n} knowledge points").replace(
- "{n}",
- String(selected.length),
- ),
+ description: t(
+ "Research ideas containing {n} knowledge points",
+ ).replace("{n}", String(selected.length)),
research_ideas: selected.flatMap((i) => i.research_ideas),
statement: selected.map((i) => i.statement).join("\n\n---\n\n"),
expanded: false,
@@ -534,7 +533,9 @@ export default function IdeaGenPage() {
<div className="p-3 border-t border-slate-100 dark:border-slate-700 bg-slate-50/50 dark:bg-slate-800/50">
<label className="text-xs font-bold text-slate-500 dark:text-slate-400 uppercase tracking-wider block mb-2">
{t("Your Thoughts")}{" "}
- {selectedRecords.size > 0 ? `(${t("Optional")})` : `(${t("Required")})`}
+ {selectedRecords.size > 0
+ ? `(${t("Optional")})`
+ : `(${t("Required")})`}
</label>
<textarea
value={userThoughts}
diff --git a/web/app/knowledge/page.tsx b/web/app/knowledge/page.tsx
index ed04360a0..1d8a8ab31 100644
--- a/web/app/knowledge/page.tsx
+++ b/web/app/knowledge/page.tsx
@@ -747,7 +747,6 @@ export default function KnowledgePage() {
});
kbsNamesRef.current = kbs.map((kb) => kb.name);
-
}, [kbs, loading]);
// Cleanup all connections on component unmount
@@ -1411,20 +1410,21 @@ export default function KnowledgePage() {
}
// Fallback descriptions
const fallbackDescriptions: Record<string, string> = {
- llamaindex:
- t("Pure vector retrieval, fastest processing speed."),
- lightrag:
- t(
- "Lightweight knowledge graph retrieval, fast processing of text documents.",
- ),
- raganything:
- t(
- "Multimodal document processing with chart and formula extraction, builds knowledge graphs.",
- ),
+ llamaindex: t(
+ "Pure vector retrieval, fastest processing speed.",
+ ),
+ lightrag: t(
+ "Lightweight knowledge graph retrieval, fast processing of text documents.",
+ ),
+ raganything: t(
+ "Multimodal document processing with chart and formula extraction, builds knowledge graphs.",
+ ),
};
return (
fallbackDescriptions[ragProvider] ||
- t("Select a RAG pipeline suitable for your document type")
+ t(
+ "Select a RAG pipeline suitable for your document type",
+ )
);
})()}
</p>
@@ -1604,8 +1604,14 @@ export default function KnowledgePage() {
{ragProvider === "llamaindex" && t("LlamaIndex")}
{ragProvider === "lightrag" && t("LightRAG")}
{ragProvider === "raganything" && t("RAG-Anything")}
- {ragProvider === "raganything_docling" && t("RAG-Anything (Docling)")}
- {!["llamaindex", "lightrag", "raganything", "raganything_docling"].includes(ragProvider) && ragProvider}
+ {ragProvider === "raganything_docling" &&
+ t("RAG-Anything (Docling)")}
+ {![
+ "llamaindex",
+ "lightrag",
+ "raganything",
+ "raganything_docling",
+ ].includes(ragProvider) && ragProvider}
</div>
<p className="text-xs text-slate-500 dark:text-slate-400 mt-1">
{t("Keep unchanged to use this KB's existing provider")}
@@ -1674,7 +1680,7 @@ export default function KnowledgePage() {
}}
className="text-xs text-red-500 hover:text-red-600 dark:text-red-400 dark:hover:text-red-300 font-medium"
>
- {t("Clear all")}
+ {t("Clear all")}
</button>
</div>
<div className="space-y-1">
diff --git a/web/app/notebook/page.tsx b/web/app/notebook/page.tsx
index d90d59817..b77ba737d 100644
--- a/web/app/notebook/page.tsx
+++ b/web/app/notebook/page.tsx
@@ -686,7 +686,9 @@ export default function NotebookPage() {
{t("No records yet")}
</p>
<p className="text-slate-400 dark:text-slate-500 text-xs mt-1">
- {t("Add records from Solver, Question, Research, or Co-Writer")}
+ {t(
+ "Add records from Solver, Question, Research, or Co-Writer",
+ )}
</p>
</div>
) : (
@@ -873,9 +875,9 @@ export default function NotebookPage() {
{/* Output */}
<div>
- <h3 className="text-xs font-bold text-slate-500 dark:text-slate-400 uppercase tracking-wider mb-2">
- {t("Output")}
- </h3>
+ <h3 className="text-xs font-bold text-slate-500 dark:text-slate-400 uppercase tracking-wider mb-2">
+ {t("Output")}
+ </h3>
<div className="p-4 bg-slate-50 dark:bg-slate-700/50 rounded-xl border border-slate-100 dark:border-slate-600">
<div className="prose prose-slate dark:prose-invert max-w-none prose-sm">
<ReactMarkdown
diff --git a/web/app/page.tsx b/web/app/page.tsx
index 114b3004f..3fa979d5b 100644
--- a/web/app/page.tsx
+++ b/web/app/page.tsx
@@ -399,7 +399,10 @@ export default function HomePage() {
</div>
{/* Messages Area */}
- <div ref={messagesContainerRef} className="flex-1 overflow-y-auto px-6 py-6 space-y-6">
+ <div
+ ref={messagesContainerRef}
+ className="flex-1 overflow-y-auto px-6 py-6 space-y-6"
+ >
{chatState.messages.map((msg, idx) => (
<div
key={idx}
diff --git a/web/app/question/page.tsx b/web/app/question/page.tsx
index ada7e33ce..14c9489f9 100644
--- a/web/app/question/page.tsx
+++ b/web/app/question/page.tsx
@@ -219,7 +219,8 @@ export default function QuestionPage() {
<div className="flex items-center gap-2 px-3 py-1 bg-purple-50 dark:bg-purple-900/30 text-purple-600 dark:text-purple-400 rounded-full">
<Loader2 className="w-3.5 h-3.5 animate-spin" />
<span>
- {t("Generating")} {totalQuestions}/{questionState.count}...
+ {t("Generating")} {totalQuestions}/{questionState.count}
+ ...
</span>
</div>
) : isComplete ? (
@@ -320,8 +321,12 @@ export default function QuestionPage() {
</h3>
<p className="text-sm text-slate-600 dark:text-slate-400">
{questionState.mode === "knowledge"
- ? t("Generate questions based on knowledge base content")
- : t("Generate similar questions based on an exam paper")}
+ ? t(
+ "Generate questions based on knowledge base content",
+ )
+ : t(
+ "Generate similar questions based on an exam paper",
+ )}
</p>
</div>
</div>
@@ -469,9 +474,13 @@ export default function QuestionPage() {
) : (
<div className="text-center text-slate-500 dark:text-slate-400">
<Upload className="w-8 h-8 mx-auto mb-2 text-slate-400" />
- <p className="font-medium">{t("Click to upload PDF")}</p>
+ <p className="font-medium">
+ {t("Click to upload PDF")}
+ </p>
<p className="text-xs">
- {t("The system will parse and generate questions")}
+ {t(
+ "The system will parse and generate questions",
+ )}
</p>
</div>
)}
@@ -781,7 +790,9 @@ export default function QuestionPage() {
</span>
<span className="text-xs px-1.5 py-0.5 bg-slate-200 dark:bg-slate-600 text-slate-500 rounded">
{currentQuestion.rounds || 1} {t("round")}
- {(currentQuestion.rounds || 1) > 1 ? t("s") : ""}
+ {(currentQuestion.rounds || 1) > 1
+ ? t("s")
+ : ""}
</span>
</div>
{showAnalysis ? (
diff --git a/web/app/research/page.tsx b/web/app/research/page.tsx
index bf1a60626..13132643c 100644
--- a/web/app/research/page.tsx
+++ b/web/app/research/page.tsx
@@ -115,10 +115,9 @@ export default function ResearchPage() {
{
id: "welcome",
role: "assistant",
- content:
- t(
- "Welcome to Deep Research Lab. \n\nPlease configure your settings above, then enter a research topic below.",
- ),
+ content: t(
+ "Welcome to Deep Research Lab. \n\nPlease configure your settings above, then enter a research topic below.",
+ ),
},
]);
}
@@ -354,7 +353,9 @@ export default function ResearchPage() {
onChange={(e) => setSelectedKb(e.target.value)}
className="w-full px-3 py-2 bg-slate-50 dark:bg-slate-700 border border-slate-200 dark:border-slate-600 rounded-lg text-sm text-slate-900 dark:text-slate-100 outline-none focus:ring-2 focus:ring-emerald-500/20"
>
- {kbs.length === 0 && <option value="">{t("Loading...")}</option>}
+ {kbs.length === 0 && (
+ <option value="">{t("Loading...")}</option>
+ )}
{kbs.map((kb) => (
<option key={kb} value={kb}>
{kb}
diff --git a/web/app/settings/components/ConfigForm.tsx b/web/app/settings/components/ConfigForm.tsx
index 7de75de6b..c0ff3c748 100644
--- a/web/app/settings/components/ConfigForm.tsx
+++ b/web/app/settings/components/ConfigForm.tsx
@@ -228,7 +228,9 @@ export default function ConfigForm({
}
} catch (e) {
setError(
- isEditMode ? t("Failed to update configuration") : t("Failed to add configuration"),
+ isEditMode
+ ? t("Failed to update configuration")
+ : t("Failed to add configuration"),
);
} finally {
setSaving(false);
diff --git a/web/app/settings/components/ConfigTab.tsx b/web/app/settings/components/ConfigTab.tsx
index ba9c93f02..4f53ae436 100644
--- a/web/app/settings/components/ConfigTab.tsx
+++ b/web/app/settings/components/ConfigTab.tsx
@@ -73,7 +73,8 @@ export default function ConfigTab({
};
const deleteConfig = async (configId: string) => {
- if (!confirm(t("Are you sure you want to delete this configuration?"))) return;
+ if (!confirm(t("Are you sure you want to delete this configuration?")))
+ return;
try {
const res = await fetch(
diff --git a/web/app/settings/page.tsx b/web/app/settings/page.tsx
index 49323d409..d540604c1 100644
--- a/web/app/settings/page.tsx
+++ b/web/app/settings/page.tsx
@@ -23,10 +23,14 @@ import { LANGUAGE_OPTIONS } from "./constants";
import { getStorageStats } from "@/lib/persistence";
export default function SettingsPage() {
- const { uiSettings, updateTheme, updateLanguage, clearAllPersistence } = useGlobal();
+ const { uiSettings, updateTheme, updateLanguage, clearAllPersistence } =
+ useGlobal();
const { t } = useTranslation();
const [showClearConfirm, setShowClearConfirm] = useState(false);
- const [storageStats, setStorageStats] = useState<{ totalSize: number; items: { key: string; size: number }[] } | null>(null);
+ const [storageStats, setStorageStats] = useState<{
+ totalSize: number;
+ items: { key: string; size: number }[];
+ } | null>(null);
// Load storage stats
useEffect(() => {
@@ -266,7 +270,12 @@ export default function SettingsPage() {
{/* Content */}
<div className="bg-white dark:bg-slate-800 rounded-2xl border border-slate-200 dark:border-slate-700 overflow-hidden">
{activeTab === "overview" && (
- <OverviewTab status={status} ports={ports} onRefresh={loadStatus} t={t} />
+ <OverviewTab
+ status={status}
+ ports={ports}
+ onRefresh={loadStatus}
+ t={t}
+ />
)}
{activeTab === "llm" && (
<ConfigTab
diff --git a/web/app/solver/page.tsx b/web/app/solver/page.tsx
index bfebde71b..a7d6f95b2 100644
--- a/web/app/solver/page.tsx
+++ b/web/app/solver/page.tsx
@@ -552,7 +552,9 @@ export default function SolverPage() {
</div>
</div>
<div className="text-center text-[10px] text-slate-400 dark:text-slate-500 mt-2">
- {t("DeepTutor can make mistakes. Please verify important information.")}
+ {t(
+ "DeepTutor can make mistakes. Please verify important information.",
+ )}
</div>
</div>
</div>
diff --git a/web/components/ActivityDetail.tsx b/web/components/ActivityDetail.tsx
index 421a10fda..9e110d192 100644
--- a/web/components/ActivityDetail.tsx
+++ b/web/components/ActivityDetail.tsx
@@ -17,7 +17,7 @@ function useIsClient() {
return useSyncExternalStore(
emptySubscribe,
() => true,
- () => false
+ () => false,
);
}
diff --git a/web/components/ChatSessionDetail.tsx b/web/components/ChatSessionDetail.tsx
index abc55171d..ca493451f 100644
--- a/web/components/ChatSessionDetail.tsx
+++ b/web/components/ChatSessionDetail.tsx
@@ -85,7 +85,9 @@ export default function ChatSessionDetail({
setSession(data);
} catch (err) {
const msg = err instanceof Error ? err.message : "Unknown error";
- setError(msg === "Failed to load session" ? t("Failed to load session") : msg);
+ setError(
+ msg === "Failed to load session" ? t("Failed to load session") : msg,
+ );
} finally {
setLoading(false);
}
diff --git a/web/components/CoMarkerEditor.tsx b/web/components/CoMarkerEditor.tsx
index 0353bee3c..5391254ae 100644
--- a/web/components/CoMarkerEditor.tsx
+++ b/web/components/CoMarkerEditor.tsx
@@ -1399,7 +1399,9 @@ export default function CoWriterEditor({
) : (
<>
<WifiOff className="w-3 h-3" />
- <span className="hidden sm:inline">{t("Disconnected")}</span>
+ <span className="hidden sm:inline">
+ {t("Disconnected")}
+ </span>
</>
)}
</div>
@@ -1836,7 +1838,8 @@ export default function CoWriterEditor({
</span>
</div>
<div className="text-xs text-slate-600 truncate mb-1">
- &quot;{op.input?.original_text?.substring(0, 35)}...&quot;
+ &quot;{op.input?.original_text?.substring(0, 35)}
+ ...&quot;
</div>
<div className="flex items-center gap-2 text-[10px] text-slate-400">
{op.source && (
@@ -1992,7 +1995,9 @@ export default function CoWriterEditor({
</p>
) : (
<span className="text-slate-400">
- {t("After generation, the narration script will appear here.")}
+ {t(
+ "After generation, the narration script will appear here.",
+ )}
</span>
)}
</div>
@@ -2014,7 +2019,9 @@ export default function CoWriterEditor({
</ul>
) : (
<div className="text-[11px] text-slate-400">
- {t("After generation, 3-5 key points will be listed here.")}
+ {t(
+ "After generation, 3-5 key points will be listed here.",
+ )}
</div>
)}
</div>
@@ -2041,7 +2048,9 @@ export default function CoWriterEditor({
}}
>
<source src={audioInfo.audioUrl} type="audio/mpeg" />
- {t("Your browser does not support the audio element.")}
+ {t(
+ "Your browser does not support the audio element.",
+ )}
</audio>
</div>
) : (
@@ -2064,7 +2073,9 @@ export default function CoWriterEditor({
<div className="fixed inset-0 bg-white/80 backdrop-blur-sm z-50 flex items-center justify-center">
<div className="bg-white p-8 rounded-2xl shadow-2xl flex flex-col items-center gap-4 border">
<Loader2 className="w-8 h-8 text-purple-600 animate-spin" />
- <span className="font-medium text-slate-700">{t("Exporting...")}</span>
+ <span className="font-medium text-slate-700">
+ {t("Exporting...")}
+ </span>
</div>
</div>
)}
diff --git a/web/components/CoWriterEditor.tsx b/web/components/CoWriterEditor.tsx
index a99189202..a563197f9 100644
--- a/web/components/CoWriterEditor.tsx
+++ b/web/components/CoWriterEditor.tsx
@@ -54,7 +54,11 @@ import rehypeKatex from "rehype-katex";
import rehypeRaw from "rehype-raw";
import "katex/dist/katex.min.css";
import { processLatexContent } from "@/lib/latex";
-import { loadFromStorage, saveToStorage, STORAGE_KEYS } from "@/lib/persistence";
+import {
+ loadFromStorage,
+ saveToStorage,
+ STORAGE_KEYS,
+} from "@/lib/persistence";
import { debounce } from "@/lib/debounce";
interface CoWriterEditorProps {
@@ -78,7 +82,9 @@ export default function CoWriterEditor({
const isHydrated = useRef(false);
// Initialize with default content (same on server and client)
- const [content, setContent] = useState(initialValue || DEFAULT_COWRITER_CONTENT);
+ const [content, setContent] = useState(
+ initialValue || DEFAULT_COWRITER_CONTENT,
+ );
// Debounced save for content
const saveContent = useCallback(
@@ -86,7 +92,7 @@ export default function CoWriterEditor({
if (!isHydrated.current) return;
saveToStorage(STORAGE_KEYS.COWRITER_CONTENT, text);
}, 1000), // 1 second debounce for content to avoid too frequent saves while typing
- []
+ [],
);
// Restore persisted content after hydration
@@ -97,10 +103,10 @@ export default function CoWriterEditor({
isHydrated.current = true;
return;
}
-
+
const persistedContent = loadFromStorage<string>(
STORAGE_KEYS.COWRITER_CONTENT,
- DEFAULT_COWRITER_CONTENT
+ DEFAULT_COWRITER_CONTENT,
);
if (persistedContent !== DEFAULT_COWRITER_CONTENT) {
setContent(persistedContent);
@@ -1444,7 +1450,9 @@ export default function CoWriterEditor({
) : (
<>
<WifiOff className="w-3 h-3" />
- <span className="hidden sm:inline">{t("Disconnected")}</span>
+ <span className="hidden sm:inline">
+ {t("Disconnected")}
+ </span>
</>
)}
</div>
@@ -1881,7 +1889,8 @@ export default function CoWriterEditor({
</span>
</div>
<div className="text-xs text-slate-600 dark:text-slate-400 truncate mb-1">
- &quot;{op.input?.original_text?.substring(0, 35)}...&quot;
+ &quot;{op.input?.original_text?.substring(0, 35)}
+ ...&quot;
</div>
<div className="flex items-center gap-2 text-[10px] text-slate-400 dark:text-slate-500">
{op.source && (
@@ -1949,7 +1958,9 @@ export default function CoWriterEditor({
onClick={async () => {
if (!content.trim()) {
setNarrationError(
- t("Current note is empty, cannot generate narration."),
+ t(
+ "Current note is empty, cannot generate narration.",
+ ),
);
return;
}
@@ -1991,7 +2002,9 @@ export default function CoWriterEditor({
} catch (e: any) {
setNarrationError(
e?.message ||
- t("Failed to generate narration, please try again."),
+ t(
+ "Failed to generate narration, please try again.",
+ ),
);
} finally {
setNarrationLoading(false);
@@ -2037,7 +2050,9 @@ export default function CoWriterEditor({
</p>
) : (
<span className="text-slate-400 dark:text-slate-500">
- {t("After generation, the narration script will appear here.")}
+ {t(
+ "After generation, the narration script will appear here.",
+ )}
</span>
)}
</div>
@@ -2059,7 +2074,9 @@ export default function CoWriterEditor({
</ul>
) : (
<div className="text-[11px] text-slate-400 dark:text-slate-500">
- {t("After generation, 3-5 key points will be listed here.")}
+ {t(
+ "After generation, 3-5 key points will be listed here.",
+ )}
</div>
)}
</div>
@@ -2086,14 +2103,18 @@ export default function CoWriterEditor({
}}
>
<source src={audioInfo.audioUrl} type="audio/mpeg" />
- {t("Your browser does not support the audio element.")}
+ {t(
+ "Your browser does not support the audio element.",
+ )}
</audio>
</div>
) : (
<div className="text-[11px] text-slate-400 dark:text-slate-500 italic py-2">
{ttsAvailable === false
? t("TTS not configured, script generation only.")
- : t("After generation, you can play the podcast audio here.")}
+ : t(
+ "After generation, you can play the podcast audio here.",
+ )}
</div>
)}
</div>
diff --git a/web/components/NotebookImportModal.tsx b/web/components/NotebookImportModal.tsx
index d290de38e..e7bcbbd96 100644
--- a/web/components/NotebookImportModal.tsx
+++ b/web/components/NotebookImportModal.tsx
@@ -328,7 +328,10 @@ export default function NotebookImportModal({
{/* Footer */}
<div className="p-4 border-t border-slate-100 bg-slate-50 flex justify-between items-center">
<div className="text-sm text-slate-500">
- {t("Selected {n} items").replace("{n}", String(selectedRecords.size))}
+ {t("Selected {n} items").replace(
+ "{n}",
+ String(selectedRecords.size),
+ )}
</div>
<div className="flex items-center gap-2">
<button
diff --git a/web/components/Sidebar.tsx b/web/components/Sidebar.tsx
index e3e41dc32..0fd8fe4a6 100644
--- a/web/components/Sidebar.tsx
+++ b/web/components/Sidebar.tsx
@@ -90,7 +90,7 @@ export default function Sidebar() {
icon: ALL_NAV_ITEMS[href].icon,
}));
};
-
+
return [
{
id: "start" as const,
diff --git a/web/components/SolverSessionDetail.tsx b/web/components/SolverSessionDetail.tsx
index c0d86085c..0cf31846d 100644
--- a/web/components/SolverSessionDetail.tsx
+++ b/web/components/SolverSessionDetail.tsx
@@ -112,7 +112,9 @@ export default function SolverSessionDetail({
setSession(data);
} catch (err) {
const msg = err instanceof Error ? err.message : "Unknown error";
- setError(msg === "Failed to load session" ? t("Failed to load session") : msg);
+ setError(
+ msg === "Failed to load session" ? t("Failed to load session") : msg,
+ );
} finally {
setLoading(false);
}
@@ -207,7 +209,8 @@ export default function SolverSessionDetail({
)}
{session.token_stats.tokens > 0 && (
<span className="px-2.5 py-1 text-xs font-medium bg-slate-100 dark:bg-slate-700 text-slate-700 dark:text-slate-300 rounded-full">
- {session.token_stats.tokens.toLocaleString()} {t("tokens")}
+ {session.token_stats.tokens.toLocaleString()}{" "}
+ {t("tokens")}
</span>
)}
{session.token_stats.cost > 0 && (
diff --git a/web/components/knowledge/FolderSyncManager.tsx b/web/components/knowledge/FolderSyncManager.tsx
index 79a0ecebd..0c8810013 100644
--- a/web/components/knowledge/FolderSyncManager.tsx
+++ b/web/components/knowledge/FolderSyncManager.tsx
@@ -91,7 +91,9 @@ export default function FolderSyncManager({
<span className="font-semibold text-slate-700 dark:text-slate-200">
{kbName}
</span>
- {t(". Documents in the folder will be processed and added to this knowledge base.")}
+ {t(
+ ". Documents in the folder will be processed and added to this knowledge base.",
+ )}
</p>
<form onSubmit={handleLinkFolder} className="space-y-4">
@@ -127,14 +129,18 @@ export default function FolderSyncManager({
{t("📄 Supported files: PDF, DOCX, TXT, MD")}
</p>
<p className="text-[10px] text-slate-400 dark:text-slate-500">
- {t("New and modified files will be automatically detected when you sync.")}
+ {t(
+ "New and modified files will be automatically detected when you sync.",
+ )}
</p>
</div>
<div className="bg-emerald-50 dark:bg-emerald-900/20 rounded-lg p-3 border border-emerald-100 dark:border-emerald-800">
<p className="text-xs text-emerald-700 dark:text-emerald-400">
<strong>{t("💡 Tip:")}</strong>{" "}
- {t("Use folders synced with Google Drive, OneDrive, SharePoint, or Dropbox for automatic cloud integration.")}
+ {t(
+ "Use folders synced with Google Drive, OneDrive, SharePoint, or Dropbox for automatic cloud integration.",
+ )}
</p>
</div>
diff --git a/web/components/question/LogDrawer.tsx b/web/components/question/LogDrawer.tsx
index 77a729a25..04c98e487 100644
--- a/web/components/question/LogDrawer.tsx
+++ b/web/components/question/LogDrawer.tsx
@@ -319,7 +319,10 @@ export const LogDrawer: React.FC<LogDrawerProps> = ({
{subFocuses.length > 0 && (
<div className="px-4 py-4 border-b border-slate-100 dark:border-slate-700 bg-white dark:bg-slate-800">
<p className="text-xs font-bold text-slate-500 dark:text-slate-400 uppercase tracking-wider mb-3">
- {t("Question Focuses ({n})").replace("{n}", String(subFocuses.length))}
+ {t("Question Focuses ({n})").replace(
+ "{n}",
+ String(subFocuses.length),
+ )}
</p>
<div className="space-y-2 max-h-[200px] overflow-y-auto">
{subFocuses.map((focus) => (
diff --git a/web/components/research/ActiveTaskDetail.tsx b/web/components/research/ActiveTaskDetail.tsx
index 6b6310cdb..c36767a85 100644
--- a/web/components/research/ActiveTaskDetail.tsx
+++ b/web/components/research/ActiveTaskDetail.tsx
@@ -58,7 +58,9 @@ export const ActiveTaskDetail: React.FC<ActiveTaskDetailProps> = ({ task }) => {
return (
<div className="h-full flex flex-col items-center justify-center text-slate-400 dark:text-slate-500 bg-slate-50/50 dark:bg-slate-800/50 rounded-xl border border-slate-200 dark:border-slate-700">
<Terminal className="w-12 h-12 mb-3 opacity-20" />
- <p className="text-sm">{t("Select a task to view execution details")}</p>
+ <p className="text-sm">
+ {t("Select a task to view execution details")}
+ </p>
</div>
);
}
diff --git a/web/components/research/ResearchDashboard.tsx b/web/components/research/ResearchDashboard.tsx
index 7b62f6bee..e30d83748 100644
--- a/web/components/research/ResearchDashboard.tsx
+++ b/web/components/research/ResearchDashboard.tsx
@@ -1,4 +1,10 @@
-import React, { useState, useEffect, useRef, useMemo, startTransition } from "react";
+import React, {
+ useState,
+ useEffect,
+ useRef,
+ useMemo,
+ startTransition,
+} from "react";
import { ResearchState } from "../../types/research";
import { TaskGrid } from "./TaskGrid";
import { ActiveTaskDetail } from "./ActiveTaskDetail";
@@ -68,36 +74,40 @@ export const ResearchDashboard: React.FC<ResearchDashboardProps> = ({
}) => {
const { t } = useTranslation();
const { global, tasks, activeTaskIds, planning, reporting } = state;
-
+
// Track previous stage to detect changes and reset user selection
const [prevStage, setPrevStage] = useState(global.stage);
-
+
// Ref to track previous stage for useEffect (needed because state updates synchronously)
const prevStageRef = useRef(global.stage);
-
+
// User can override the auto-selected tab
- const [userSelectedTab, setUserSelectedTab] = useState<ProcessTab | null>(null);
-
+ const [userSelectedTab, setUserSelectedTab] = useState<ProcessTab | null>(
+ null,
+ );
+
// Compute derived tab based on current stage
- const derivedProcessTab: ProcessTab =
- global.stage === "planning" || global.stage === "researching" || global.stage === "reporting"
+ const derivedProcessTab: ProcessTab =
+ global.stage === "planning" ||
+ global.stage === "researching" ||
+ global.stage === "reporting"
? global.stage
: "reporting";
-
+
// Detect stage changes and reset user selection
if (prevStage !== global.stage) {
setPrevStage(global.stage);
setUserSelectedTab(null);
}
-
+
// Active tab is user selection or derived
const activeProcessTab = userSelectedTab ?? derivedProcessTab;
-
+
// Handler for user tab selection
const setActiveProcessTab = (tab: ProcessTab) => {
setUserSelectedTab(tab);
};
-
+
// View state
const [activeView, setActiveView] = useState<"process" | "report">("process");
@@ -131,7 +141,7 @@ export const ResearchDashboard: React.FC<ResearchDashboardProps> = ({
}
}, [global.stage, reporting.generatedReport, activeView]);
- // Reset to process view when a new research starts
+ // Reset to process view when a new research starts
useEffect(() => {
if (global.stage === "planning" && prevStageRef.current !== "planning") {
startTransition(() => {
@@ -222,7 +232,9 @@ export const ResearchDashboard: React.FC<ResearchDashboardProps> = ({
)}
<h3 className="text-lg font-semibold text-slate-800 dark:text-slate-100 mb-2">
- {isPlanningActive ? t("Planning Research Strategy") : t("Research Plan")}
+ {isPlanningActive
+ ? t("Planning Research Strategy")
+ : t("Research Plan")}
</h3>
{isPlanningActive && (
diff --git a/web/context/GlobalContext.tsx b/web/context/GlobalContext.tsx
index b0f1e1e04..a18840d8f 100644
--- a/web/context/GlobalContext.tsx
+++ b/web/context/GlobalContext.tsx
@@ -679,7 +679,8 @@ export function GlobalProvider({ children }: { children: React.ReactNode }) {
const isHydrated = useRef(false);
// --- Solver Logic ---
- const [solverState, setSolverState] = useState<SolverState>(DEFAULT_SOLVER_STATE);
+ const [solverState, setSolverState] =
+ useState<SolverState>(DEFAULT_SOLVER_STATE);
const solverWs = useRef<WebSocket | null>(null);
// Debounced save for solver state
@@ -688,11 +689,11 @@ export function GlobalProvider({ children }: { children: React.ReactNode }) {
if (!isHydrated.current) return;
const toSave = persistState(
state,
- EXCLUDE_FIELDS.SOLVER as unknown as (keyof SolverState)[]
+ EXCLUDE_FIELDS.SOLVER as unknown as (keyof SolverState)[],
);
saveToStorage(STORAGE_KEYS.SOLVER_STATE, toSave);
}, 500),
- []
+ [],
);
// Auto-save solver state on change (only after hydration)
@@ -743,11 +744,13 @@ export function GlobalProvider({ children }: { children: React.ReactNode }) {
ws.onopen = () => {
// Send question with current session_id (if any)
- ws.send(JSON.stringify({
- question,
- kb_name: kb,
- session_id: solverSessionIdRef.current,
- }));
+ ws.send(
+ JSON.stringify({
+ question,
+ kb_name: kb,
+ session_id: solverSessionIdRef.current,
+ }),
+ );
addSolverLog({ type: "system", content: "Initializing connection..." });
};
@@ -875,7 +878,9 @@ export function GlobalProvider({ children }: { children: React.ReactNode }) {
// Load a solver session from history
const loadSolverSession = async (sessionId: string) => {
try {
- const response = await fetch(apiUrl(`/api/v1/solve/sessions/${sessionId}`));
+ const response = await fetch(
+ apiUrl(`/api/v1/solve/sessions/${sessionId}`),
+ );
if (!response.ok) {
throw new Error("Session not found");
}
@@ -896,7 +901,10 @@ export function GlobalProvider({ children }: { children: React.ReactNode }) {
messages,
selectedKb: session.kb_name || prev.selectedKb,
tokenStats: session.token_stats || prev.tokenStats,
- question: messages.length > 0 && messages[0].role === "user" ? messages[0].content : "",
+ question:
+ messages.length > 0 && messages[0].role === "user"
+ ? messages[0].content
+ : "",
isSolving: false,
logs: [],
progress: { stage: null, progress: {} },
@@ -912,7 +920,9 @@ export function GlobalProvider({ children }: { children: React.ReactNode }) {
};
// --- Question Logic ---
- const [questionState, setQuestionState] = useState<QuestionState>(DEFAULT_QUESTION_STATE);
+ const [questionState, setQuestionState] = useState<QuestionState>(
+ DEFAULT_QUESTION_STATE,
+ );
const questionWs = useRef<WebSocket | null>(null);
// Debounced save for question state
@@ -921,11 +931,11 @@ export function GlobalProvider({ children }: { children: React.ReactNode }) {
if (!isHydrated.current) return;
const toSave = persistState(
state,
- EXCLUDE_FIELDS.QUESTION as unknown as (keyof QuestionState)[]
+ EXCLUDE_FIELDS.QUESTION as unknown as (keyof QuestionState)[],
);
saveToStorage(STORAGE_KEYS.QUESTION_STATE, toSave);
}, 500),
- []
+ [],
);
// Auto-save question state on change (only after hydration)
@@ -1547,7 +1557,9 @@ export function GlobalProvider({ children }: { children: React.ReactNode }) {
};
// --- Research Logic ---
- const [researchState, setResearchState] = useState<ResearchState>(DEFAULT_RESEARCH_STATE);
+ const [researchState, setResearchState] = useState<ResearchState>(
+ DEFAULT_RESEARCH_STATE,
+ );
const researchWs = useRef<WebSocket | null>(null);
// Debounced save for research state
@@ -1556,11 +1568,11 @@ export function GlobalProvider({ children }: { children: React.ReactNode }) {
if (!isHydrated.current) return;
const toSave = persistState(
state,
- EXCLUDE_FIELDS.RESEARCH as unknown as (keyof ResearchState)[]
+ EXCLUDE_FIELDS.RESEARCH as unknown as (keyof ResearchState)[],
);
saveToStorage(STORAGE_KEYS.RESEARCH_STATE, toSave);
}, 500),
- []
+ [],
);
// Auto-save research state on change (only after hydration)
@@ -1738,7 +1750,9 @@ export function GlobalProvider({ children }: { children: React.ReactNode }) {
};
// --- IdeaGen Logic ---
- const [ideaGenState, setIdeaGenState] = useState<IdeaGenState>(DEFAULT_IDEAGEN_STATE);
+ const [ideaGenState, setIdeaGenState] = useState<IdeaGenState>(
+ DEFAULT_IDEAGEN_STATE,
+ );
// Debounced save for ideagen state
const saveIdeaGenState = useCallback(
@@ -1746,11 +1760,11 @@ export function GlobalProvider({ children }: { children: React.ReactNode }) {
if (!isHydrated.current) return;
const toSave = persistState(
state,
- EXCLUDE_FIELDS.IDEAGEN as unknown as (keyof IdeaGenState)[]
+ EXCLUDE_FIELDS.IDEAGEN as unknown as (keyof IdeaGenState)[],
);
saveToStorage(STORAGE_KEYS.IDEAGEN_STATE, toSave);
}, 500),
- []
+ [],
);
// Auto-save ideagen state on change (only after hydration)
@@ -1772,11 +1786,11 @@ export function GlobalProvider({ children }: { children: React.ReactNode }) {
if (!isHydrated.current) return;
const toSave = persistState(
state,
- EXCLUDE_FIELDS.CHAT as unknown as (keyof ChatState)[]
+ EXCLUDE_FIELDS.CHAT as unknown as (keyof ChatState)[],
);
saveToStorage(STORAGE_KEYS.CHAT_STATE, toSave);
}, 500),
- []
+ [],
);
// Auto-save chat state on change (only after hydration)
@@ -1794,23 +1808,23 @@ export function GlobalProvider({ children }: { children: React.ReactNode }) {
// Load persisted states
const persistedSolver = loadFromStorage<Partial<SolverState>>(
STORAGE_KEYS.SOLVER_STATE,
- {}
+ {},
);
const persistedQuestion = loadFromStorage<Partial<QuestionState>>(
STORAGE_KEYS.QUESTION_STATE,
- {}
+ {},
);
const persistedResearch = loadFromStorage<Partial<ResearchState>>(
STORAGE_KEYS.RESEARCH_STATE,
- {}
+ {},
);
const persistedIdeaGen = loadFromStorage<Partial<IdeaGenState>>(
STORAGE_KEYS.IDEAGEN_STATE,
- {}
+ {},
);
const persistedChat = loadFromStorage<Partial<ChatState>>(
STORAGE_KEYS.CHAT_STATE,
- {}
+ {},
);
// Restore solver state
@@ -1819,8 +1833,8 @@ export function GlobalProvider({ children }: { children: React.ReactNode }) {
mergeWithDefaults(
persistedSolver,
prev,
- EXCLUDE_FIELDS.SOLVER as unknown as (keyof SolverState)[]
- )
+ EXCLUDE_FIELDS.SOLVER as unknown as (keyof SolverState)[],
+ ),
);
}
@@ -1830,8 +1844,8 @@ export function GlobalProvider({ children }: { children: React.ReactNode }) {
mergeWithDefaults(
persistedQuestion,
prev,
- EXCLUDE_FIELDS.QUESTION as unknown as (keyof QuestionState)[]
- )
+ EXCLUDE_FIELDS.QUESTION as unknown as (keyof QuestionState)[],
+ ),
);
}
@@ -1841,7 +1855,7 @@ export function GlobalProvider({ children }: { children: React.ReactNode }) {
const merged = mergeWithDefaults(
persistedResearch,
prev,
- EXCLUDE_FIELDS.RESEARCH as unknown as (keyof ResearchState)[]
+ EXCLUDE_FIELDS.RESEARCH as unknown as (keyof ResearchState)[],
);
if (merged.status === "running") {
merged.status = "idle";
@@ -1856,8 +1870,8 @@ export function GlobalProvider({ children }: { children: React.ReactNode }) {
mergeWithDefaults(
persistedIdeaGen,
prev,
- EXCLUDE_FIELDS.IDEAGEN as unknown as (keyof IdeaGenState)[]
- )
+ EXCLUDE_FIELDS.IDEAGEN as unknown as (keyof IdeaGenState)[],
+ ),
);
}
@@ -1867,7 +1881,7 @@ export function GlobalProvider({ children }: { children: React.ReactNode }) {
const merged = mergeWithDefaults(
persistedChat,
prev,
- EXCLUDE_FIELDS.CHAT as unknown as (keyof ChatState)[]
+ EXCLUDE_FIELDS.CHAT as unknown as (keyof ChatState)[],
);
// Also update sessionIdRef
if (merged.sessionId) {
diff --git a/web/context/settings/SidebarContext.tsx b/web/context/settings/SidebarContext.tsx
index 9c1b61d6a..1222aead5 100644
--- a/web/context/settings/SidebarContext.tsx
+++ b/web/context/settings/SidebarContext.tsx
@@ -23,7 +23,11 @@ function getInitialSidebarWidth(): number {
const storedWidth = localStorage.getItem("sidebarWidth");
if (storedWidth) {
const width = parseInt(storedWidth, 10);
- if (!isNaN(width) && width >= SIDEBAR_MIN_WIDTH && width <= SIDEBAR_MAX_WIDTH) {
+ if (
+ !isNaN(width) &&
+ width >= SIDEBAR_MIN_WIDTH &&
+ width <= SIDEBAR_MAX_WIDTH
+ ) {
return width;
}
}
@@ -55,8 +59,11 @@ const SidebarContext = createContext<SidebarContextType | undefined>(undefined);
export function SidebarProvider({ children }: { children: React.ReactNode }) {
// Sidebar dimensions state - use lazy initialization
- const [sidebarWidth, setSidebarWidthState] = useState<number>(getInitialSidebarWidth);
- const [sidebarCollapsed, setSidebarCollapsedState] = useState<boolean>(getInitialCollapsed);
+ const [sidebarWidth, setSidebarWidthState] = useState<number>(
+ getInitialSidebarWidth,
+ );
+ const [sidebarCollapsed, setSidebarCollapsedState] =
+ useState<boolean>(getInitialCollapsed);
// Sidebar customization state
const [sidebarDescription, setSidebarDescriptionState] = useState<string>(
diff --git a/web/eslint.config.mjs b/web/eslint.config.mjs
index 4d8a2b498..698b6d25a 100644
--- a/web/eslint.config.mjs
+++ b/web/eslint.config.mjs
@@ -19,4 +19,3 @@ const config = [
];
export default config;
-
diff --git a/web/eslint/i18n-plugin.mjs b/web/eslint/i18n-plugin.mjs
index 1f2553e7f..02c00dcac 100644
--- a/web/eslint/i18n-plugin.mjs
+++ b/web/eslint/i18n-plugin.mjs
@@ -55,4 +55,3 @@ export default {
},
},
};
-
diff --git a/web/hooks/usePersistentState.ts b/web/hooks/usePersistentState.ts
index 2653b33e0..d105f509d 100644
--- a/web/hooks/usePersistentState.ts
+++ b/web/hooks/usePersistentState.ts
@@ -39,7 +39,7 @@ interface PersistentStateOptions<T> {
export function usePersistentState<T extends Record<string, any>>(
key: string,
initialValue: T,
- options: PersistentStateOptions<T> = {}
+ options: PersistentStateOptions<T> = {},
): [T, React.Dispatch<React.SetStateAction<T>>] {
const { exclude = [], debounceMs = 500, enabled = true } = options;
@@ -86,7 +86,7 @@ export function usePersistentState<T extends Record<string, any>>(
(action) => {
setStateInternal(action);
},
- []
+ [],
);
return [state, setState];
@@ -103,7 +103,7 @@ export function usePersistentState<T extends Record<string, any>>(
export function usePersistentValue<T>(
key: string,
initialValue: T,
- debounceMs: number = 300
+ debounceMs: number = 300,
): [T, React.Dispatch<React.SetStateAction<T>>] {
const isInitialized = useRef(false);
@@ -147,7 +147,7 @@ export function useStatePersistence<T extends Record<string, any>>(
state: T,
defaultState: T,
excludeFields: readonly (keyof T)[],
- debounceMs: number = 500
+ debounceMs: number = 500,
): {
loadPersistedState: () => T;
saveState: (state: T) => void;
@@ -171,7 +171,7 @@ export function useStatePersistence<T extends Record<string, any>>(
return mergeWithDefaults(
persisted,
defaultState,
- excludeFields as (keyof T)[]
+ excludeFields as (keyof T)[],
);
}, [key, defaultState, excludeFields]);
diff --git a/web/hooks/useTheme.ts b/web/hooks/useTheme.ts
index e6abb1e84..b9c0cd401 100644
--- a/web/hooks/useTheme.ts
+++ b/web/hooks/useTheme.ts
@@ -15,7 +15,7 @@ function useIsClient() {
return useSyncExternalStore(
emptySubscribe,
() => true,
- () => false
+ () => false,
);
}
diff --git a/web/i18n/I18nClientBridge.tsx b/web/i18n/I18nClientBridge.tsx
index e9f1ea83c..b7903a064 100644
--- a/web/i18n/I18nClientBridge.tsx
+++ b/web/i18n/I18nClientBridge.tsx
@@ -7,4 +7,3 @@ export function I18nClientBridge({ children }: { children: React.ReactNode }) {
const { uiSettings } = useGlobal();
return <I18nProvider language={uiSettings.language}>{children}</I18nProvider>;
}
-
diff --git a/web/i18n/I18nProvider.tsx b/web/i18n/I18nProvider.tsx
index cc307fae8..88783fc3f 100644
--- a/web/i18n/I18nProvider.tsx
+++ b/web/i18n/I18nProvider.tsx
@@ -29,4 +29,3 @@ export function I18nProvider({
return children;
}
-
diff --git a/web/i18n/index.ts b/web/i18n/index.ts
index 5dd0e577e..5e2a03919 100644
--- a/web/i18n/index.ts
+++ b/web/i18n/index.ts
@@ -2,4 +2,3 @@ export { I18nProvider } from "./I18nProvider";
export { I18nClientBridge } from "./I18nClientBridge";
export { initI18n, normalizeLanguage } from "./init";
export type { AppLanguage } from "./init";
-
diff --git a/web/i18n/init.ts b/web/i18n/init.ts
index 56051ea12..f57a314a4 100644
--- a/web/i18n/init.ts
+++ b/web/i18n/init.ts
@@ -42,4 +42,3 @@ export function initI18n(language?: unknown) {
_initialized = true;
return i18n;
}
-
diff --git a/web/lib/datetime.ts b/web/lib/datetime.ts
index 90dbfcb11..66b4c431e 100644
--- a/web/lib/datetime.ts
+++ b/web/lib/datetime.ts
@@ -7,7 +7,11 @@ export function getLocale(lang: Language): string {
export function formatDate(
date: Date,
lang: Language,
- options: Intl.DateTimeFormatOptions = { year: "numeric", month: "short", day: "numeric" },
+ options: Intl.DateTimeFormatOptions = {
+ year: "numeric",
+ month: "short",
+ day: "numeric",
+ },
): string {
return new Intl.DateTimeFormat(getLocale(lang), options).format(date);
}
@@ -19,4 +23,3 @@ export function formatTime(
): string {
return new Intl.DateTimeFormat(getLocale(lang), options).format(date);
}
-
diff --git a/web/lib/persistence.ts b/web/lib/persistence.ts
index c2ee62413..919ff0c36 100644
--- a/web/lib/persistence.ts
+++ b/web/lib/persistence.ts
@@ -45,7 +45,7 @@ export function loadFromStorage<T>(key: string, defaultValue: T): T {
// Version check - if version mismatch, return default (can add migration logic here)
if (wrapper.version !== STORAGE_VERSION) {
console.warn(
- `Storage version mismatch for ${key}. Expected ${STORAGE_VERSION}, got ${wrapper.version}. Using default value.`
+ `Storage version mismatch for ${key}. Expected ${STORAGE_VERSION}, got ${wrapper.version}. Using default value.`,
);
return defaultValue;
}
@@ -81,7 +81,7 @@ export function saveToStorage<T>(key: string, value: T): void {
// Handle quota exceeded or other storage errors
if (error instanceof Error && error.name === "QuotaExceededError") {
console.error(
- `localStorage quota exceeded when saving ${key}. Consider clearing old data.`
+ `localStorage quota exceeded when saving ${key}. Consider clearing old data.`,
);
} else {
console.warn(`Failed to save ${key} to localStorage:`, error);
@@ -140,7 +140,7 @@ export function clearAllStorage(): void {
*/
export function persistState<T extends Record<string, any>>(
state: T,
- exclude: (keyof T)[]
+ exclude: (keyof T)[],
): Partial<T> {
const result: Partial<T> = {};
@@ -164,7 +164,7 @@ export function persistState<T extends Record<string, any>>(
export function mergeWithDefaults<T extends Record<string, any>>(
persistedState: Partial<T> | null | undefined,
defaultState: T,
- exclude: (keyof T)[] = []
+ exclude: (keyof T)[] = [],
): T {
if (!persistedState) {
return defaultState;
diff --git a/web/locales/en/app.json b/web/locales/en/app.json
index 143f8563f..681fd7654 100644
--- a/web/locales/en/app.json
+++ b/web/locales/en/app.json
@@ -389,13 +389,11 @@
"Select a notebook, and the system will generate a personalized learning plan. Through interactive pages and intelligent Q&A, you'll gradually master all the content.": "Select a notebook, and the system will generate a personalized learning plan. Through interactive pages and intelligent Q&A, you'll gradually master all the content.",
"Select notebook records or describe your research topic": "Select notebook records or describe your research topic",
- "Guided Learning": "Guided Learning",
"Manage and explore your educational content repositories.": "Manage and explore your educational content repositories.",
"RAG-Anything": "RAG-Anything",
"RAG-Anything (Docling)": "RAG-Anything (Docling)",
"Documents": "Documents",
"Images": "Images",
- "Status": "Status",
"Ready": "Ready",
"Processing": "Processing",
"Processing File": "Processing File",
@@ -412,7 +410,6 @@
"{n} files selected": "{n} files selected",
"Clear all": "Clear all",
"Remove file": "Remove file",
- "Create & Initialize": "Create & Initialize",
"Upload documents to": "Upload documents to",
"RAG Provider": "RAG Provider",
"RAG Provider (Optional)": "RAG Provider (Optional)",
@@ -426,8 +423,6 @@
"Activity Log": "Activity Log",
"Waiting for logic execution...": "Waiting for logic execution...",
"gpt-4o": "gpt-4o",
- "Failed to link folder": "Failed to link folder",
- "Folder linked successfully!": "Folder linked successfully!",
"Link a local folder to": "Link a local folder to",
". Documents in the folder will be processed and added to this knowledge base.": ". Documents in the folder will be processed and added to this knowledge base.",
"C:\\Users\\name\\Documents\\papers": "C:\\Users\\name\\Documents\\papers",
@@ -469,15 +464,12 @@
"Metadata": "Metadata",
"No records yet": "No records yet",
"Add records from Solver, Question, Research, or Co-Writer": "Add records from Solver, Question, Research, or Co-Writer",
- "Select a notebook to view records": "Select a notebook to view records",
"Select a record to view details": "Select a record to view details",
"Create New Notebook": "Create New Notebook",
- "Name": "Name",
"Description (Optional)": "Description (Optional)",
"Color": "Color",
"Edit Notebook": "Edit Notebook",
"Description": "Description",
- "Save Changes": "Save Changes",
"Delete Notebook?": "Delete Notebook?",
"Import Records": "Import Records",
"Source Notebook": "Source Notebook",
@@ -498,7 +490,6 @@
"Easy": "Easy",
"Medium": "Medium",
"Hard": "Hard",
- "Type": "Type",
"Multiple Choice": "Multiple Choice",
"Written": "Written",
"Upload Exam Paper (PDF)": "Upload Exam Paper (PDF)",
diff --git a/web/locales/en/common.json b/web/locales/en/common.json
index cd45fbbdb..39b84582a 100644
--- a/web/locales/en/common.json
+++ b/web/locales/en/common.json
@@ -6,4 +6,3 @@
"common.cancel": "Cancel",
"common.close": "Close"
}
-
diff --git a/web/locales/zh/app.json b/web/locales/zh/app.json
index b5ec5a210..ad0ab0524 100644
--- a/web/locales/zh/app.json
+++ b/web/locales/zh/app.json
@@ -389,13 +389,11 @@
"Select a notebook, and the system will generate a personalized learning plan. Through interactive pages and intelligent Q&A, you'll gradually master all the content.": "请选择一个笔记本,系统将生成个性化学习计划。通过交互页面与智能问答,你将逐步掌握全部内容。",
"Select notebook records or describe your research topic": "选择笔记记录或直接描述你的研究主题",
- "Guided Learning": "引导式学习",
"Manage and explore your educational content repositories.": "管理与探索你的教育内容仓库。",
"RAG-Anything": "RAG-Anything",
"RAG-Anything (Docling)": "RAG-Anything (Docling)",
"Documents": "文档",
"Images": "图片",
- "Status": "状态",
"Ready": "就绪",
"Processing": "处理中",
"Processing File": "处理文件",
@@ -412,7 +410,6 @@
"{n} files selected": "已选择 {n} 个文件",
"Clear all": "清空全部",
"Remove file": "移除文件",
- "Create & Initialize": "创建并初始化",
"Upload documents to": "上传文档到",
"RAG Provider": "RAG 提供方",
"RAG Provider (Optional)": "RAG 提供方(可选)",
@@ -426,8 +423,6 @@
"Activity Log": "活动日志",
"Waiting for logic execution...": "等待推理执行…",
"gpt-4o": "gpt-4o",
- "Failed to link folder": "关联文件夹失败",
- "Folder linked successfully!": "文件夹关联成功!",
"Link a local folder to": "关联本地文件夹到",
". Documents in the folder will be processed and added to this knowledge base.": "。文件夹内的文档将被处理并添加到该知识库。",
"C:\\Users\\name\\Documents\\papers": "C:\\Users\\name\\Documents\\papers",
@@ -469,15 +464,12 @@
"Metadata": "元数据",
"No records yet": "暂无记录",
"Add records from Solver, Question, Research, or Co-Writer": "从解题、出题、研究或智能写作中添加记录",
- "Select a notebook to view records": "请选择一个笔记本查看记录",
"Select a record to view details": "请选择一条记录查看详情",
"Create New Notebook": "新建笔记本",
- "Name": "名称",
"Description (Optional)": "描述(可选)",
"Color": "颜色",
"Edit Notebook": "编辑笔记本",
"Description": "描述",
- "Save Changes": "保存更改",
"Delete Notebook?": "删除笔记本?",
"Import Records": "导入记录",
"Source Notebook": "来源笔记本",
@@ -498,7 +490,6 @@
"Easy": "简单",
"Medium": "中等",
"Hard": "困难",
- "Type": "类型",
"Multiple Choice": "选择题",
"Written": "主观题",
"Upload Exam Paper (PDF)": "上传试卷(PDF)",
@@ -514,4 +505,3 @@
"e.g. 2211asm1": "例如:2211asm1",
"Please upload a PDF exam paper": "请上传 PDF 试卷"
}
-
diff --git a/web/locales/zh/common.json b/web/locales/zh/common.json
index 0e585b93e..dbc162d50 100644
--- a/web/locales/zh/common.json
+++ b/web/locales/zh/common.json
@@ -6,4 +6,3 @@
"common.cancel": "取消",
"common.close": "关闭"
}
-
diff --git a/web/scripts/i18n_audit.mjs b/web/scripts/i18n_audit.mjs
index 3b7502e39..499cf1eab 100644
--- a/web/scripts/i18n_audit.mjs
+++ b/web/scripts/i18n_audit.mjs
@@ -124,4 +124,3 @@ if (!showAll && allFindings.length > 80)
if (strict) process.exit(1);
process.exit(0);
-
diff --git a/web/scripts/i18n_parity.mjs b/web/scripts/i18n_parity.mjs
index d65a011de..046b99cb8 100644
--- a/web/scripts/i18n_parity.mjs
+++ b/web/scripts/i18n_parity.mjs
@@ -86,4 +86,3 @@ for (const rel of enFiles) {
if (!ok) process.exit(1);
console.log("[i18n:parity] OK");
-