Skip to content

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

Merge branch 'main' into feat/debug_run

logo2cb225aab2b8
diff --cc .env.example_CN
index 23baec6e0,8a6dae19c..f67ac45ba
--- a/.env.example_CN
+++ b/.env.example_CN
@@@ -1,159 -1,128 +1,205 @@@
- # ============================================================================
- # Deep-Tutor 环境配置文件
- # ============================================================================
- # 将此文件复制为 .env 并填写您的 API 密钥和设置。
- # 所有 API 密钥应妥善保管,切勿提交到版本控制系统中。
- # 您可以在 DeepTutor/config/agents.yaml 中调整 max_token 参数。
- # ============================================================================
+ # ==============================================================================
+ # DeepTutor 环境配置文件
+ # ==============================================================================
+ # 请将此文件复制为 `.env` 并填写相应的值。
+ # [必填] 表示必须配置的字段,[可选] 表示可选配置的字段。
- # ============================================================================
- # 服务器配置
- # ============================================================================
- # 配置服务器端口和远程访问的 API URL。
+ # ==============================================================================
+ # 服务器端口配置
+ # ==============================================================================
- # 后端 API 端口(默认:8001)
- # BACKEND_PORT=8001
+ # [可选] 后端 API 服务器端口
+ BACKEND_PORT=8001
- # 前端 Web 端口(默认:3782)
- # FRONTEND_PORT=3782
+ # [可选] 前端服务器端口
+ FRONTEND_PORT=3782
- # 前端 API 基础 URL(用于远程/局域网访问)
- # 当从网络中的其他设备访问 DeepTutor 时设置此项。
- # 示例:如果您的服务器 IP 是 192.168.1.100,请设置:
- # NEXT_PUBLIC_API_BASE=http://192.168.1.100:8001
- # 如果未设置,默认为 http://localhost:8001(仅在本机有效)
+ # ==============================================================================
+ # LLM 配置(大语言模型)
+ # ==============================================================================
+ # 所有 AI 功能(聊天、研究、解题等)使用的主要大语言模型
++<<<<<<< HEAD
+# NEXT_PUBLIC_API_BASE=http://your-server-ip:8001(可选)
+
+# ============================================================================
+# LLM 部署模式配置
+# ============================================================================
+# 控制 DeepTutor 如何选择 LLM 提供商。
+#
+# 选项:
+# - hybrid(默认):同时使用 API 和本地提供商。活动的提供商优先。
+# - api:仅使用云端 API 提供商(OpenAI、Anthropic、DeepSeek 等)
+# - local:仅使用本地/自托管提供商(Ollama、LM Studio、vLLM 等)
+#
+# 在 hybrid 模式下,您可以通过设置界面添加 API 和本地提供商,
+# 并通过将其设为"活动"来在它们之间切换。
+
+LLM_MODE=api
+
+# ============================================================================
+# LLM(大语言模型)配置
+# ============================================================================
+# 配置用于推理、生成和对话的主要 AI 模型。
+# 支持 OpenAI 兼容 API(OpenAI、Azure OpenAI、DeepSeek、Qwen 等)
+# 以及本地服务器(Ollama、LM Studio、vLLM、llama.cpp)。
+#
+# 注意:这些环境变量作为默认/后备配置。
+# 您也可以通过设置界面添加提供商,活动时将优先使用。
+
+# LLM 服务提供商类型
+# 选项:openai、azure_openai、ollama、anthropic
+LLM_BINDING=openai
+
+# LLM 模型名称
+# 云端示例:gpt-4o、gpt-4o-mini、deepseek-chat、claude-3-5-sonnet-20241022
+# 本地示例:llama3.2、qwen2.5、mistral-nemo、deepseek-r1
+LLM_MODEL=gpt-4o
+
+# LLM API 端点 URL
+# 云端示例:
+# - OpenAI:https://api.openai.com/v1
+# - DeepSeek:https://api.deepseek.com
+# - Anthropic:https://api.anthropic.com/v1
+# 本地示例:
+# - Ollama:http://localhost:11434/v1
+# - LM Studio:http://localhost:1234/v1
+# - vLLM:http://localhost:8000/v1
+# - llama.cpp:http://localhost:8080/v1
+LLM_HOST=https://api.xi-ai.cn/v1
+
+# LLM API 认证密钥
+# 云端 API 必需,本地部署可选
+# 对于 Ollama,可以使用任意字符串(如 "ollama")
+LLM_API_KEY=sk-Rizk4P9TGGWcoOSvE17370C94aD64090A604AfC6Aa2f37F0
++=======
+ # [必填] 服务提供商:openai, azure_openai, anthropic,
+ # deepseek, openrouter, groq, together, mistral
+ # ollama, lm_studio, vllm, llama_cpp
+ LLM_BINDING=openai
- # 禁用 SSL 证书验证(自签名证书时设置为 'true')
- DISABLE_SSL_VERIFY=false
+ # [必填] 模型名称(例如:gpt-4o, deepseek-chat, claude-3-5-sonnet)
+ LLM_MODEL=gpt-4o
- # ============================================================================
- # 嵌入模型配置
- # ============================================================================
- # 配置用于语义搜索和 RAG 的文本嵌入模型。
- # 知识库功能必需。
+ # [必填] LLM 服务提供商的 API 密钥
+ LLM_API_KEY=sk-xxx
- # 嵌入服务提供商类型
- # 选项:openai、azure_openai、ollama、lollms
+ # [必填] API 端点地址
+ LLM_HOST=https://api.openai.com/v1
++>>>>>>> main
+
+ # [可选] API 版本(仅 Azure OpenAI 需要填写)
+ LLM_API_VERSION=
+
+ # ==============================================================================
+ # 向量嵌入(Embedding)配置
+ # ==============================================================================
+ # 用于 RAG(检索增强生成)的嵌入模型
+
+ # [必填] 服务提供商:openai, azure_openai, jina,
+ # cohere, huggingface, google, ollama, lm_studio
EMBEDDING_BINDING=openai
- # 嵌入模型名称
- # 云端示例:text-embedding-3-large、text-embedding-3-small、text-embedding-ada-002
- # 本地示例(Ollama):nomic-embed-text、mxbai-embed-large
- EMBEDDING_MODEL=text-embedding-3-large
+ # [必填] 模型名称
+ EMBEDDING_MODEL=text-embedding-3-small
+
+ # [必填] API 密钥
+ EMBEDDING_API_KEY=sk-xxx
- # 嵌入向量维度
- # text-embedding-3-large:3072
- # text-embedding-3-small:1536
- # nomic-embed-text:768
- # mxbai-embed-large:1024
+ # [必填] API 端点地址
+ EMBEDDING_HOST=https://api.openai.com/v1
+
+ # [必填] 向量维度(必须与模型输出维度匹配)
EMBEDDING_DIMENSION=3072
++<<<<<<< HEAD
+# 嵌入 API 端点 URL
+# 云端:https://api.openai.com/v1
+# 本地(Ollama):http://localhost:11434
+EMBEDDING_HOST=https://api.xi-ai.cn/v1
+
+# 嵌入 API 认证密钥
+# 云端提供商必需,Ollama 不需要
+EMBEDDING_API_KEY=sk-Rizk4P9TGGWcoOSvE17370C94aD64090A604AfC6Aa2f37F0
++=======
+ # [可选] API 版本(仅 Azure OpenAI 需要填写)
+ EMBEDDING_API_VERSION=
- # ============================================================================
- # TTS(文本转语音)配置(可选)
- # ============================================================================
- # 配置 Co-Writer(交互式创意生成器)朗读功能的语音合成。
- # 同时记得在 DeepTutor/config/main.yaml 中选择语音。
+ # ==============================================================================
+ # TTS 配置(文本转语音)
+ # ==============================================================================
+ # 可选:启用语音朗读功能
++>>>>>>> main
+
+ # [可选] 服务提供商:openai, azure_openai
+ TTS_BINDING=openai
++<<<<<<< HEAD
+# TTS 模型名称(如 tts-1、tts-1-hd)
+TTS_MODEL=tts-1
+
+# TTS API 端点 URL(如 https://api.openai.com/v1)
+TTS_URL=https://api.xi-ai.cn/v1
+
+# TTS API 认证密钥
+TTS_API_KEY=sk-Rizk4P9TGGWcoOSvE17370C94aD64090A604AfC6Aa2f37F0
++=======
+ # [可选] TTS 模型名称
+ TTS_MODEL=tts-1
- # ============================================================================
- # 网络搜索配置
- # ============================================================================
- # 配置用于研究功能的外部搜索 API。
+ # [可选] API 密钥(使用 OpenAI 时可与 LLM_API_KEY 相同)
+ TTS_API_KEY=sk-xxx
+
+ # [可选] API 端点地址
+ TTS_URL=https://api.openai.com/v1
++>>>>>>> main
+
+ # [可选] 语音风格:alloy, echo, fable, onyx, nova, shimmer
+ TTS_VOICE=alloy
- # 用于网络搜索的搜索提供商
- # 选项:perplexity、baidu
- # 默认:perplexity
+ # [可选] API 版本(仅 Azure OpenAI 需要填写)
+ TTS_BINDING_API_VERSION=
+
+ # ==============================================================================
+ # 搜索配置(网络搜索)
+ # ==============================================================================
+ # 可选:启用网络搜索功能
+
+ # [可选] 搜索服务提供商:perplexity, tavily, serper, jina, exa
SEARCH_PROVIDER=perplexity
- # ----------------------------------------------------------------------------
- # Perplexity AI 搜索配置
- # ----------------------------------------------------------------------------
- # Perplexity API 密钥,用于网络搜索功能
- # 在此获取 API 密钥:https://www.perplexity.ai/settings/api
- PERPLEXITY_API_KEY=
-
- # ----------------------------------------------------------------------------
- # 百度 AI 搜索配置
- # ----------------------------------------------------------------------------
- # 百度 API 密钥,用于智能搜索和生成
- # 在此获取 API 密钥:https://console.bce.baidu.com/ai_apaas/resource
- # 格式:bce-v3/ALTAK-xxx/xxx 或完整的 API 密钥
- BAIDU_API_KEY=
+ # [可选] 所选搜索服务的 API 密钥
+ SEARCH_API_KEY=pplx-xxx
- # ============================================================================
- # 日志配置
- # ============================================================================
+ # ==============================================================================
+ # 云端部署配置
+ # ==============================================================================
+ # 部署到云端或远程服务器时需要配置
+
+ # [可选] 云端部署时的外部 API 基础地址
+ # 部署到远程服务器时,请设置为服务器的公网地址
+ # 示例:https://your-server.com:8001 或 https://api.yourdomain.com
+ NEXT_PUBLIC_API_BASE_EXTERNAL=
+
+ # [可选] 直接 API 基础地址(上述配置的替代方案)
+ NEXT_PUBLIC_API_BASE=
+
+ # ==============================================================================
+ # 调试与开发配置
+ # ==============================================================================
+
+ # [可选] 禁用 SSL 证书验证(生产环境不建议启用)
+ DISABLE_SSL_VERIFY=false
+
+ # ==============================
+ # HuggingFace / MinerU(可选)
+ # ==============================
+
+ # 使用 HuggingFace 镜像站点(可选)
+ # HF_ENDPOINT=https://your-hf-mirror.example.com
+
+ # HuggingFace 缓存目录(建议:Docker 场景配合挂载该目录以复用缓存)
+ # HF_HOME=/app/data/hf
- # RAG 工具模块的日志级别
- # 选项:DEBUG、INFO、WARNING、ERROR
- RAG_TOOL_MODULE_LOG_LEVEL=INFO
+ # 强制离线模式(前提:模型已在上述缓存目录中下载好)
+ # HF_HUB_OFFLINE=1
diff --cc scripts/install_all.sh
index 20a277182,ae6afe229..232a3a142
--- a/scripts/install_all.sh
+++ b/scripts/install_all.sh
@@@ -129,19 -129,23 +129,23 @@@ install_with_pip_staged()
return 1
fi
- # Stage 2: lightrag-hku
- print_info "Stage 2/3: Installing lightrag-hku..."
- python3 -m pip install "lightrag-hku>=1.0.0" || print_warning "lightrag-hku installation had issues"
+ # Stage 2: llama-index
+ print_info "Stage 2/3: Installing llama-index..."
+ python -m pip install "llama-index>=0.14.12" || print_warning "llama-index installation had issues"
- # Stage 3: raganything (complex dependencies)
- print_info "Stage 3/3: Installing raganything (this may take a while)..."
- if ! python3 -m pip install "raganything>=0.1.0"; then
+ # Stage 3: raganything (includes lightrag-hku as dependency)
+ print_info "Stage 3/4: Installing raganything (includes lightrag-hku, this may take a while)..."
+ if ! python -m pip install "raganything>=0.1.0"; then
print_warning "Standard install failed, trying with --no-deps..."
- python -m pip install "raganything>=0.1.0" --no-deps || print_warning "raganything installation had issues"
+ python3 -m pip install "raganything>=0.1.0" --no-deps || print_warning "raganything installation had issues"
fi
+ # Stage 4: docling (alternative parser for Office/HTML documents)
+ print_info "Stage 4/4: Installing docling (document parser for Office/HTML)..."
+ python -m pip install "docling>=2.31.0" || print_warning "docling installation had issues (optional, can be skipped)"
+
# Optional deps
- python -m pip install "perplexityai>=0.1.0" "dashscope>=1.14.0" 2>/dev/null || true
+ python3 -m pip install "perplexityai>=0.1.0" "dashscope>=1.14.0" 2>/dev/null || true
return 0
}