Skip to content

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

fix: docs, docker deployment & official web

Bingxi Zhao (Frank)ca7916bc5750
diff --git a/.github/ISSUE_TEMPLATE/docs.yml b/.github/ISSUE_TEMPLATE/docs.yml
new file mode 100644
index 000000000..4a0c9ab5d
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/docs.yml
@@ -0,0 +1,58 @@
+name: Documentation Issue
+description: Report an inaccuracy, broken link, missing topic, or unclear explanation in the docs at deeptutor.info
+title: "[Docs]: "
+labels: ["docs", "triage"]
+
+body:
+ - type: checkboxes
+ id: existingcheck
+ attributes:
+ label: Before filing
+ options:
+ - label: I have searched the existing docs issues and this report is not already filed.
+ - label: This is about the docs at https://deeptutor.info — not a product bug.
+ - type: input
+ id: page
+ attributes:
+ label: Page URL
+ description: Which page does the issue affect?
+ placeholder: https://deeptutor.info/docs/...
+ validations:
+ required: true
+ - type: dropdown
+ id: kind
+ attributes:
+ label: What kind of issue?
+ options:
+ - Inaccurate or out-of-date content
+ - Broken link / 404
+ - Command or example that does not work
+ - Screenshot does not match the current product
+ - Missing topic / coverage gap
+ - Typo / formatting / wording
+ - Other
+ validations:
+ required: true
+ - type: textarea
+ id: problem
+ attributes:
+ label: What's wrong?
+ description: Quote the affected text or describe the issue.
+ placeholder: e.g. "Get Started → Setup Tour references `scripts/start_tour.py` which doesn't exist in the repo."
+ validations:
+ required: true
+ - type: textarea
+ id: expected
+ attributes:
+ label: What did you expect?
+ description: Optional — what should the docs say or show instead?
+ placeholder: e.g. "The PyPI install path should be the recommended entry, matching the README."
+ - type: textarea
+ id: environment
+ attributes:
+ label: Environment (optional)
+ description: Only if relevant to the issue (browser, OS, DeepTutor version).
+ placeholder: |
+ - Browser:
+ - DeepTutor version (if checked locally):
+ - OS:
diff --git a/.playwright-cli/page-2026-05-22T09-15-47-989Z.yml b/.playwright-cli/page-2026-05-22T09-15-47-989Z.yml
new file mode 100644
index 000000000..2d1dc21b7
--- /dev/null
+++ b/.playwright-cli/page-2026-05-22T09-15-47-989Z.yml
@@ -0,0 +1,205 @@
+- generic [active] [ref=e1]:
+ - banner [ref=e2]:
+ - generic [ref=e3]:
+ - link "DeepTutor" [ref=e4] [cursor=pointer]:
+ - /url: /
+ - generic [ref=e5]: DeepTutor
+ - navigation [ref=e6]:
+ - link "Docs" [ref=e7] [cursor=pointer]:
+ - /url: /docs/
+ - link "GitHub" [ref=e8] [cursor=pointer]:
+ - /url: https://github.com/HKUDS/DeepTutor
+ - generic "Preferences" [ref=e9]:
+ - generic [ref=e10]:
+ - generic [ref=e11]: Language
+ - combobox "Language" [ref=e12] [cursor=pointer]:
+ - option "English" [selected]
+ - option "简体中文"
+ - generic [ref=e13]:
+ - generic [ref=e14]: Theme
+ - combobox "Theme" [ref=e15] [cursor=pointer]:
+ - option "Auto" [selected]
+ - option "Light"
+ - option "Dark"
+ - link "Get Started →" [ref=e16] [cursor=pointer]:
+ - /url: /docs/get-started/
+ - main [ref=e17]:
+ - generic [ref=e18]:
+ - generic [ref=e19]: Open-source · v1.4.0-beta now available
+ - img "DeepTutor" [ref=e21]
+ - heading "Personal tutoring, reimagined." [level=1] [ref=e22]:
+ - text: Personal tutoring,
+ - emphasis [ref=e23]: reimagined.
+ - paragraph [ref=e24]: An agent-native learning companion — five modes in one workspace, autonomous TutorBots, and a knowledge hub that grows with you.
+ - generic [ref=e25]:
+ - link "Get Started" [ref=e26] [cursor=pointer]:
+ - /url: /docs/get-started/
+ - link "View on GitHub" [ref=e27] [cursor=pointer]:
+ - /url: https://github.com/HKUDS/DeepTutor
+ - text: View on GitHub
+ - img [ref=e28]
+ - generic [ref=e30]:
+ - generic [ref=e31]:
+ - strong [ref=e32]: Apache 2.0
+ - text: · MIT-style permissive
+ - generic [ref=e33]: ·
+ - generic [ref=e34]:
+ - text: Built at
+ - strong [ref=e35]: HKU Data Intelligence Lab
+ - generic [ref=e36]: ·
+ - generic [ref=e37]: Python 3.11 · Next.js 16
+ - generic [ref=e39]:
+ - generic [ref=e44]: DeepTutor — Chat Workspace
+ - img "DeepTutor chat workspace — Chat / TutorBot / Co-Writer / Book / Knowledge / Space / Memory in the sidebar; greeting and composer in the main area." [ref=e45]
+ - generic [ref=e46]:
+ - generic [ref=e47]: § I
+ - generic [ref=e48]:
+ - generic [ref=e49]: What's inside
+ - heading "Six pillars, one running context." [level=2] [ref=e50]:
+ - text: Six pillars,
+ - emphasis [ref=e51]: one
+ - text: running context.
+ - paragraph [ref=e52]: Every surface reads from — and writes back to — the same memory, knowledge base, and tutor. Switching contexts no longer means losing your place.
+ - generic [ref=e53]:
+ - link "I Chat Workspace Five modes — Chat, Solve, Quiz, Research, Visualize — share one session, knowledge base, and citation history. Escalate mid-thread without losing context." [ref=e54] [cursor=pointer]:
+ - /url: /docs/explore/chat-workspace/
+ - generic [ref=e55]: I
+ - heading "Chat Workspace" [level=3] [ref=e56]
+ - paragraph [ref=e57]: Five modes — Chat, Solve, Quiz, Research, Visualize — share one session, knowledge base, and citation history. Escalate mid-thread without losing context.
+ - img [ref=e59]
+ - link "II Co-Writer A split-view Markdown workbench where AI is a first-class collaborator. Select, rewrite, expand — grounded in your knowledge base." [ref=e61] [cursor=pointer]:
+ - /url: /docs/explore/co-writer/
+ - generic [ref=e62]: II
+ - heading "Co-Writer" [level=3] [ref=e63]
+ - paragraph [ref=e64]: A split-view Markdown workbench where AI is a first-class collaborator. Select, rewrite, expand — grounded in your knowledge base.
+ - img [ref=e66]
+ - link "III Book Engine A multi-agent pipeline compiles your materials into interactive living books — 13 block types, including a GeoGebra viewer and animations." [ref=e68] [cursor=pointer]:
+ - /url: /docs/explore/book/
+ - generic [ref=e69]: III
+ - heading "Book Engine" [level=3] [ref=e70]
+ - paragraph [ref=e71]: A multi-agent pipeline compiles your materials into interactive living books — 13 block types, including a GeoGebra viewer and animations.
+ - img [ref=e73]
+ - link "IV Knowledge Versioned RAG-ready document libraries on LlamaIndex end-to-end. Every (re-)index is tracked, comparable, and rollback-able." [ref=e75] [cursor=pointer]:
+ - /url: /docs/explore/knowledge/
+ - generic [ref=e76]: IV
+ - heading "Knowledge" [level=3] [ref=e77]
+ - paragraph [ref=e78]: Versioned RAG-ready document libraries on LlamaIndex end-to-end. Every (re-)index is tracked, comparable, and rollback-able.
+ - img [ref=e80]
+ - link "V Space Your personal library — chat history, notebooks, question bank, and authored skills. The read-and-review counterpart to every active surface." [ref=e82] [cursor=pointer]:
+ - /url: /docs/explore/space/
+ - generic [ref=e83]: V
+ - heading "Space" [level=3] [ref=e84]
+ - paragraph [ref=e85]: Your personal library — chat history, notebooks, question bank, and authored skills. The read-and-review counterpart to every active surface.
+ - img [ref=e87]
+ - link "VI Memory Append-only L1 traces, L2 curated facts with citations, L3 cross-surface synthesis. A Memory Graph lets you audit why DeepTutor knows what it knows." [ref=e89] [cursor=pointer]:
+ - /url: /docs/explore/memory/
+ - generic [ref=e90]: VI
+ - heading "Memory" [level=3] [ref=e91]
+ - paragraph [ref=e92]: Append-only L1 traces, L2 curated facts with citations, L3 cross-surface synthesis. A Memory Graph lets you audit why DeepTutor knows what it knows.
+ - img [ref=e94]
+ - generic [ref=e96]:
+ - generic [ref=e97]: § II
+ - generic [ref=e98]:
+ - generic [ref=e99]: Install
+ - heading "Up and running in minutes." [level=2] [ref=e100]:
+ - text: Up and running in
+ - emphasis [ref=e101]: minutes
+ - text: .
+ - paragraph [ref=e102]: Four ways to install — pick the one that fits. Every path lands at the same configured workspace.
+ - generic [ref=e103]:
+ - tablist [ref=e104]:
+ - tab "$ pip install -U deeptutor PyPI" [selected] [ref=e105] [cursor=pointer]:
+ - generic [ref=e106]: $
+ - generic [ref=e107]: pip install -U deeptutor
+ - generic [ref=e108]: PyPI
+ - tab "$ docker run … ghcr.io/hkuds/deeptutor Docker" [ref=e109] [cursor=pointer]:
+ - generic [ref=e110]: $
+ - generic [ref=e111]: docker run … ghcr.io/hkuds/deeptutor
+ - generic [ref=e112]: Docker
+ - tab "$ git clone … && pip install -e . Source" [ref=e113] [cursor=pointer]:
+ - generic [ref=e114]: $
+ - generic [ref=e115]: git clone … && pip install -e .
+ - generic [ref=e116]: Source
+ - tab "$ pip install -e ./packaging/deeptutor-cli CLI" [ref=e117] [cursor=pointer]:
+ - generic [ref=e118]: $
+ - generic [ref=e119]: pip install -e ./packaging/deeptutor-cli
+ - generic [ref=e120]: CLI
+ - tabpanel [ref=e122]:
+ - paragraph [ref=e123]: Smoothest path. Full local Web app + CLI, no clone required.
+ - code [ref=e125]: "# 1. Create a workspace directory mkdir -p my-deeptutor && cd my-deeptutor # 2. Install, configure, launch pip install -U deeptutor deeptutor init deeptutor start"
+ - generic [ref=e126]:
+ - generic [ref=e127]: Then open 127.0.0.1:3782
+ - link "Full guide" [ref=e128] [cursor=pointer]:
+ - /url: /docs/get-started/pypi/
+ - text: Full guide
+ - img [ref=e129]
+ - generic [ref=e131]:
+ - generic [ref=e132]: § III
+ - generic [ref=e133]:
+ - generic [ref=e134]: Ecosystem
+ - heading "Built alongside." [level=2] [ref=e135]:
+ - text: Built
+ - emphasis [ref=e136]: alongside
+ - text: .
+ - paragraph [ref=e137]: DeepTutor stands on a small family of open-source primitives from the HKU Data Intelligence Lab.
+ - generic [ref=e138]:
+ - link "nanobot Ultra-lightweight AI agent runtime" [ref=e139] [cursor=pointer]:
+ - /url: https://github.com/HKUDS/nanobot
+ - generic [ref=e140]: nanobot
+ - generic [ref=e141]: Ultra-lightweight AI agent runtime
+ - img [ref=e143]
+ - link "LightRAG Simple, fast retrieval-augmented generation" [ref=e145] [cursor=pointer]:
+ - /url: https://github.com/HKUDS/LightRAG
+ - generic [ref=e146]: LightRAG
+ - generic [ref=e147]: Simple, fast retrieval-augmented generation
+ - img [ref=e149]
+ - link "AutoAgent Zero-code agent framework" [ref=e151] [cursor=pointer]:
+ - /url: https://github.com/HKUDS/AutoAgent
+ - generic [ref=e152]: AutoAgent
+ - generic [ref=e153]: Zero-code agent framework
+ - img [ref=e155]
+ - link "AI-Researcher Automated research workflows" [ref=e157] [cursor=pointer]:
+ - /url: https://github.com/HKUDS/AI-Researcher
+ - generic [ref=e158]: AI-Researcher
+ - generic [ref=e159]: Automated research workflows
+ - img [ref=e161]
+ - generic [ref=e163]:
+ - generic [ref=e164]:
+ - link "DeepTutor" [ref=e165] [cursor=pointer]:
+ - /url: /
+ - generic [ref=e166]: DeepTutor
+ - generic [ref=e167]:
+ - generic [ref=e168]:
+ - heading "Docs" [level=4] [ref=e169]
+ - link "Get Started" [ref=e170] [cursor=pointer]:
+ - /url: /docs/get-started/
+ - link "Explore DeepTutor" [ref=e171] [cursor=pointer]:
+ - /url: /docs/explore/
+ - link "Explore TutorBot" [ref=e172] [cursor=pointer]:
+ - /url: /docs/tutorbot/
+ - link "CLI" [ref=e173] [cursor=pointer]:
+ - /url: /docs/cli/
+ - generic [ref=e174]:
+ - heading "Community" [level=4] [ref=e175]
+ - link "Discord" [ref=e176] [cursor=pointer]:
+ - /url: https://discord.gg/eRsjPgMU4t
+ - link "WeChat" [ref=e177] [cursor=pointer]:
+ - /url: https://github.com/HKUDS/DeepTutor/issues/78
+ - link "Discussions" [ref=e178] [cursor=pointer]:
+ - /url: https://github.com/HKUDS/DeepTutor/discussions
+ - link "Issues" [ref=e179] [cursor=pointer]:
+ - /url: https://github.com/HKUDS/DeepTutor/issues
+ - generic [ref=e180]:
+ - heading "Project" [level=4] [ref=e181]
+ - link "GitHub" [ref=e182] [cursor=pointer]:
+ - /url: https://github.com/HKUDS/DeepTutor
+ - link "License" [ref=e183] [cursor=pointer]:
+ - /url: https://github.com/HKUDS/DeepTutor/blob/main/LICENSE
+ - link "arXiv" [ref=e184] [cursor=pointer]:
+ - /url: https://arxiv.org/abs/2604.26962
+ - generic [ref=e186]:
+ - generic [ref=e187]:
+ - text: © 2026
+ - link "Data Intelligence Lab @ HKU" [ref=e188] [cursor=pointer]:
+ - /url: https://github.com/HKUDS
+ - generic [ref=e189]: Released under the Apache 2.0 License
\ No newline at end of file
diff --git a/.playwright-cli/page-2026-05-22T09-17-34-416Z.yml b/.playwright-cli/page-2026-05-22T09-17-34-416Z.yml
new file mode 100644
index 000000000..cd9e5f633
--- /dev/null
+++ b/.playwright-cli/page-2026-05-22T09-17-34-416Z.yml
@@ -0,0 +1,205 @@
+- generic [active] [ref=e1]:
+ - banner [ref=e2]:
+ - generic [ref=e3]:
+ - link "DeepTutor" [ref=e4] [cursor=pointer]:
+ - /url: /zh-cn/
+ - generic [ref=e5]: DeepTutor
+ - navigation [ref=e6]:
+ - link "文档" [ref=e7] [cursor=pointer]:
+ - /url: /zh-cn/docs/
+ - link "GitHub" [ref=e8] [cursor=pointer]:
+ - /url: https://github.com/HKUDS/DeepTutor
+ - generic "偏好设置" [ref=e9]:
+ - generic [ref=e10]:
+ - generic [ref=e11]: 语言
+ - combobox "语言" [ref=e12] [cursor=pointer]:
+ - option "English"
+ - option "简体中文" [selected]
+ - generic [ref=e13]:
+ - generic [ref=e14]: 主题
+ - combobox "主题" [ref=e15] [cursor=pointer]:
+ - option "自动" [selected]
+ - option "浅色"
+ - option "深色"
+ - link "开始使用 →" [ref=e16] [cursor=pointer]:
+ - /url: /zh-cn/docs/get-started/
+ - main [ref=e17]:
+ - generic [ref=e18]:
+ - generic [ref=e19]: 开源 · v1.4.0-beta 已发布
+ - img "DeepTutor" [ref=e21]
+ - heading "个性化学习, 重新想象。" [level=1] [ref=e22]:
+ - text: 个性化学习,
+ - emphasis [ref=e23]: 重新想象。
+ - paragraph [ref=e24]: 一个 agent-native 的学习伴侣 —— 五种模式共享一个工作区,自主 TutorBot, 以及和你一起成长的知识中枢。
+ - generic [ref=e25]:
+ - link "开始使用" [ref=e26] [cursor=pointer]:
+ - /url: /zh-cn/docs/get-started/
+ - link "在 GitHub 上查看" [ref=e27] [cursor=pointer]:
+ - /url: https://github.com/HKUDS/DeepTutor
+ - text: 在 GitHub 上查看
+ - img [ref=e28]
+ - generic [ref=e30]:
+ - generic [ref=e31]:
+ - strong [ref=e32]: Apache 2.0
+ - text: · 类 MIT 宽松协议
+ - generic [ref=e33]: ·
+ - generic [ref=e34]:
+ - text: 由
+ - strong [ref=e35]: 香港大学数据智能实验室
+ - text: 构建
+ - generic [ref=e36]: ·
+ - generic [ref=e37]: Python 3.11 · Next.js 16
+ - generic [ref=e39]:
+ - generic [ref=e44]: DeepTutor —— 聊天工作台
+ - img "DeepTutor 聊天工作台 —— 侧栏 Chat / TutorBot / Co-Writer / Book / 知识库 / Space / 记忆;主区域显示问候语和输入框。" [ref=e45]
+ - generic [ref=e46]:
+ - generic [ref=e47]: § I
+ - generic [ref=e48]:
+ - generic [ref=e49]: 里面是什么
+ - heading "六根支柱,同一份运行时上下文。" [level=2] [ref=e50]:
+ - text: 六根支柱,
+ - emphasis [ref=e51]: 同一份
+ - text: 运行时上下文。
+ - paragraph [ref=e52]: 每个界面都从同一份记忆、知识库、导师那里读写。 切换上下文不再意味着丢失当前位置。
+ - generic [ref=e53]:
+ - link "I 聊天工作台 五种模式 —— Chat / Solve / Quiz / Research / Visualize —— 共享同一个 session、知识库和引用历史,对话中段切换不丢上下文。" [ref=e54] [cursor=pointer]:
+ - /url: /zh-cn/docs/explore/chat-workspace/
+ - generic [ref=e55]: I
+ - heading "聊天工作台" [level=3] [ref=e56]
+ - paragraph [ref=e57]: 五种模式 —— Chat / Solve / Quiz / Research / Visualize —— 共享同一个 session、知识库和引用历史,对话中段切换不丢上下文。
+ - img [ref=e59]
+ - link "II Co-Writer 双栏 Markdown 工作台,AI 是一等公民协作者。选中、改写、扩展,全部基于你的知识库。" [ref=e61] [cursor=pointer]:
+ - /url: /zh-cn/docs/explore/co-writer/
+ - generic [ref=e62]: II
+ - heading "Co-Writer" [level=3] [ref=e63]
+ - paragraph [ref=e64]: 双栏 Markdown 工作台,AI 是一等公民协作者。选中、改写、扩展,全部基于你的知识库。
+ - img [ref=e66]
+ - link "III Book Engine 多 agent 流水线把你的材料编成可交互的「活书」—— 13 种 block,含 GeoGebra viewer 和动画。" [ref=e68] [cursor=pointer]:
+ - /url: /zh-cn/docs/explore/book/
+ - generic [ref=e69]: III
+ - heading "Book Engine" [level=3] [ref=e70]
+ - paragraph [ref=e71]: 多 agent 流水线把你的材料编成可交互的「活书」—— 13 种 block,含 GeoGebra viewer 和动画。
+ - img [ref=e73]
+ - link "IV 知识库 端到端 LlamaIndex 的带版本管理 RAG 文档库。每一次(重新)索引都可追溯、可对比、可回滚。" [ref=e75] [cursor=pointer]:
+ - /url: /zh-cn/docs/explore/knowledge/
+ - generic [ref=e76]: IV
+ - heading "知识库" [level=3] [ref=e77]
+ - paragraph [ref=e78]: 端到端 LlamaIndex 的带版本管理 RAG 文档库。每一次(重新)索引都可追溯、可对比、可回滚。
+ - img [ref=e80]
+ - link "V Space 你的个人图书馆 —— chat history、notebook、question bank、自定义 skill。每个活跃界面的「阅读 / 回顾」对偶面。" [ref=e82] [cursor=pointer]:
+ - /url: /zh-cn/docs/explore/space/
+ - generic [ref=e83]: V
+ - heading "Space" [level=3] [ref=e84]
+ - paragraph [ref=e85]: 你的个人图书馆 —— chat history、notebook、question bank、自定义 skill。每个活跃界面的「阅读 / 回顾」对偶面。
+ - img [ref=e87]
+ - link "VI 记忆系统 Append-only 的 L1 trace、带引用的 L2 精炼事实、跨界面综合的 L3。Memory Graph 让你随时审计 DeepTutor 为什么知道某件事。" [ref=e89] [cursor=pointer]:
+ - /url: /zh-cn/docs/explore/memory/
+ - generic [ref=e90]: VI
+ - heading "记忆系统" [level=3] [ref=e91]
+ - paragraph [ref=e92]: Append-only 的 L1 trace、带引用的 L2 精炼事实、跨界面综合的 L3。Memory Graph 让你随时审计 DeepTutor 为什么知道某件事。
+ - img [ref=e94]
+ - generic [ref=e96]:
+ - generic [ref=e97]: § II
+ - generic [ref=e98]:
+ - generic [ref=e99]: 安装
+ - heading "几分钟就能跑起来。" [level=2] [ref=e100]:
+ - text: 几
+ - emphasis [ref=e101]: 分钟
+ - text: 就能跑起来。
+ - paragraph [ref=e102]: 四种安装方式 —— 挑一个适合你的。 最终都落到同一个配置好的工作区。
+ - generic [ref=e103]:
+ - tablist [ref=e104]:
+ - tab "$ pip install -U deeptutor PyPI" [selected] [ref=e105] [cursor=pointer]:
+ - generic [ref=e106]: $
+ - generic [ref=e107]: pip install -U deeptutor
+ - generic [ref=e108]: PyPI
+ - tab "$ docker run … ghcr.io/hkuds/deeptutor Docker" [ref=e109] [cursor=pointer]:
+ - generic [ref=e110]: $
+ - generic [ref=e111]: docker run … ghcr.io/hkuds/deeptutor
+ - generic [ref=e112]: Docker
+ - tab "$ git clone … && pip install -e . 源码" [ref=e113] [cursor=pointer]:
+ - generic [ref=e114]: $
+ - generic [ref=e115]: git clone … && pip install -e .
+ - generic [ref=e116]: 源码
+ - tab "$ pip install -e ./packaging/deeptutor-cli CLI" [ref=e117] [cursor=pointer]:
+ - generic [ref=e118]: $
+ - generic [ref=e119]: pip install -e ./packaging/deeptutor-cli
+ - generic [ref=e120]: CLI
+ - tabpanel [ref=e122]:
+ - paragraph [ref=e123]: 最顺滑的路径:完整本地 Web 应用 + CLI,无需 clone。
+ - code [ref=e125]: "# 1. 准备一个工作区目录 mkdir -p my-deeptutor && cd my-deeptutor # 2. 安装、配置、启动 pip install -U deeptutor deeptutor init deeptutor start"
+ - generic [ref=e126]:
+ - generic [ref=e127]: 然后打开 127.0.0.1:3782
+ - link "完整指南" [ref=e128] [cursor=pointer]:
+ - /url: /zh-cn/docs/get-started/pypi/
+ - text: 完整指南
+ - img [ref=e129]
+ - generic [ref=e131]:
+ - generic [ref=e132]: § III
+ - generic [ref=e133]:
+ - generic [ref=e134]: 生态
+ - heading "共同构建。" [level=2] [ref=e135]:
+ - emphasis [ref=e136]: 共同构建
+ - text: 。
+ - paragraph [ref=e137]: DeepTutor 站在港大数据智能实验室 (HKU Data Intelligence Lab) 的一小组开源原语之上。
+ - generic [ref=e138]:
+ - link "nanobot 极简 AI agent 运行时" [ref=e139] [cursor=pointer]:
+ - /url: https://github.com/HKUDS/nanobot
+ - generic [ref=e140]: nanobot
+ - generic [ref=e141]: 极简 AI agent 运行时
+ - img [ref=e143]
+ - link "LightRAG 简单、快速的检索增强生成" [ref=e145] [cursor=pointer]:
+ - /url: https://github.com/HKUDS/LightRAG
+ - generic [ref=e146]: LightRAG
+ - generic [ref=e147]: 简单、快速的检索增强生成
+ - img [ref=e149]
+ - link "AutoAgent 零代码 agent 框架" [ref=e151] [cursor=pointer]:
+ - /url: https://github.com/HKUDS/AutoAgent
+ - generic [ref=e152]: AutoAgent
+ - generic [ref=e153]: 零代码 agent 框架
+ - img [ref=e155]
+ - link "AI-Researcher 自动化研究工作流" [ref=e157] [cursor=pointer]:
+ - /url: https://github.com/HKUDS/AI-Researcher
+ - generic [ref=e158]: AI-Researcher
+ - generic [ref=e159]: 自动化研究工作流
+ - img [ref=e161]
+ - generic [ref=e163]:
+ - generic [ref=e164]:
+ - link "DeepTutor" [ref=e165] [cursor=pointer]:
+ - /url: /zh-cn/
+ - generic [ref=e166]: DeepTutor
+ - generic [ref=e167]:
+ - generic [ref=e168]:
+ - heading "文档" [level=4] [ref=e169]
+ - link "快速上手" [ref=e170] [cursor=pointer]:
+ - /url: /zh-cn/docs/get-started/
+ - link "探索 DeepTutor" [ref=e171] [cursor=pointer]:
+ - /url: /zh-cn/docs/explore/
+ - link "TutorBot 渠道" [ref=e172] [cursor=pointer]:
+ - /url: /zh-cn/docs/tutorbot/
+ - link "CLI" [ref=e173] [cursor=pointer]:
+ - /url: /zh-cn/docs/cli/
+ - generic [ref=e174]:
+ - heading "社区" [level=4] [ref=e175]
+ - link "Discord" [ref=e176] [cursor=pointer]:
+ - /url: https://discord.gg/eRsjPgMU4t
+ - link "微信社区" [ref=e177] [cursor=pointer]:
+ - /url: https://github.com/HKUDS/DeepTutor/issues/78
+ - link "讨论区" [ref=e178] [cursor=pointer]:
+ - /url: https://github.com/HKUDS/DeepTutor/discussions
+ - link "Issues" [ref=e179] [cursor=pointer]:
+ - /url: https://github.com/HKUDS/DeepTutor/issues
+ - generic [ref=e180]:
+ - heading "项目" [level=4] [ref=e181]
+ - link "GitHub" [ref=e182] [cursor=pointer]:
+ - /url: https://github.com/HKUDS/DeepTutor
+ - link "协议" [ref=e183] [cursor=pointer]:
+ - /url: https://github.com/HKUDS/DeepTutor/blob/main/LICENSE
+ - link "arXiv" [ref=e184] [cursor=pointer]:
+ - /url: https://arxiv.org/abs/2604.26962
+ - generic [ref=e186]:
+ - generic [ref=e187]:
+ - text: © 2026
+ - link "港大数据智能实验室" [ref=e188] [cursor=pointer]:
+ - /url: https://github.com/HKUDS
+ - generic [ref=e189]: 基于 Apache 2.0 协议发布
\ No newline at end of file
diff --git a/.playwright-cli/page-2026-05-22T09-17-50-672Z.yml b/.playwright-cli/page-2026-05-22T09-17-50-672Z.yml
new file mode 100644
index 000000000..a86fc7be6
--- /dev/null
+++ b/.playwright-cli/page-2026-05-22T09-17-50-672Z.yml
@@ -0,0 +1,205 @@
+- generic [active] [ref=e1]:
+ - banner [ref=e2]:
+ - generic [ref=e3]:
+ - link "DeepTutor" [ref=e4] [cursor=pointer]:
+ - /url: /zh-cn/
+ - generic [ref=e5]: DeepTutor
+ - navigation [ref=e6]:
+ - link "文档" [ref=e7] [cursor=pointer]:
+ - /url: /zh-cn/docs/
+ - link "GitHub" [ref=e8] [cursor=pointer]:
+ - /url: https://github.com/HKUDS/DeepTutor
+ - generic "偏好设置" [ref=e9]:
+ - generic [ref=e10]:
+ - generic [ref=e11]: 语言
+ - combobox "语言" [ref=e12] [cursor=pointer]:
+ - option "English"
+ - option "简体中文" [selected]
+ - generic [ref=e13]:
+ - generic [ref=e14]: 主题
+ - combobox "主题" [ref=e15] [cursor=pointer]:
+ - option "自动"
+ - option "浅色"
+ - option "深色" [selected]
+ - link "开始使用 →" [ref=e16] [cursor=pointer]:
+ - /url: /zh-cn/docs/get-started/
+ - main [ref=e17]:
+ - generic [ref=e18]:
+ - generic [ref=e19]: 开源 · v1.4.0-beta 已发布
+ - img "DeepTutor" [ref=e21]
+ - heading "个性化学习, 重新想象。" [level=1] [ref=e22]:
+ - text: 个性化学习,
+ - emphasis [ref=e23]: 重新想象。
+ - paragraph [ref=e24]: 一个 agent-native 的学习伴侣 —— 五种模式共享一个工作区,自主 TutorBot, 以及和你一起成长的知识中枢。
+ - generic [ref=e25]:
+ - link "开始使用" [ref=e26] [cursor=pointer]:
+ - /url: /zh-cn/docs/get-started/
+ - link "在 GitHub 上查看" [ref=e27] [cursor=pointer]:
+ - /url: https://github.com/HKUDS/DeepTutor
+ - text: 在 GitHub 上查看
+ - img [ref=e28]
+ - generic [ref=e30]:
+ - generic [ref=e31]:
+ - strong [ref=e32]: Apache 2.0
+ - text: · 类 MIT 宽松协议
+ - generic [ref=e33]: ·
+ - generic [ref=e34]:
+ - text: 由
+ - strong [ref=e35]: 香港大学数据智能实验室
+ - text: 构建
+ - generic [ref=e36]: ·
+ - generic [ref=e37]: Python 3.11 · Next.js 16
+ - generic [ref=e39]:
+ - generic [ref=e44]: DeepTutor —— 聊天工作台
+ - img "DeepTutor 聊天工作台 —— 侧栏 Chat / TutorBot / Co-Writer / Book / 知识库 / Space / 记忆;主区域显示问候语和输入框。" [ref=e45]
+ - generic [ref=e46]:
+ - generic [ref=e47]: § I
+ - generic [ref=e48]:
+ - generic [ref=e49]: 里面是什么
+ - heading "六根支柱,同一份运行时上下文。" [level=2] [ref=e50]:
+ - text: 六根支柱,
+ - emphasis [ref=e51]: 同一份
+ - text: 运行时上下文。
+ - paragraph [ref=e52]: 每个界面都从同一份记忆、知识库、导师那里读写。 切换上下文不再意味着丢失当前位置。
+ - generic [ref=e53]:
+ - link "I 聊天工作台 五种模式 —— Chat / Solve / Quiz / Research / Visualize —— 共享同一个 session、知识库和引用历史,对话中段切换不丢上下文。" [ref=e54] [cursor=pointer]:
+ - /url: /zh-cn/docs/explore/chat-workspace/
+ - generic [ref=e55]: I
+ - heading "聊天工作台" [level=3] [ref=e56]
+ - paragraph [ref=e57]: 五种模式 —— Chat / Solve / Quiz / Research / Visualize —— 共享同一个 session、知识库和引用历史,对话中段切换不丢上下文。
+ - img [ref=e59]
+ - link "II Co-Writer 双栏 Markdown 工作台,AI 是一等公民协作者。选中、改写、扩展,全部基于你的知识库。" [ref=e61] [cursor=pointer]:
+ - /url: /zh-cn/docs/explore/co-writer/
+ - generic [ref=e62]: II
+ - heading "Co-Writer" [level=3] [ref=e63]
+ - paragraph [ref=e64]: 双栏 Markdown 工作台,AI 是一等公民协作者。选中、改写、扩展,全部基于你的知识库。
+ - img [ref=e66]
+ - link "III Book Engine 多 agent 流水线把你的材料编成可交互的「活书」—— 13 种 block,含 GeoGebra viewer 和动画。" [ref=e68] [cursor=pointer]:
+ - /url: /zh-cn/docs/explore/book/
+ - generic [ref=e69]: III
+ - heading "Book Engine" [level=3] [ref=e70]
+ - paragraph [ref=e71]: 多 agent 流水线把你的材料编成可交互的「活书」—— 13 种 block,含 GeoGebra viewer 和动画。
+ - img [ref=e73]
+ - link "IV 知识库 端到端 LlamaIndex 的带版本管理 RAG 文档库。每一次(重新)索引都可追溯、可对比、可回滚。" [ref=e75] [cursor=pointer]:
+ - /url: /zh-cn/docs/explore/knowledge/
+ - generic [ref=e76]: IV
+ - heading "知识库" [level=3] [ref=e77]
+ - paragraph [ref=e78]: 端到端 LlamaIndex 的带版本管理 RAG 文档库。每一次(重新)索引都可追溯、可对比、可回滚。
+ - img [ref=e80]
+ - link "V Space 你的个人图书馆 —— chat history、notebook、question bank、自定义 skill。每个活跃界面的「阅读 / 回顾」对偶面。" [ref=e82] [cursor=pointer]:
+ - /url: /zh-cn/docs/explore/space/
+ - generic [ref=e83]: V
+ - heading "Space" [level=3] [ref=e84]
+ - paragraph [ref=e85]: 你的个人图书馆 —— chat history、notebook、question bank、自定义 skill。每个活跃界面的「阅读 / 回顾」对偶面。
+ - img [ref=e87]
+ - link "VI 记忆系统 Append-only 的 L1 trace、带引用的 L2 精炼事实、跨界面综合的 L3。Memory Graph 让你随时审计 DeepTutor 为什么知道某件事。" [ref=e89] [cursor=pointer]:
+ - /url: /zh-cn/docs/explore/memory/
+ - generic [ref=e90]: VI
+ - heading "记忆系统" [level=3] [ref=e91]
+ - paragraph [ref=e92]: Append-only 的 L1 trace、带引用的 L2 精炼事实、跨界面综合的 L3。Memory Graph 让你随时审计 DeepTutor 为什么知道某件事。
+ - img [ref=e94]
+ - generic [ref=e96]:
+ - generic [ref=e97]: § II
+ - generic [ref=e98]:
+ - generic [ref=e99]: 安装
+ - heading "几分钟就能跑起来。" [level=2] [ref=e100]:
+ - text: 几
+ - emphasis [ref=e101]: 分钟
+ - text: 就能跑起来。
+ - paragraph [ref=e102]: 四种安装方式 —— 挑一个适合你的。 最终都落到同一个配置好的工作区。
+ - generic [ref=e103]:
+ - tablist [ref=e104]:
+ - tab "$ pip install -U deeptutor PyPI" [selected] [ref=e105] [cursor=pointer]:
+ - generic [ref=e106]: $
+ - generic [ref=e107]: pip install -U deeptutor
+ - generic [ref=e108]: PyPI
+ - tab "$ docker run … ghcr.io/hkuds/deeptutor Docker" [ref=e109] [cursor=pointer]:
+ - generic [ref=e110]: $
+ - generic [ref=e111]: docker run … ghcr.io/hkuds/deeptutor
+ - generic [ref=e112]: Docker
+ - tab "$ git clone … && pip install -e . 源码" [ref=e113] [cursor=pointer]:
+ - generic [ref=e114]: $
+ - generic [ref=e115]: git clone … && pip install -e .
+ - generic [ref=e116]: 源码
+ - tab "$ pip install -e ./packaging/deeptutor-cli CLI" [ref=e117] [cursor=pointer]:
+ - generic [ref=e118]: $
+ - generic [ref=e119]: pip install -e ./packaging/deeptutor-cli
+ - generic [ref=e120]: CLI
+ - tabpanel [ref=e122]:
+ - paragraph [ref=e123]: 最顺滑的路径:完整本地 Web 应用 + CLI,无需 clone。
+ - code [ref=e125]: "# 1. 准备一个工作区目录 mkdir -p my-deeptutor && cd my-deeptutor # 2. 安装、配置、启动 pip install -U deeptutor deeptutor init deeptutor start"
+ - generic [ref=e126]:
+ - generic [ref=e127]: 然后打开 127.0.0.1:3782
+ - link "完整指南" [ref=e128] [cursor=pointer]:
+ - /url: /zh-cn/docs/get-started/pypi/
+ - text: 完整指南
+ - img [ref=e129]
+ - generic [ref=e131]:
+ - generic [ref=e132]: § III
+ - generic [ref=e133]:
+ - generic [ref=e134]: 生态
+ - heading "共同构建。" [level=2] [ref=e135]:
+ - emphasis [ref=e136]: 共同构建
+ - text: 。
+ - paragraph [ref=e137]: DeepTutor 站在港大数据智能实验室 (HKU Data Intelligence Lab) 的一小组开源原语之上。
+ - generic [ref=e138]:
+ - link "nanobot 极简 AI agent 运行时" [ref=e139] [cursor=pointer]:
+ - /url: https://github.com/HKUDS/nanobot
+ - generic [ref=e140]: nanobot
+ - generic [ref=e141]: 极简 AI agent 运行时
+ - img [ref=e143]
+ - link "LightRAG 简单、快速的检索增强生成" [ref=e145] [cursor=pointer]:
+ - /url: https://github.com/HKUDS/LightRAG
+ - generic [ref=e146]: LightRAG
+ - generic [ref=e147]: 简单、快速的检索增强生成
+ - img [ref=e149]
+ - link "AutoAgent 零代码 agent 框架" [ref=e151] [cursor=pointer]:
+ - /url: https://github.com/HKUDS/AutoAgent
+ - generic [ref=e152]: AutoAgent
+ - generic [ref=e153]: 零代码 agent 框架
+ - img [ref=e155]
+ - link "AI-Researcher 自动化研究工作流" [ref=e157] [cursor=pointer]:
+ - /url: https://github.com/HKUDS/AI-Researcher
+ - generic [ref=e158]: AI-Researcher
+ - generic [ref=e159]: 自动化研究工作流
+ - img [ref=e161]
+ - generic [ref=e163]:
+ - generic [ref=e164]:
+ - link "DeepTutor" [ref=e165] [cursor=pointer]:
+ - /url: /zh-cn/
+ - generic [ref=e166]: DeepTutor
+ - generic [ref=e167]:
+ - generic [ref=e168]:
+ - heading "文档" [level=4] [ref=e169]
+ - link "快速上手" [ref=e170] [cursor=pointer]:
+ - /url: /zh-cn/docs/get-started/
+ - link "探索 DeepTutor" [ref=e171] [cursor=pointer]:
+ - /url: /zh-cn/docs/explore/
+ - link "TutorBot 渠道" [ref=e172] [cursor=pointer]:
+ - /url: /zh-cn/docs/tutorbot/
+ - link "CLI" [ref=e173] [cursor=pointer]:
+ - /url: /zh-cn/docs/cli/
+ - generic [ref=e174]:
+ - heading "社区" [level=4] [ref=e175]
+ - link "Discord" [ref=e176] [cursor=pointer]:
+ - /url: https://discord.gg/eRsjPgMU4t
+ - link "微信社区" [ref=e177] [cursor=pointer]:
+ - /url: https://github.com/HKUDS/DeepTutor/issues/78
+ - link "讨论区" [ref=e178] [cursor=pointer]:
+ - /url: https://github.com/HKUDS/DeepTutor/discussions
+ - link "Issues" [ref=e179] [cursor=pointer]:
+ - /url: https://github.com/HKUDS/DeepTutor/issues
+ - generic [ref=e180]:
+ - heading "项目" [level=4] [ref=e181]
+ - link "GitHub" [ref=e182] [cursor=pointer]:
+ - /url: https://github.com/HKUDS/DeepTutor
+ - link "协议" [ref=e183] [cursor=pointer]:
+ - /url: https://github.com/HKUDS/DeepTutor/blob/main/LICENSE
+ - link "arXiv" [ref=e184] [cursor=pointer]:
+ - /url: https://arxiv.org/abs/2604.26962
+ - generic [ref=e186]:
+ - generic [ref=e187]:
+ - text: © 2026
+ - link "港大数据智能实验室" [ref=e188] [cursor=pointer]:
+ - /url: https://github.com/HKUDS
+ - generic [ref=e189]: 基于 Apache 2.0 协议发布
\ No newline at end of file
diff --git a/.playwright-cli/page-2026-05-22T09-18-05-984Z.yml b/.playwright-cli/page-2026-05-22T09-18-05-984Z.yml
new file mode 100644
index 000000000..7d6893c19
--- /dev/null
+++ b/.playwright-cli/page-2026-05-22T09-18-05-984Z.yml
@@ -0,0 +1,286 @@
+- generic [active] [ref=e1]:
+ - link "Skip to content" [ref=e2] [cursor=pointer]:
+ - /url: "#_top"
+ - generic [ref=e3]:
+ - banner [ref=e4]:
+ - generic [ref=e5]:
+ - link "DeepTutor" [ref=e7] [cursor=pointer]:
+ - /url: /
+ - generic [ref=e8]: DeepTutor
+ - button "Search" [ref=e11] [cursor=pointer]:
+ - img [ref=e12]
+ - generic [ref=e14]: Search
+ - generic [ref=e15]:
+ - generic [ref=e16]: ⌘
+ - generic [ref=e17]: K
+ - generic [ref=e18]:
+ - generic [ref=e20]:
+ - link "Report issue" [ref=e21] [cursor=pointer]:
+ - /url: https://github.com/HKUDS/DeepTutor/issues/new?template=docs.yml&page=https%3A%2F%2Fdeeptutor.info%2Fdocs%2F
+ - img [ref=e22]
+ - generic [ref=e24]: Report issue
+ - link "GitHub" [ref=e25] [cursor=pointer]:
+ - /url: https://github.com/HKUDS/DeepTutor
+ - generic [ref=e26]: GitHub
+ - img [ref=e27]
+ - link "Discord" [ref=e29] [cursor=pointer]:
+ - /url: https://discord.gg/eRsjPgMU4t
+ - generic [ref=e30]: Discord
+ - img [ref=e31]
+ - link "WeChat community" [ref=e33] [cursor=pointer]:
+ - /url: https://github.com/HKUDS/DeepTutor/issues/78
+ - img [ref=e34]
+ - generic [ref=e37]:
+ - generic [ref=e38]: Select theme
+ - img
+ - combobox "Select theme" [ref=e39] [cursor=pointer]:
+ - option "Dark" [selected]
+ - option "Light"
+ - option "Auto"
+ - img
+ - generic [ref=e41]:
+ - generic [ref=e42]: Select language
+ - img
+ - combobox "Select language" [ref=e43] [cursor=pointer]:
+ - option "English" [selected]
+ - option "简体中文"
+ - img
+ - navigation "Main":
+ - list [ref=e47]:
+ - listitem [ref=e48]:
+ - group [ref=e49]:
+ - generic "Overview" [ref=e50] [cursor=pointer]:
+ - generic [ref=e51]: Overview
+ - img [ref=e52]
+ - list [ref=e54]:
+ - listitem [ref=e55]:
+ - link "Documentation home" [ref=e56] [cursor=pointer]:
+ - /url: /docs/
+ - listitem [ref=e57]:
+ - link "Contributing" [ref=e58] [cursor=pointer]:
+ - /url: /docs/contributing/
+ - listitem [ref=e59]:
+ - group [ref=e60]:
+ - generic "Get Started" [ref=e61] [cursor=pointer]:
+ - generic [ref=e62]: Get Started
+ - img [ref=e63]
+ - list [ref=e65]:
+ - listitem [ref=e66]:
+ - link "Overview" [ref=e67] [cursor=pointer]:
+ - /url: /docs/get-started/
+ - listitem [ref=e68]:
+ - link "1 · Install from PyPI" [ref=e69] [cursor=pointer]:
+ - /url: /docs/get-started/pypi/
+ - listitem [ref=e70]:
+ - link "2 · Install from Source" [ref=e71] [cursor=pointer]:
+ - /url: /docs/get-started/from-source/
+ - listitem [ref=e72]:
+ - link "3 · Docker" [ref=e73] [cursor=pointer]:
+ - /url: /docs/get-started/docker/
+ - listitem [ref=e74]:
+ - link "4 · CLI-Only Install" [ref=e75] [cursor=pointer]:
+ - /url: /docs/get-started/cli-only/
+ - listitem [ref=e76]:
+ - link "Multi-User Deployment" [ref=e77] [cursor=pointer]:
+ - /url: /docs/get-started/multi-user/
+ - listitem [ref=e78]:
+ - link "Providers" [ref=e79] [cursor=pointer]:
+ - /url: /docs/get-started/providers/
+ - listitem [ref=e80]:
+ - link "Troubleshooting" [ref=e81] [cursor=pointer]:
+ - /url: /docs/get-started/troubleshooting/
+ - listitem [ref=e82]:
+ - group [ref=e83]:
+ - generic "Explore DeepTutor" [ref=e84] [cursor=pointer]:
+ - generic [ref=e85]: Explore DeepTutor
+ - img [ref=e86]
+ - list [ref=e88]:
+ - listitem [ref=e89]:
+ - link "Overview" [ref=e90] [cursor=pointer]:
+ - /url: /docs/explore/
+ - listitem [ref=e91]:
+ - link "Chat Workspace" [ref=e92] [cursor=pointer]:
+ - /url: /docs/explore/chat-workspace/
+ - listitem [ref=e93]:
+ - link "Co-Writer" [ref=e94] [cursor=pointer]:
+ - /url: /docs/explore/co-writer/
+ - listitem [ref=e95]:
+ - link "Book Engine" [ref=e96] [cursor=pointer]:
+ - /url: /docs/explore/book/
+ - listitem [ref=e97]:
+ - link "Knowledge" [ref=e98] [cursor=pointer]:
+ - /url: /docs/explore/knowledge/
+ - listitem [ref=e99]:
+ - link "Space" [ref=e100] [cursor=pointer]:
+ - /url: /docs/explore/space/
+ - listitem [ref=e101]:
+ - link "Memory" [ref=e102] [cursor=pointer]:
+ - /url: /docs/explore/memory/
+ - listitem [ref=e103]:
+ - link "Settings" [ref=e104] [cursor=pointer]:
+ - /url: /docs/explore/settings/
+ - listitem [ref=e105]:
+ - group [ref=e106]:
+ - generic "Explore TutorBot" [ref=e107] [cursor=pointer]:
+ - generic [ref=e108]: Explore TutorBot
+ - img [ref=e109]
+ - list [ref=e111]:
+ - listitem [ref=e112]:
+ - link "Overview" [ref=e113] [cursor=pointer]:
+ - /url: /docs/tutorbot/
+ - listitem [ref=e114]:
+ - link "Telegram" [ref=e115] [cursor=pointer]:
+ - /url: /docs/tutorbot/telegram/
+ - listitem [ref=e116]:
+ - link "Discord" [ref=e117] [cursor=pointer]:
+ - /url: /docs/tutorbot/discord/
+ - listitem [ref=e118]:
+ - link "Slack" [ref=e119] [cursor=pointer]:
+ - /url: /docs/tutorbot/slack/
+ - listitem [ref=e120]:
+ - link "Matrix" [ref=e121] [cursor=pointer]:
+ - /url: /docs/tutorbot/matrix/
+ - listitem [ref=e122]:
+ - link "Zulip" [ref=e123] [cursor=pointer]:
+ - /url: /docs/tutorbot/zulip/
+ - listitem [ref=e124]:
+ - link "Feishu / Lark" [ref=e125] [cursor=pointer]:
+ - /url: /docs/tutorbot/feishu/
+ - listitem [ref=e126]:
+ - link "WeCom" [ref=e127] [cursor=pointer]:
+ - /url: /docs/tutorbot/wecom/
+ - listitem [ref=e128]:
+ - link "DingTalk" [ref=e129] [cursor=pointer]:
+ - /url: /docs/tutorbot/dingtalk/
+ - listitem [ref=e130]:
+ - link "QQ" [ref=e131] [cursor=pointer]:
+ - /url: /docs/tutorbot/qq/
+ - listitem [ref=e132]:
+ - link "WhatsApp" [ref=e133] [cursor=pointer]:
+ - /url: /docs/tutorbot/whatsapp/
+ - listitem [ref=e134]:
+ - link "Email" [ref=e135] [cursor=pointer]:
+ - /url: /docs/tutorbot/email/
+ - listitem [ref=e136]:
+ - link "Mochat" [ref=e137] [cursor=pointer]:
+ - /url: /docs/tutorbot/mochat/
+ - listitem [ref=e138]:
+ - group [ref=e139]:
+ - generic "DeepTutor CLI" [ref=e140] [cursor=pointer]:
+ - generic [ref=e141]: DeepTutor CLI
+ - img [ref=e142]
+ - list [ref=e144]:
+ - listitem [ref=e145]:
+ - link "Overview" [ref=e146] [cursor=pointer]:
+ - /url: /docs/cli/
+ - listitem [ref=e147]:
+ - link "Command Reference" [ref=e148] [cursor=pointer]:
+ - /url: /docs/cli/commands/
+ - listitem [ref=e149]:
+ - link "Interactive REPL" [ref=e150] [cursor=pointer]:
+ - /url: /docs/cli/chat-repl/
+ - listitem [ref=e151]:
+ - link "Agent Handoff" [ref=e152] [cursor=pointer]:
+ - /url: /docs/cli/agent-handoff/
+ - listitem [ref=e153]:
+ - link "Server API" [ref=e154] [cursor=pointer]:
+ - /url: /docs/cli/server-api/
+ - generic [ref=e156]:
+ - complementary [ref=e157]:
+ - navigation "On this page" [ref=e162]:
+ - heading "On this page" [level=2] [ref=e163]
+ - list [ref=e164]:
+ - listitem [ref=e165]:
+ - link "Overview" [ref=e166] [cursor=pointer]:
+ - /url: "#_top"
+ - listitem [ref=e167]:
+ - link "Where to start" [ref=e168] [cursor=pointer]:
+ - /url: "#where-to-start"
+ - listitem [ref=e169]:
+ - link "What is DeepTutor" [ref=e170] [cursor=pointer]:
+ - /url: "#what-is-deeptutor"
+ - listitem [ref=e171]:
+ - link "Help & community" [ref=e172] [cursor=pointer]:
+ - /url: "#help--community"
+ - main [ref=e174]:
+ - heading "Documentation" [level=1] [ref=e177]
+ - generic [ref=e179]:
+ - generic [ref=e180]:
+ - paragraph [ref=e181]: Welcome to the DeepTutor documentation. Pick a path below, or use the left sidebar.
+ - generic [ref=e182]:
+ - heading "Where to start" [level=2] [ref=e183]
+ - link "Section titled “Where to start”" [ref=e184] [cursor=pointer]:
+ - /url: "#where-to-start"
+ - img [ref=e186]
+ - generic [ref=e188]: Section titled “Where to start”
+ - list [ref=e189]:
+ - listitem [ref=e190]:
+ - strong [ref=e191]:
+ - link "Get Started" [ref=e192] [cursor=pointer]:
+ - /url: /docs/get-started/
+ - text: "— Four install paths: PyPI, From Source, Docker, CLI-Only."
+ - listitem [ref=e193]:
+ - strong [ref=e194]:
+ - link "Explore DeepTutor" [ref=e195] [cursor=pointer]:
+ - /url: /docs/explore/
+ - text: — Tour the five core surfaces (Chat, Co-Writer, Book, Knowledge, Space) plus Memory and Settings.
+ - listitem [ref=e196]:
+ - strong [ref=e197]:
+ - link "Explore TutorBot" [ref=e198] [cursor=pointer]:
+ - /url: /docs/tutorbot/
+ - text: — Connect persistent AI tutors to Telegram, Slack, Feishu, Matrix, and more.
+ - listitem [ref=e199]:
+ - strong [ref=e200]:
+ - link "DeepTutor CLI" [ref=e201] [cursor=pointer]:
+ - /url: /docs/cli/
+ - text: — Drive every capability from the terminal, or hand it to an AI agent.
+ - listitem [ref=e202]:
+ - strong [ref=e203]:
+ - link "Providers" [ref=e204] [cursor=pointer]:
+ - /url: /docs/get-started/providers/
+ - text: — Set up LLM, embedding, and search providers.
+ - generic [ref=e205]:
+ - heading "What is DeepTutor" [level=2] [ref=e206]
+ - link "Section titled “What is DeepTutor”" [ref=e207] [cursor=pointer]:
+ - /url: "#what-is-deeptutor"
+ - img [ref=e209]
+ - generic [ref=e211]: Section titled “What is DeepTutor”
+ - paragraph [ref=e212]:
+ - text: An open-source, agent-native learning companion.
+ - strong [ref=e213]: Five modes
+ - text: (Chat, Solve, Quiz, Research, Visualize) share one session, knowledge base, and citation history.
+ - strong [ref=e214]: TutorBots
+ - text: carry your context out to Telegram, Slack, Feishu, and other channels. A
+ - strong [ref=e215]: three-layer Memory
+ - text: with an inspectable workbench and a Memory Graph lets you audit
+ - emphasis [ref=e216]: why
+ - text: the system knows what it knows.
+ - paragraph [ref=e217]: Built at HKU Data Intelligence Lab. Apache 2.0 license.
+ - generic [ref=e218]:
+ - heading "Help & community" [level=2] [ref=e219]
+ - link "Section titled “Help & community”" [ref=e220] [cursor=pointer]:
+ - /url: "#help--community"
+ - img [ref=e222]
+ - generic [ref=e224]: Section titled “Help & community”
+ - list [ref=e225]:
+ - listitem [ref=e226]:
+ - link "Discord" [ref=e227] [cursor=pointer]:
+ - /url: https://discord.gg/eRsjPgMU4t
+ - text: — fastest place to ask questions
+ - listitem [ref=e228]:
+ - link "GitHub Discussions" [ref=e229] [cursor=pointer]:
+ - /url: https://github.com/HKUDS/DeepTutor/discussions
+ - text: — long-form Q&A and design proposals
+ - listitem [ref=e230]:
+ - link "Issue tracker" [ref=e231] [cursor=pointer]:
+ - /url: https://github.com/HKUDS/DeepTutor/issues
+ - text: — bug reports and feature requests
+ - listitem [ref=e232]:
+ - link "SKILL.md" [ref=e233] [cursor=pointer]:
+ - /url: https://github.com/HKUDS/DeepTutor/blob/main/SKILL.md
+ - text: — the canonical handover document for AI agents driving DeepTutor
+ - link "Next Contributing →" [ref=e236] [cursor=pointer]:
+ - /url: /docs/contributing/
+ - generic [ref=e237]:
+ - text: Next
+ - generic [ref=e238]: Contributing →
\ No newline at end of file
diff --git a/.playwright-cli/page-2026-05-22T09-20-16-418Z.yml b/.playwright-cli/page-2026-05-22T09-20-16-418Z.yml
new file mode 100644
index 000000000..003fbaef4
--- /dev/null
+++ b/.playwright-cli/page-2026-05-22T09-20-16-418Z.yml
@@ -0,0 +1,51 @@
+- generic [active] [ref=e1]:
+ - link "Skip to content" [ref=e2] [cursor=pointer]:
+ - /url: "#_top"
+ - generic [ref=e3]:
+ - banner [ref=e4]:
+ - generic [ref=e5]:
+ - link "DeepTutor" [ref=e7] [cursor=pointer]:
+ - /url: /
+ - generic [ref=e8]: DeepTutor
+ - button "Search" [ref=e11] [cursor=pointer]:
+ - img [ref=e12]
+ - generic [ref=e14]: Search
+ - generic [ref=e15]:
+ - generic [ref=e16]: ⌘
+ - generic [ref=e17]: K
+ - generic [ref=e18]:
+ - generic [ref=e20]:
+ - link "Report issue" [ref=e21] [cursor=pointer]:
+ - /url: https://github.com/HKUDS/DeepTutor/issues/new?template=docs.yml&page=https%3A%2F%2Fdeeptutor.info%2F404%2F
+ - img [ref=e22]
+ - generic [ref=e24]: Report issue
+ - link "GitHub" [ref=e25] [cursor=pointer]:
+ - /url: https://github.com/HKUDS/DeepTutor
+ - generic [ref=e26]: GitHub
+ - img [ref=e27]
+ - link "Discord" [ref=e29] [cursor=pointer]:
+ - /url: https://discord.gg/eRsjPgMU4t
+ - generic [ref=e30]: Discord
+ - img [ref=e31]
+ - link "WeChat community" [ref=e33] [cursor=pointer]:
+ - /url: https://github.com/HKUDS/DeepTutor/issues/78
+ - img [ref=e34]
+ - generic [ref=e37]:
+ - generic [ref=e38]: Select theme
+ - img
+ - combobox "Select theme" [ref=e39] [cursor=pointer]:
+ - option "Dark" [selected]
+ - option "Light"
+ - option "Auto"
+ - img
+ - generic [ref=e41]:
+ - generic [ref=e42]: Select language
+ - img
+ - combobox "Select language" [ref=e43] [cursor=pointer]:
+ - option "English"
+ - option "简体中文" [selected]
+ - img
+ - main [ref=e47]:
+ - generic [ref=e52]:
+ - heading "404" [level=1] [ref=e53]
+ - generic [ref=e54]: Page not found. Check the URL or try using the search bar.
\ No newline at end of file
diff --git a/README.md b/README.md
index 6f576d1b9..ee1c5ff7c 100644
--- a/README.md
+++ b/README.md
@@ -4,6 +4,10 @@
# DeepTutor: Agent-Native Personalized Tutoring
+<p align="center">
+ <a href="https://deeptutor.info" target="_blank"><img alt="Live at deeptutor.info" src="https://img.shields.io/badge/%E2%9C%A8%20Live%20at-deeptutor.info-6366F1?style=for-the-badge&labelColor=0F172A" height="40"></a>
+</p>
+
<a href="https://trendshift.io/repositories/17099" target="_blank"><img src="https://trendshift.io/api/badge/repositories/17099" alt="HKUDS%2FDeepTutor | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
<p align="center">
@@ -36,9 +40,7 @@
---
-> 🤝 **We welcome any kinds of contributing!** See our [Contributing Guide](CONTRIBUTING.md) for branching strategy, coding standards, and how to get started.
->
-> 🗺️ **Roadmap** is tracked in the open at [`HKUDS/DeepTutor#498`](https://github.com/HKUDS/DeepTutor/issues/498) — comment there to vote on items or propose new ones.
+> 🤝 **We welcome any kinds of contributing!** Vote on roadmap items or propose new ones at [`Roadmap`](https://github.com/HKUDS/DeepTutor/issues/498), and see our [Contributing Guide](CONTRIBUTING.md) for branching strategy, coding standards, and how to get started.
### 📦 Releases
@@ -119,6 +121,8 @@
### 📰 News
+> **[2026.5.22]** 🌐 Our official docs site is live at [**deeptutor.info**](https://deeptutor.info/) — guides, references, and capability tours all in one place.
+
> **[2026.4.19]** 🎉 We've reached 20k stars after 111 days! Thank you for the incredible support — we're committed to continuous iteration toward truly personalized, intelligent tutoring for everyone.
> **[2026.4.10]** 📄 Our paper is now live on arXiv! Read the [preprint](https://arxiv.org/abs/2604.26962) to learn more about the design and ideas behind DeepTutor.
diff --git a/deeptutor/agents/chat/agentic_pipeline.py b/deeptutor/agents/chat/agentic_pipeline.py
index 9d75d04ac..f139983b3 100644
--- a/deeptutor/agents/chat/agentic_pipeline.py
+++ b/deeptutor/agents/chat/agentic_pipeline.py
@@ -318,6 +318,7 @@ class AgenticChatPipeline:
self.base_url = getattr(self.llm_config, "base_url", None)
self.api_version = getattr(self.llm_config, "api_version", None)
self.extra_headers = getattr(self.llm_config, "extra_headers", None) or {}
+ self.reasoning_effort = getattr(self.llm_config, "reasoning_effort", None)
self.registry = get_tool_registry()
self._usage = UsageTracker(model=self.model)
@@ -363,6 +364,7 @@ class AgenticChatPipeline:
base_url=self.base_url,
api_version=self.api_version,
extra_headers=self.extra_headers or None,
+ reasoning_effort=self.reasoning_effort,
)
# ------------------------------------------------------------------
@@ -1619,6 +1621,8 @@ class AgenticChatPipeline:
temperature=self._chat_temperature,
model=self.model,
max_tokens=max_tokens,
+ binding=self.binding,
+ reasoning_effort=self.reasoning_effort,
)
def _can_use_native_tool_calling(self) -> bool:
diff --git a/deeptutor/agents/question/pipeline.py b/deeptutor/agents/question/pipeline.py
index 08406705d..cc8f4225f 100644
--- a/deeptutor/agents/question/pipeline.py
+++ b/deeptutor/agents/question/pipeline.py
@@ -25,15 +25,14 @@ to :mod:`deeptutor.core.agentic` and the shared tool-composition policy.
from __future__ import annotations
-import json
-import logging
-import re
from collections.abc import Awaitable
from dataclasses import dataclass, field
from enum import StrEnum
+import json
+import logging
+import re
from typing import Any
-from deeptutor.capabilities._shared import emit_capability_result
from deeptutor.agents._shared.tool_composition import (
ToolMountFlags,
compose_enabled_tools,
@@ -41,12 +40,12 @@ from deeptutor.agents._shared.tool_composition import (
user_has_memory,
user_has_notebooks,
)
+from deeptutor.capabilities._shared import emit_capability_result
from deeptutor.core.agentic import (
DispatchOutcome,
- LLMClientConfig,
LabeledStepResult,
LabelProtocol,
- LoopOutcome,
+ LLMClientConfig,
UsageTracker,
build_completion_kwargs,
build_openai_client,
@@ -405,6 +404,7 @@ class QuestionPipeline:
self.llm_config = get_llm_config()
self.binding = getattr(self.llm_config, "binding", None) or "openai"
self.model = getattr(self.llm_config, "model", None)
+ self.reasoning_effort = getattr(self.llm_config, "reasoning_effort", None)
self.client_config = LLMClientConfig(
binding=self.binding,
model=self.model,
@@ -412,6 +412,7 @@ class QuestionPipeline:
base_url=getattr(self.llm_config, "base_url", None),
api_version=getattr(self.llm_config, "api_version", None),
extra_headers=getattr(self.llm_config, "extra_headers", None) or None,
+ reasoning_effort=self.reasoning_effort,
)
self.registry = get_tool_registry()
@@ -1019,8 +1020,8 @@ class QuestionPipeline:
),
)
- # ``build_completion_kwargs`` only returns temperature + token-limit
- # kwargs; ``model``/``messages``/``stream`` must be added explicitly
+ # ``build_completion_kwargs`` returns generation/provider kwargs;
+ # ``model``/``messages``/``stream`` must be added explicitly
# (mirrors how ``run_labeled_step`` composes its create call).
kwargs: dict[str, Any] = {
"model": self.model,
@@ -1030,6 +1031,8 @@ class QuestionPipeline:
temperature=TOOL_SUMMARIZER_TEMPERATURE,
model=self.model,
max_tokens=self.tool_summarizer_max_tokens,
+ binding=self.binding,
+ reasoning_effort=self.reasoning_effort,
),
}
try:
@@ -1634,6 +1637,8 @@ class QuestionPipeline:
temperature=self._temperature,
model=self.model,
max_tokens=max_tokens,
+ binding=self.binding,
+ reasoning_effort=self.reasoning_effort,
)
async def _run_labeled_step(
diff --git a/deeptutor/agents/research/pipeline.py b/deeptutor/agents/research/pipeline.py
index 0e2dfd211..be7210309 100644
--- a/deeptutor/agents/research/pipeline.py
+++ b/deeptutor/agents/research/pipeline.py
@@ -32,27 +32,33 @@ deep research distinct — are preserved.
from __future__ import annotations
import asyncio
+from collections.abc import Awaitable
+from dataclasses import dataclass
import html
import logging
import re
-from collections.abc import Awaitable, Callable
-from dataclasses import dataclass, field
from typing import Any
+from deeptutor.agents._shared.tool_composition import (
+ ToolMountFlags,
+ compose_enabled_tools,
+ default_optional_tools,
+ user_has_memory,
+ user_has_notebooks,
+)
from deeptutor.agents.research.data_structures import (
DynamicTopicQueue,
+ ToolTrace,
TopicBlock,
TopicStatus,
- ToolTrace,
)
from deeptutor.agents.research.utils.citation_manager import CitationManager
from deeptutor.capabilities._shared import emit_capability_result
from deeptutor.core.agentic import (
DispatchOutcome,
- LLMClientConfig,
LabeledStepResult,
LabelProtocol,
- LoopOutcome,
+ LLMClientConfig,
UsageTracker,
build_completion_kwargs,
build_openai_client,
@@ -64,7 +70,6 @@ from deeptutor.core.agentic import (
)
from deeptutor.core.agentic.tool_dispatch import (
MAX_PARALLEL_TOOL_CALLS,
- execute_tool_call,
)
from deeptutor.core.context import Attachment, UnifiedContext
from deeptutor.core.stream_bus import StreamBus
@@ -74,13 +79,6 @@ from deeptutor.core.trace import (
merge_trace_metadata,
new_call_id,
)
-from deeptutor.agents._shared.tool_composition import (
- ToolMountFlags,
- compose_enabled_tools,
- default_optional_tools,
- user_has_memory,
- user_has_notebooks,
-)
from deeptutor.runtime.registry.tool_registry import get_tool_registry
from deeptutor.services.config import parse_language
from deeptutor.services.llm import get_llm_config, prepare_multimodal_messages
@@ -366,6 +364,7 @@ class ResearchPipeline:
self.base_url = getattr(self.llm_config, "base_url", None)
self.api_version = getattr(self.llm_config, "api_version", None)
self.extra_headers = getattr(self.llm_config, "extra_headers", None) or {}
+ self.reasoning_effort = getattr(self.llm_config, "reasoning_effort", None)
self.client_config = LLMClientConfig(
binding=self.binding,
model=self.model,
@@ -373,6 +372,7 @@ class ResearchPipeline:
base_url=self.base_url,
api_version=self.api_version,
extra_headers=self.extra_headers or None,
+ reasoning_effort=self.reasoning_effort,
)
self.registry = get_tool_registry()
@@ -1873,6 +1873,8 @@ class ResearchPipeline:
temperature=self._temperature,
model=self.model,
max_tokens=max_tokens,
+ binding=self.binding,
+ reasoning_effort=self.reasoning_effort,
)
async def _run_labeled_step(
diff --git a/deeptutor/agents/solve/pipeline.py b/deeptutor/agents/solve/pipeline.py
index c85637a7f..1a7426e30 100644
--- a/deeptutor/agents/solve/pipeline.py
+++ b/deeptutor/agents/solve/pipeline.py
@@ -24,16 +24,17 @@ primitives.
from __future__ import annotations
import asyncio
-import logging
from collections.abc import Awaitable
from dataclasses import dataclass, field
+import logging
from typing import Any
+from deeptutor.capabilities._shared import emit_capability_result
from deeptutor.core.agentic import (
DispatchOutcome,
- LLMClientConfig,
LabeledStepResult,
LabelProtocol,
+ LLMClientConfig,
LoopOutcome,
UsageTracker,
build_completion_kwargs,
@@ -43,7 +44,6 @@ from deeptutor.core.agentic import (
run_agentic_loop,
run_labeled_step,
)
-from deeptutor.capabilities._shared import emit_capability_result
from deeptutor.core.agentic.labels import find_inline_labels
from deeptutor.core.agentic.tool_dispatch import (
MAX_PARALLEL_TOOL_CALLS,
@@ -243,6 +243,7 @@ class SolvePipeline:
self.base_url = getattr(self.llm_config, "base_url", None)
self.api_version = getattr(self.llm_config, "api_version", None)
self.extra_headers = getattr(self.llm_config, "extra_headers", None) or {}
+ self.reasoning_effort = getattr(self.llm_config, "reasoning_effort", None)
self.client_config = LLMClientConfig(
binding=self.binding,
model=self.model,
@@ -250,6 +251,7 @@ class SolvePipeline:
base_url=self.base_url,
api_version=self.api_version,
extra_headers=self.extra_headers or None,
+ reasoning_effort=self.reasoning_effort,
)
self.registry = get_tool_registry()
@@ -1349,6 +1351,8 @@ class SolvePipeline:
temperature=self._temperature,
model=self.model,
max_tokens=max_tokens,
+ binding=self.binding,
+ reasoning_effort=self.reasoning_effort,
)
async def _run_labeled_step(
diff --git a/deeptutor/core/agentic/client.py b/deeptutor/core/agentic/client.py
index eefb43b8f..5cefd6820 100644
--- a/deeptutor/core/agentic/client.py
+++ b/deeptutor/core/agentic/client.py
@@ -15,12 +15,19 @@ from openai import AsyncAzureOpenAI, AsyncOpenAI
from deeptutor.services.config import load_system_settings
from deeptutor.services.llm import get_token_limit_kwargs, supports_tools
+from deeptutor.services.provider_registry import find_by_name
# Providers that don't reliably support OpenAI function-calling. The loop
# still runs without tool schemas — the model just produces prose.
_NATIVE_TOOL_BLOCKED_BINDINGS: frozenset[str] = frozenset(
{"anthropic", "claude", "ollama", "lm_studio", "vllm", "llama_cpp"}
)
+_THINKING_STYLE_MAP = {
+ "thinking_type": lambda enabled: {"thinking": {"type": "enabled" if enabled else "disabled"}},
+ "enable_thinking": lambda enabled: {"enable_thinking": enabled},
+ "reasoning_split": lambda enabled: {"reasoning_split": enabled},
+}
+_THINKING_DISABLED_BY_DEFAULT: tuple[tuple[str, str], ...] = (("deepseek", "deepseek-v4-flash"),)
@dataclass(frozen=True)
@@ -33,6 +40,7 @@ class LLMClientConfig:
base_url: str | None
api_version: str | None = None
extra_headers: dict[str, str] | None = None
+ reasoning_effort: str | None = None
def build_openai_client(config: LLMClientConfig) -> Any:
@@ -64,11 +72,78 @@ def build_completion_kwargs(
temperature: float,
model: str | None,
max_tokens: int,
+ binding: str | None = None,
+ reasoning_effort: str | None = None,
) -> dict[str, Any]:
"""Compose temperature + per-model token-limit kwargs into one dict."""
kwargs: dict[str, Any] = {"temperature": temperature}
if model:
kwargs.update(get_token_limit_kwargs(model, max_tokens))
+ kwargs.update(
+ build_provider_extra_kwargs(
+ binding=binding,
+ model=model,
+ reasoning_effort=reasoning_effort,
+ )
+ )
+ return kwargs
+
+
+def _disable_thinking_by_default(binding: str | None, model: str | None) -> bool:
+ normalized_model = (model or "").strip().lower()
+ normalized_binding = (binding or "").strip().lower()
+ return any(
+ normalized_binding == provider and pattern in normalized_model
+ for provider, pattern in _THINKING_DISABLED_BY_DEFAULT
+ )
+
+
+def build_provider_extra_kwargs(
+ *,
+ binding: str | None,
+ model: str | None,
+ reasoning_effort: str | None,
+) -> dict[str, Any]:
+ """Return provider-specific kwargs for raw OpenAI-compatible agent calls.
+
+ Agentic pipelines stream directly through ``AsyncOpenAI`` so tests can
+ inject scripted clients. This helper mirrors the small provider-normalized
+ subset that is required before those raw calls: reasoning effort and
+ provider-specific thinking flags.
+ """
+ spec = find_by_name(binding)
+ model_name = model or ""
+ resolved_effort = reasoning_effort
+ if resolved_effort is None and spec and spec.reasoning_model_patterns:
+ model_lower = model_name.lower()
+ if any(pattern.lower() in model_lower for pattern in spec.reasoning_model_patterns):
+ resolved_effort = "high"
+
+ semantic_effort: str | None = None
+ if isinstance(resolved_effort, str):
+ semantic_effort = resolved_effort.lower()
+ if semantic_effort == "minimum":
+ semantic_effort = "minimal"
+
+ wire_effort = resolved_effort
+ if spec and spec.name == "dashscope" and semantic_effort == "minimal":
+ wire_effort = "minimum"
+
+ kwargs: dict[str, Any] = {}
+ if wire_effort and not (spec and spec.thinking_style and semantic_effort == "minimal"):
+ kwargs["reasoning_effort"] = wire_effort
+
+ if spec and spec.thinking_style and resolved_effort is not None:
+ thinking_enabled = semantic_effort != "minimal"
+ extra = _THINKING_STYLE_MAP.get(spec.thinking_style, lambda _enabled: None)(
+ thinking_enabled
+ )
+ if extra:
+ kwargs.setdefault("extra_body", {}).update(extra)
+ elif spec and spec.thinking_style and _disable_thinking_by_default(spec.name, model_name):
+ extra = _THINKING_STYLE_MAP.get(spec.thinking_style, lambda _enabled: None)(False)
+ if extra:
+ kwargs.setdefault("extra_body", {}).update(extra)
return kwargs
diff --git a/deeptutor/core/agentic/labeled_step.py b/deeptutor/core/agentic/labeled_step.py
index 4adb76459..8fbf3419c 100644
--- a/deeptutor/core/agentic/labeled_step.py
+++ b/deeptutor/core/agentic/labeled_step.py
@@ -32,9 +32,9 @@ Returns the resolved label, the accumulated post-label text (with provider
from __future__ import annotations
import asyncio
-import re
from contextlib import suppress
from dataclasses import dataclass, field
+import re
from typing import Any
from deeptutor.core.agentic.labels import (
@@ -143,6 +143,32 @@ def _is_stream_options_unsupported(exc: Exception) -> bool:
)
+def _is_tool_schema_unsupported(exc: Exception) -> bool:
+ """Detect providers that reject native tool/function-calling schemas."""
+ response = getattr(exc, "response", None)
+ body = (
+ getattr(exc, "body", None)
+ or getattr(exc, "doc", None)
+ or getattr(response, "text", None)
+ or getattr(exc, "message", None)
+ or str(exc)
+ )
+ text = str(body).lower()
+ return any(
+ marker in text
+ for marker in (
+ "tool",
+ "function_declaration",
+ "function declaration",
+ "function_declarations",
+ "tool_choice",
+ "parameters.properties",
+ "404_not_found",
+ "404 not_found",
+ )
+ )
+
+
async def run_labeled_step(
*,
client: Any,
@@ -444,6 +470,20 @@ async def run_labeled_step(
retry_kwargs = dict(kwargs)
retry_kwargs.pop("stream_options", None)
return await client.chat.completions.create(**retry_kwargs)
+ if tool_schemas and _is_tool_schema_unsupported(exc):
+ await stream.progress(
+ "Provider rejected native tool schemas; retrying without tools.",
+ source=source,
+ stage=stage,
+ metadata=merge_trace_metadata(
+ iter_meta,
+ {"trace_kind": "warning", "tool_schema_fallback": True},
+ ),
+ )
+ retry_kwargs = dict(kwargs)
+ retry_kwargs.pop("tools", None)
+ retry_kwargs.pop("tool_choice", None)
+ return await client.chat.completions.create(**retry_kwargs)
raise
response_stream = await _create_response_stream()
diff --git a/deeptutor/services/config/test_runner.py b/deeptutor/services/config/test_runner.py
index f85f70703..79a171d1c 100644
--- a/deeptutor/services/config/test_runner.py
+++ b/deeptutor/services/config/test_runner.py
@@ -252,6 +252,13 @@ class ConfigTestRunner:
run.emit("response", "Received LLM response.", snippet=snippet[:400])
if not snippet:
raise ValueError("LLM returned an empty response.")
+ run.emit(
+ "info",
+ (
+ "Basic LLM completion succeeded. Chat additionally validates "
+ "streaming and provider tool compatibility at runtime."
+ ),
+ )
run.emit("info", "Detecting model context window.")
detection = await detect_context_window(
diff --git a/deeptutor/services/session/turn_runtime.py b/deeptutor/services/session/turn_runtime.py
index 76c441e66..5ccc59ce8 100644
--- a/deeptutor/services/session/turn_runtime.py
+++ b/deeptutor/services/session/turn_runtime.py
@@ -63,6 +63,7 @@ _TITLE_PREFIXES: tuple[str, ...] = (
"对话标题:",
)
_TITLE_TRAILING_PUNCT = ".。!!??,,;;、 \t"
+_INTERRUPTED_TURN_ERROR = "Turn interrupted by server restart. Please retry your message."
def _sanitize_session_title(raw: str) -> str:
@@ -558,6 +559,40 @@ class TurnRuntimeManager:
# frontend sends the v2 ``ask_user`` shape.
self._reply_queues: dict[str, asyncio.Queue[dict[str, Any] | None]] = {}
+ async def _has_live_execution(self, turn_id: str) -> bool:
+ """Whether this process still owns the turn's in-memory runner."""
+ async with self._lock:
+ execution = self._executions.get(turn_id)
+ if execution is None:
+ return False
+ # Some tests and pause/resubscribe paths create an execution
+ # placeholder without a task. Treat its presence as live so we do
+ # not falsely fail a turn that is still owned by this process.
+ return execution.task is None or not execution.task.done()
+
+ async def _fail_orphan_running_turn(
+ self, turn: dict[str, Any] | None
+ ) -> dict[str, Any] | None:
+ """Finalize a persisted running turn that has no local execution.
+
+ Running turns are process-local: after a server/container restart the
+ database row may still say ``running`` while the task and subscriber
+ queues are gone. The runtime owns that liveness check, not the store,
+ so recovery stays backend-agnostic.
+ """
+ if turn is None or str(turn.get("status") or "") != "running":
+ return turn
+ turn_id = str(turn.get("id") or turn.get("turn_id") or "").strip()
+ if not turn_id or await self._has_live_execution(turn_id):
+ return turn
+ await self.store.update_turn_status(turn_id, "failed", _INTERRUPTED_TURN_ERROR)
+ return await self.store.get_turn(turn_id)
+
+ async def _recover_orphan_running_turns_for_session(self, session_id: str) -> None:
+ """Clear stale active turns before creating a fresh turn."""
+ for turn in await self.store.list_active_turns(session_id):
+ await self._fail_orphan_running_turn(turn)
+
async def start_turn(self, payload: dict[str, Any]) -> tuple[dict[str, Any], dict[str, Any]]:
capability = str(payload.get("capability") or "chat")
raw_config = dict(payload.get("config", {}) or {})
@@ -650,6 +685,7 @@ class TurnRuntimeManager:
except Exception:
payload = {**payload, "tools": []}
payload = {**payload, "llm_selection": llm_selection}
+ await self._recover_orphan_running_turns_for_session(session["id"])
preference_update: dict[str, Any] = {
"capability": capability,
"tools": list(payload.get("tools") or []),
@@ -897,11 +933,16 @@ class TurnRuntimeManager:
turn = await self.store.get_turn(turn_id)
if execution is None:
+ turn = await self._fail_orphan_running_turn(turn)
if turn is None or turn.get("status") != "running":
# Turn already finished and we didn't see a DONE in any of the
# persisted history above — synthesise one so the caller can
# still close out its streaming state cleanly.
if not done_yielded:
+ if turn is not None and str(turn.get("status") or "") == "failed":
+ error_event = self._synthesize_error_event(turn_id, turn)
+ if error_event is not None:
+ yield error_event
yield self._synthesize_done_event(turn_id, turn)
return
try:
@@ -969,6 +1010,25 @@ class TurnRuntimeManager:
"seq": 0,
}
+ @staticmethod
+ def _synthesize_error_event(
+ turn_id: str, turn: dict[str, Any] | None
+ ) -> dict[str, Any] | None:
+ """Build a terminal ERROR event from a failed persisted turn."""
+ error = str((turn or {}).get("error") or "").strip()
+ if not error:
+ return None
+ return {
+ "type": "error",
+ "source": "turn_runtime",
+ "stage": "",
+ "content": error,
+ "metadata": {"status": "failed", "synthesized": True},
+ "session_id": str((turn or {}).get("session_id") or ""),
+ "turn_id": turn_id,
+ "seq": 0,
+ }
+
async def subscribe_session(
self,
session_id: str,
diff --git a/deeptutor_cli/chat.py b/deeptutor_cli/chat.py
index e0f496765..790d912e4 100644
--- a/deeptutor_cli/chat.py
+++ b/deeptutor_cli/chat.py
@@ -4,6 +4,7 @@ from __future__ import annotations
from dataclasses import dataclass, field
import json
+import shlex
from typing import Any
from rich.panel import Panel
@@ -14,6 +15,8 @@ from deeptutor.app import DeepTutorApp, TurnRequest
from .common import (
console,
maybe_run,
+ parse_config_items,
+ parse_json_object,
regenerate_and_render,
render_tool_result_entry,
run_turn_and_render,
@@ -44,11 +47,21 @@ def register(app: typer.Typer) -> None:
notebook_ref: list[str] = typer.Option([], "--notebook-ref", help="Notebook references."),
history_ref: list[str] = typer.Option([], "--history-ref", help="Referenced session ids."),
language: str = typer.Option("en", "--language", "-l", help="Response language."),
+ config: list[str] = typer.Option([], "--config", help="Initial config key=value."),
+ config_json: str | None = typer.Option(
+ None, "--config-json", help="Initial config as JSON."
+ ),
) -> None:
"""Enter interactive chat REPL. Use `deeptutor run` for single-turn execution."""
if ctx.invoked_subcommand is not None:
return
+ try:
+ initial_config = parse_json_object(config_json)
+ initial_config.update(parse_config_items(config))
+ except ValueError as exc:
+ raise typer.BadParameter(str(exc)) from exc
+
state = ChatState(
session_id=session,
capability=capability,
@@ -57,6 +70,7 @@ def register(app: typer.Typer) -> None:
language=language,
notebook_references=_parse_notebook_refs(notebook_ref),
history_references=[item.strip() for item in history_ref if item.strip()],
+ config=initial_config,
)
maybe_run(_chat_repl(state))
@@ -100,7 +114,7 @@ async def _chat_repl(state: ChatState) -> None:
while True:
try:
- user_input = console.input("[bold green]You>[/] ").strip()
+ user_input = _read_repl_input()
except (EOFError, KeyboardInterrupt):
console.print()
break
@@ -144,7 +158,13 @@ async def _chat_repl(state: ChatState) -> None:
def _apply_command(raw: str, state: ChatState) -> bool:
- parts = raw.split()
+ try:
+ parts = shlex.split(raw)
+ except ValueError as exc:
+ console.print(f"[yellow]Could not parse command:[/] {exc}")
+ return True
+ if not parts:
+ return True
command = parts[0].lower()
if command == "/quit":
return False
@@ -156,7 +176,7 @@ def _apply_command(raw: str, state: ChatState) -> bool:
console.print("[dim]Started a new chat context.[/]")
return True
if command == "/refs":
- _print_state(state)
+ _print_refs(state)
return True
if command == "/tool" and len(parts) >= 3:
action, tool_name = parts[1], parts[2]
@@ -206,13 +226,19 @@ def _apply_command(raw: str, state: ChatState) -> bool:
if command == "/config" and len(parts) >= 2:
subcommand = parts[1]
if subcommand == "show":
- console.print_json(json.dumps(state.config, ensure_ascii=False))
+ console.print_json(_format_config(state.config))
elif subcommand == "clear":
state.config = {}
- elif subcommand == "set" and len(parts) >= 3:
- key, _, value = parts[2].partition("=")
- if key and value:
- state.config[key] = _parse_config_value(value)
+ elif subcommand == "set":
+ parsed = _parse_config_assignment(parts)
+ if parsed is None:
+ console.print(
+ "[yellow]Usage:[/] /config set key=value "
+ "or /config set key value"
+ )
+ return True
+ key, value = parsed
+ state.config[key] = _parse_config_value(value)
_print_state(state)
return True
@@ -220,20 +246,80 @@ def _apply_command(raw: str, state: ChatState) -> bool:
return True
+def _read_repl_input() -> str:
+ """Read one REPL message, supporting backslash-continued multi-line input."""
+
+ lines: list[str] = []
+ prompt = "[bold green]You>[/] "
+ while True:
+ line = console.input(prompt)
+ if line.endswith("\\"):
+ lines.append(line[:-1])
+ prompt = "[dim]...[/] "
+ continue
+ lines.append(line)
+ return "\n".join(lines).strip()
+
+
def _print_state(state: ChatState) -> None:
console.print(
"[dim]"
f"session={state.session_id or '(new)'} "
f"capability={state.capability} "
- f"tools={state.tools or '[]'} "
- f"kb={state.knowledge_bases or '[]'} "
- f"history={state.history_references or '[]'} "
- f"notebook_refs={state.notebook_references or '[]'}"
+ f"tools={_format_list(state.tools)} "
+ f"kb={_format_list(state.knowledge_bases)} "
+ f"history={_format_list(state.history_references)} "
+ f"notebook_refs={_format_notebook_refs(state.notebook_references)} "
+ f"language={state.language} "
+ f"config={_format_config(state.config)}"
"[/]",
highlight=False,
)
+def _print_refs(state: ChatState) -> None:
+ console.print("[bold]Current state:[/]")
+ console.print(f" session {state.session_id or '(new)'}")
+ console.print(f" capability {state.capability}")
+ console.print(f" tools {_format_list(state.tools)}")
+ console.print(f" kb {_format_list(state.knowledge_bases)}")
+ console.print(f" history {_format_list(state.history_references)}")
+ console.print(f" notebooks {_format_notebook_refs(state.notebook_references)}")
+ console.print(f" language {state.language}")
+ console.print(f" config {_format_config(state.config)}")
+
+
+def _format_list(items: list[str]) -> str:
+ return "[" + ", ".join(items) + "]" if items else "[]"
+
+
+def _format_notebook_refs(refs: list[dict[str, Any]]) -> str:
+ if not refs:
+ return "[]"
+ rendered = []
+ for ref in refs:
+ notebook_id = str(ref.get("notebook_id") or "")
+ record_ids = [str(item) for item in ref.get("record_ids") or []]
+ rendered.append(f"{notebook_id}:{','.join(record_ids)}" if record_ids else notebook_id)
+ return "[" + ", ".join(rendered) + "]"
+
+
+def _format_config(config: dict[str, Any]) -> str:
+ return json.dumps(config, ensure_ascii=False, sort_keys=True)
+
+
+def _parse_config_assignment(parts: list[str]) -> tuple[str, str] | None:
+ if len(parts) >= 3 and "=" in parts[2]:
+ key, _, value = parts[2].partition("=")
+ key = key.strip()
+ return (key, value) if key else None
+ if len(parts) >= 4:
+ key = parts[2].strip()
+ value = " ".join(parts[3:]).strip()
+ return (key, value) if key and value else None
+ return None
+
+
def _parse_notebook_refs(values: list[str]) -> list[dict[str, Any]]:
refs = []
for value in values:
diff --git a/deeptutor_cli/plugin.py b/deeptutor_cli/plugin.py
index 3074bb799..74a80c1e3 100644
--- a/deeptutor_cli/plugin.py
+++ b/deeptutor_cli/plugin.py
@@ -7,6 +7,8 @@ List and inspect registered plugins (tools, capabilities, playground).
from __future__ import annotations
+from dataclasses import asdict
+
from rich.console import Console
from rich.table import Table
import typer
@@ -56,14 +58,19 @@ def register(app: typer.Typer) -> None:
cap = cr.get(name)
if cap:
+ from deeptutor.app import DeepTutorApp
+
+ availability = DeepTutorApp().get_capability_availability(name)
console.print_json(
json.dumps(
{
"name": cap.manifest.name,
"description": cap.manifest.description,
+ "cli_aliases": cap.manifest.cli_aliases,
"stages": cap.manifest.stages,
"tools_used": cap.manifest.tools_used,
"config_defaults": cap.manifest.config_defaults,
+ "availability": asdict(availability),
},
indent=2,
)
diff --git a/tests/cli/test_chat_cli.py b/tests/cli/test_chat_cli.py
index b8d46bd9f..c35a1e8c5 100644
--- a/tests/cli/test_chat_cli.py
+++ b/tests/cli/test_chat_cli.py
@@ -107,6 +107,56 @@ def test_run_command_with_config(monkeypatch) -> None:
}
+def test_chat_repl_config_commands_match_docs_syntax(monkeypatch) -> None:
+ captured_requests: list[TurnRequest] = []
+ _install_fake_runtime(monkeypatch, captured_requests)
+
+ result = runner.invoke(
+ app,
+ ["chat", "--config", "initial=true"],
+ input=(
+ "/config set num_questions 5\n"
+ "/config set question_types '[\"short_answer\",\"mcq\"]'\n"
+ "/refs\n"
+ "Generate questions\n"
+ "/quit\n"
+ ),
+ )
+
+ assert result.exit_code == 0, result.output
+ assert '"num_questions": 5' in result.output
+ assert '"question_types"' in result.output
+ assert captured_requests[0].config == {
+ "initial": True,
+ "num_questions": 5,
+ "question_types": ["short_answer", "mcq"],
+ }
+
+
+def test_chat_repl_backslash_continuation_sends_single_message(monkeypatch) -> None:
+ captured_requests: list[TurnRequest] = []
+ _install_fake_runtime(monkeypatch, captured_requests)
+
+ result = runner.invoke(
+ app,
+ ["chat"],
+ input="Please review this code:\\\ndef fib(n): return n\n/quit\n",
+ )
+
+ assert result.exit_code == 0, result.output
+ assert captured_requests[0].content == "Please review this code:\ndef fib(n): return n"
+
+
+def test_plugin_info_includes_capability_aliases_and_availability() -> None:
+ result = runner.invoke(app, ["plugin", "info", "deep_solve"])
+
+ assert result.exit_code == 0, result.output
+ payload = json.loads(result.output)
+ assert payload["name"] == "deep_solve"
+ assert payload["cli_aliases"] == ["solve"]
+ assert payload["availability"]["available"] is True
+
+
def test_session_list_command_uses_shared_store(monkeypatch) -> None:
async def _list_sessions(self, limit: int = 50, offset: int = 0): # noqa: ANN001
return [
diff --git a/tests/cli/test_docs_contract.py b/tests/cli/test_docs_contract.py
new file mode 100644
index 000000000..b7c2c197f
--- /dev/null
+++ b/tests/cli/test_docs_contract.py
@@ -0,0 +1,110 @@
+"""Contracts that keep the public docs aligned with the CLI surface."""
+
+from __future__ import annotations
+
+from pathlib import Path
+import re
+import shlex
+
+ROOT = Path(__file__).resolve().parents[2]
+DOCS_ROOT = ROOT / "site" / "src" / "content" / "docs"
+
+
+def _docs_text() -> str:
+ return "\n".join(path.read_text(encoding="utf-8") for path in DOCS_ROOT.rglob("*.md"))
+
+
+def _doc_ids() -> set[str]:
+ ids: set[str] = set()
+ for path in DOCS_ROOT.rglob("*.md"):
+ slug = path.relative_to(DOCS_ROOT).with_suffix("").as_posix()
+ ids.add(f"/{slug}")
+ ids.add(f"/{slug}/")
+ if slug.endswith("/index"):
+ base = slug[: -len("/index")]
+ ids.add(f"/{base}")
+ ids.add(f"/{base}/")
+ return ids
+
+
+def _deeptutor_commands() -> list[str]:
+ commands: list[str] = []
+ pending = ""
+ for path in DOCS_ROOT.rglob("*.md"):
+ for line in path.read_text(encoding="utf-8").splitlines():
+ stripped = line.strip()
+ if not pending and not stripped.startswith("deeptutor "):
+ continue
+ continued = stripped.endswith("\\")
+ line_part = stripped[:-1].strip() if continued else stripped
+ pending = f"{pending} {line_part}".strip()
+ if continued:
+ continue
+ commands.append(pending)
+ pending = ""
+ return commands
+
+
+def test_internal_docs_links_point_to_existing_pages() -> None:
+ ids = _doc_ids()
+ missing: list[tuple[str, str]] = []
+
+ for path in DOCS_ROOT.rglob("*.md"):
+ text = path.read_text(encoding="utf-8")
+ for match in re.finditer(r"\[[^\]]+\]\((/docs/[^)\s#]+)(?:#[^)]+)?\)", text):
+ href = match.group(1)
+ if href not in ids:
+ missing.append((str(path.relative_to(ROOT)), href))
+
+ assert missing == []
+
+
+def test_documented_deeptutor_subcommands_exist() -> None:
+ top_level = {
+ "bot",
+ "book",
+ "chat",
+ "config",
+ "init",
+ "kb",
+ "memory",
+ "notebook",
+ "plugin",
+ "provider",
+ "run",
+ "serve",
+ "session",
+ "start",
+ }
+ provider_subcommands = {"login"}
+
+ for command in _deeptutor_commands():
+ first_segment = command.split("|", 1)[0].split("#", 1)[0].strip()
+ if "<" in first_segment or "[" in first_segment:
+ continue
+ tokens = shlex.split(first_segment)
+ if len(tokens) < 2:
+ continue
+ assert tokens[1] in top_level, command
+ if tokens[1] == "provider" and len(tokens) >= 3:
+ assert tokens[2] in provider_subcommands, command
+
+
+def test_deep_research_examples_include_required_config() -> None:
+ examples = [
+ command for command in _deeptutor_commands() if "deeptutor run deep_research" in command
+ ]
+
+ assert examples, "docs should include at least one deep_research example"
+ for command in examples:
+ has_json_config = "--config-json" in command
+ has_pair_config = "--config mode=" in command and "--config depth=" in command
+ assert has_json_config or has_pair_config, command
+
+
+def test_docs_do_not_advertise_removed_cli_forms() -> None:
+ text = _docs_text()
+
+ assert "deeptutor provider logout" not in text
+ assert "deeptutor memory show summary" not in text
+ assert "WS /api/v1/turns" not in text
diff --git a/tests/core/test_agentic_client_provider_kwargs.py b/tests/core/test_agentic_client_provider_kwargs.py
new file mode 100644
index 000000000..7088b895c
--- /dev/null
+++ b/tests/core/test_agentic_client_provider_kwargs.py
@@ -0,0 +1,51 @@
+from __future__ import annotations
+
+from deeptutor.core.agentic.client import build_completion_kwargs
+
+
+def test_agentic_kwargs_disable_deepseek_flash_thinking_by_default() -> None:
+ kwargs = build_completion_kwargs(
+ temperature=0.7,
+ model="deepseek-v4-flash",
+ max_tokens=1024,
+ binding="deepseek",
+ )
+
+ assert kwargs["max_tokens"] == 1024
+ assert "reasoning_effort" not in kwargs
+ assert kwargs["extra_body"] == {"thinking": {"type": "disabled"}}
+
+
+def test_agentic_kwargs_enable_deepseek_pro_thinking_by_default() -> None:
+ kwargs = build_completion_kwargs(
+ temperature=0.7,
+ model="deepseek-v4-pro",
+ max_tokens=1024,
+ binding="deepseek",
+ )
+
+ assert kwargs["reasoning_effort"] == "high"
+ assert kwargs["extra_body"] == {"thinking": {"type": "enabled"}}
+
+
+def test_agentic_kwargs_use_provider_minimal_thinking_without_top_level_effort() -> None:
+ kwargs = build_completion_kwargs(
+ temperature=0.7,
+ model="deepseek-v4-pro",
+ max_tokens=1024,
+ binding="deepseek",
+ reasoning_effort="minimal",
+ )
+
+ assert "reasoning_effort" not in kwargs
+ assert kwargs["extra_body"] == {"thinking": {"type": "disabled"}}
+
+
+def test_agentic_kwargs_preserve_legacy_shape_without_binding() -> None:
+ kwargs = build_completion_kwargs(
+ temperature=0.2,
+ model="plain-model",
+ max_tokens=256,
+ )
+
+ assert kwargs == {"temperature": 0.2, "max_tokens": 256}
diff --git a/tests/core/test_labeled_step_tool_fallback.py b/tests/core/test_labeled_step_tool_fallback.py
new file mode 100644
index 000000000..ce624b7b3
--- /dev/null
+++ b/tests/core/test_labeled_step_tool_fallback.py
@@ -0,0 +1,112 @@
+from __future__ import annotations
+
+import asyncio
+from types import SimpleNamespace
+from typing import Any
+
+import pytest
+
+from deeptutor.core.agentic.labeled_step import run_labeled_step
+from deeptutor.core.stream import StreamEventType
+from deeptutor.core.stream_bus import StreamBus
+
+
+def _chunk(content: str | None = None) -> SimpleNamespace:
+ return SimpleNamespace(
+ choices=[
+ SimpleNamespace(
+ delta=SimpleNamespace(content=content, tool_calls=None),
+ finish_reason=None,
+ )
+ ],
+ usage=None,
+ )
+
+
+async def _async_stream(chunks: list[SimpleNamespace]):
+ for chunk in chunks:
+ yield chunk
+
+
+class _ToolRejectingClient:
+ def __init__(self, chunks: list[SimpleNamespace]) -> None:
+ self.calls: list[dict[str, Any]] = []
+ self._chunks = chunks
+
+ class _Completions:
+ def __init__(self, parent: _ToolRejectingClient) -> None:
+ self.parent = parent
+
+ async def create(self, **kwargs: Any):
+ self.parent.calls.append(dict(kwargs))
+ if kwargs.get("tools"):
+ raise RuntimeError("Provider error: tools is not supported for this model")
+ return _async_stream(self.parent._chunks)
+
+ class _Chat:
+ def __init__(self, parent: _ToolRejectingClient) -> None:
+ self.completions = _Completions(parent)
+
+ self.chat = _Chat(self)
+
+
+async def _collect_events(bus: StreamBus, fn) -> tuple[list[Any], Any]:
+ events: list[Any] = []
+
+ async def _consume() -> None:
+ async for event in bus.subscribe():
+ events.append(event)
+
+ consumer = asyncio.create_task(_consume())
+ await asyncio.sleep(0)
+ try:
+ result = await fn()
+ finally:
+ await bus.close()
+ await consumer
+ return events, result
+
+
+async def test_labeled_step_retries_without_tools_on_provider_schema_error() -> None:
+ client = _ToolRejectingClient([_chunk("``FINISH``\nOK")])
+ bus = StreamBus()
+
+ async def _run():
+ return await run_labeled_step(
+ client=client,
+ model="deepseek-v4-flash",
+ messages=[{"role": "user", "content": "hi"}],
+ completion_kwargs={},
+ tool_schemas=[
+ {
+ "type": "function",
+ "function": {
+ "name": "ask_user",
+ "description": "ask",
+ "parameters": {"type": "object", "properties": {}},
+ },
+ }
+ ],
+ allowed_labels=("FINISH", "TOOL", "THINK", "PAUSE"),
+ final_labels=frozenset({"FINISH"}),
+ tool_label="TOOL",
+ stream=bus,
+ source="chat",
+ stage="responding",
+ iter_meta={"label": "Reasoning", "trace_id": "iter-1"},
+ )
+
+ events, result = await _collect_events(bus, _run)
+
+ assert result.label == "FINISH"
+ assert result.text == "OK"
+ assert client.calls[0]["tools"]
+ assert "tools" not in client.calls[1]
+ warnings = [
+ event
+ for event in events
+ if event.type == StreamEventType.PROGRESS
+ and (event.metadata or {}).get("trace_kind") == "warning"
+ ]
+ assert warnings
diff --git a/tests/scripts/test_docker_compose.py b/tests/scripts/test_docker_compose.py
index 0c7261209..0a1f55a2e 100644
--- a/tests/scripts/test_docker_compose.py
+++ b/tests/scripts/test_docker_compose.py
@@ -80,3 +80,10 @@ def test_dockerfile_uses_runtime_auth_placeholder() -> None:
assert "__NEXT_PUBLIC_AUTH_ENABLED_PLACEHOLDER__" in content
assert "DEEPTUTOR_IGNORE_PROCESS_ENV_OVERRIDES=1" in content
assert 'unset "$key"' in content
+
+
+def test_frontend_placeholder_validation_is_safe_for_runtime_replacement() -> None:
+ root = Path(__file__).resolve().parents[2]
+ content = (root / "web" / "lib" / "api.ts").read_text(encoding="utf-8")
+ assert 'const API_BASE_PLACEHOLDER = "__NEXT_PUBLIC_API_BASE_PLACEHOLDER__"' not in content
+ assert "NEXT_PUBLIC_API_BASE_PLACEHOLDER" in content
diff --git a/tests/services/config/test_llm_probe_config.py b/tests/services/config/test_llm_probe_config.py
index da48a7d8b..99f987019 100644
--- a/tests/services/config/test_llm_probe_config.py
+++ b/tests/services/config/test_llm_probe_config.py
@@ -133,6 +133,10 @@ class TestLlmProbeUsesAgentsYaml:
captured_kwargs.get("max_tokens") == 768
or captured_kwargs.get("max_completion_tokens") == 768
)
+ assert any(
+ "Basic LLM completion succeeded" in str(event.get("message", ""))
+ for event in run.events
+ )
@pytest.mark.asyncio
async def test_probe_defaults_when_no_diagnostics_section(self, tmp_path, monkeypatch):
diff --git a/tests/services/session/test_turn_runtime_subscribe.py b/tests/services/session/test_turn_runtime_subscribe.py
index 369825d17..6da94844f 100644
--- a/tests/services/session/test_turn_runtime_subscribe.py
+++ b/tests/services/session/test_turn_runtime_subscribe.py
@@ -44,3 +44,60 @@ async def test_subscribe_turn_does_not_synthesize_done_for_running_turn(tmp_path
persisted = await store.get_turn(turn["id"])
assert persisted is not None
assert persisted["status"] == "running"
+
+
+async def test_subscribe_turn_marks_orphan_running_turn_failed(tmp_path) -> None:
+ """A DB-running turn with no in-process execution is stale after restart."""
+
+ store = SQLiteSessionStore(tmp_path / "chat_history.db")
+ runtime = TurnRuntimeManager(store)
+ session = await store.ensure_session(None)
+ turn = await store.create_turn(session["id"], capability="chat")
+
+ events: list[dict] = []
+ async for event in runtime.subscribe_turn(turn["id"], after_seq=0):
+ events.append(event)
+
+ persisted = await store.get_turn(turn["id"])
+ assert persisted is not None
+ assert persisted["status"] == "failed"
+ assert "restart" in persisted["error"].lower()
+ assert [event["type"] for event in events] == ["error", "done"]
+ assert events[-1]["metadata"]["status"] == "failed"
+
+
+async def test_start_turn_clears_orphan_running_turn_before_create(
+ monkeypatch: pytest.MonkeyPatch, tmp_path
+) -> None:
+ """A stale active turn should not block the next user message after restart."""
+
+ store = SQLiteSessionStore(tmp_path / "chat_history.db")
+ runtime = TurnRuntimeManager(store)
+ session = await store.ensure_session(None)
+ stale = await store.create_turn(session["id"], capability="chat")
+
+ async def _noop_run_turn(_execution):
+ return None
+
+ monkeypatch.setattr(runtime, "_run_turn", _noop_run_turn)
+
+ _, new_turn = await runtime.start_turn(
+ {
+ "type": "start_turn",
+ "session_id": session["id"],
+ "capability": "chat",
+ "content": "hello",
+ "tools": [],
+ "knowledge_bases": [],
+ "attachments": [],
+ "language": "en",
+ "config": {},
+ }
+ )
+
+ assert new_turn["id"] != stale["id"]
+ persisted = await store.get_turn(stale["id"])
+ assert persisted is not None
+ assert persisted["status"] == "failed"
diff --git a/web/lib/api.ts b/web/lib/api.ts
index 7e2baecc2..403905f1d 100644
--- a/web/lib/api.ts
+++ b/web/lib/api.ts
@@ -7,7 +7,7 @@
// broken URL and the Settings page would render blank with no clue why.
// Treating the placeholder as "not configured" surfaces the failure mode
// instead of letting fetches die quietly.
-const API_BASE_PLACEHOLDER = "__NEXT_PUBLIC_API_BASE_PLACEHOLDER__";
+const API_BASE_PLACEHOLDER_TOKEN = "NEXT_PUBLIC_API_BASE_PLACEHOLDER";
// Get API base URL injected by the launcher from data/user/settings/system.json.
// We deliberately do NOT throw at module-load time: the Docker build embeds the
@@ -16,11 +16,16 @@ const API_BASE_PLACEHOLDER = "__NEXT_PUBLIC_API_BASE_PLACEHOLDER__";
// still surfaces missing/placeholder values on the first actual call.
export const API_BASE_URL = process.env.NEXT_PUBLIC_API_BASE ?? "";
+export function isApiBasePlaceholder(value: string): boolean {
+ return value.includes(API_BASE_PLACEHOLDER_TOKEN);
+}
+
function assertApiBaseConfigured(value: string): string {
- if (!value || value === API_BASE_PLACEHOLDER) {
+ const isPlaceholder = isApiBasePlaceholder(value);
+ if (!value || isPlaceholder) {
if (typeof window !== "undefined") {
console.error(
- value === API_BASE_PLACEHOLDER
+ isPlaceholder
? "NEXT_PUBLIC_API_BASE placeholder was not substituted at startup."
: "NEXT_PUBLIC_API_BASE is not set.",
);
diff --git a/web/tests/api-resolve-base.test.ts b/web/tests/api-resolve-base.test.ts
index d427456df..c147b871c 100644
--- a/web/tests/api-resolve-base.test.ts
+++ b/web/tests/api-resolve-base.test.ts
@@ -28,6 +28,19 @@ test("resolveBase returns the build-time base in SSR (no window)", async () => {
assert.equal(resolveBase(), "http://localhost:8001/api");
});
+test("isApiBasePlaceholder detects the unsubstituted Docker placeholder", async () => {
+ const { isApiBasePlaceholder } = await loadApiModule();
+ assert.equal(
+ isApiBasePlaceholder("__NEXT_PUBLIC_API_BASE_PLACEHOLDER__"),
+ true,
+ );
+});
+
+test("isApiBasePlaceholder accepts a substituted API URL", async () => {
+ const { isApiBasePlaceholder } = await loadApiModule();
+ assert.equal(isApiBasePlaceholder("http://localhost:3781"), false);
+});
+
test("resolveBase returns base unchanged when client is also on localhost", async () => {
const { resolveBase } = await loadApiModule();
setWindow("localhost");