From 2524de09acb3273de0ec42da18a2ea9259eb6eeb Mon Sep 17 00:00:00 2001 From: Gavin Date: Wed, 25 Nov 2026 10:04:01 +0800 Subject: [PATCH] docs: update documentation links and add CI workflow for building and checking the docs site --- .github/ISSUE_TEMPLATE/docs.yml | 6 +- .github/workflows/docs.yml | 61 + docs/README.md | 219 +-- docs/astro.config.mjs | 305 ++-- docs/scripts/check_docs.py | 238 +++ docs/scripts/generate_reference.py | 162 ++ docs/src/components/HomeLanding.astro | 449 ++++++ .../domestic}/dingtalk.md | 14 +- .../{partners => channels/domestic}/feishu.md | 20 +- .../content/docs/channels/domestic/index.md | 18 + .../{partners => channels/domestic}/mochat.md | 32 +- .../{partners => channels/domestic}/qq.md | 21 +- .../{partners => channels/domestic}/wecom.md | 12 +- .../{partners => channels/domestic}/weixin.md | 16 +- docs/src/content/docs/channels/index.md | 28 + .../international}/discord.md | 19 +- .../international}/email.md | 27 +- .../docs/channels/international/index.md | 21 + .../international}/matrix.md | 18 +- .../international}/mattermost.md | 19 +- .../international}/msteams.md | 26 +- .../international}/slack.md | 22 +- .../international}/telegram.md | 21 +- .../international}/whatsapp.md | 10 +- .../international}/zulip.md | 14 +- docs/src/content/docs/channels/schema.md | 404 +++++ docs/src/content/docs/cli/server-api.md | 368 ----- .../subagents.md => customize/agents.md} | 6 +- .../docs/{ecosystem => customize}/cli-apps.md | 6 +- .../docs/{ecosystem => customize}/eduhub.md | 6 +- docs/src/content/docs/customize/index.md | 23 + .../docs/{ecosystem => customize}/mcp.md | 6 +- docs/src/content/docs/customize/personas.md | 24 + .../rag-integration.md => customize/rag.md} | 8 +- .../docs/{ecosystem => customize}/skills.md | 10 +- .../content/docs/developers/architecture.md | 23 + .../guides}/agent-handoff.md | 6 +- .../index.md => developers/guides/cli.md} | 14 +- .../{ => developers/guides}/contributing.md | 0 .../guides/repl.md} | 6 +- .../guides/sdk.md} | 6 +- .../docs/developers/reference/capabilities.md | 21 + .../reference/cli.md} | 18 +- .../docs/developers/reference/http-api.md | 1404 +++++++++++++++++ .../developers/reference/turn-protocol.md | 35 + docs/src/content/docs/ecosystem/index.md | 35 - .../content/docs/explore/chat-workspace.md | 205 --- docs/src/content/docs/explore/index.md | 50 - docs/src/content/docs/explore/learning.md | 39 - docs/src/content/docs/explore/partners.md | 103 -- .../content/docs/explore/personalization.md | 56 - docs/src/content/docs/get-started/desktop.md | 2 +- docs/src/content/docs/get-started/docker.md | 181 +-- docs/src/content/docs/get-started/index.md | 16 +- docs/src/content/docs/index.mdx | 63 +- .../docs/learning-workspace/agent-loop.md | 44 + .../book.md => learning-workspace/books.md} | 6 +- .../calendar.md | 2 +- .../content/docs/learning-workspace/chat.md | 137 ++ .../favorites.md | 4 +- .../content/docs/learning-workspace/index.md | 50 + .../knowledge.md | 33 +- .../mastery.md} | 6 +- .../{explore => learning-workspace}/memory.md | 28 +- .../notebook.md} | 4 +- .../questions.md} | 9 +- .../reading.md | 8 +- .../docs/learning-workspace/research.md | 24 + .../resources.md} | 18 +- .../task-board.md | 4 +- .../docs/learning-workspace/vision-solver.md | 30 + .../workspaces.md | 2 +- .../content/docs/multimodal-studio/index.md | 17 + .../docs/multimodal-studio/math-animator.md | 23 + .../docs/multimodal-studio/video-lesson.md | 23 + .../docs/multimodal-studio/visualize.md | 23 + docs/src/content/docs/partners/channels.md | 109 -- docs/src/content/docs/partners/index.md | 119 -- .../{get-started => self-hosting}/cli-only.md | 14 +- .../docs/self-hosting/configuration.md | 36 + docs/src/content/docs/self-hosting/desktop.md | 29 + docs/src/content/docs/self-hosting/docker.md | 188 +++ docs/src/content/docs/self-hosting/index.md | 23 + .../multi-user.md | 2 +- docs/src/content/docs/self-hosting/oauth.md | 24 + .../{get-started => self-hosting}/pypi.md | 12 +- .../{explore => self-hosting}/settings.md | 20 +- .../from-source.md => self-hosting/source.md} | 8 +- .../troubleshooting.md | 2 +- docs/src/content/docs/welcome.mdx | 44 + .../domestic}/dingtalk.md | 14 +- .../{partners => channels/domestic}/feishu.md | 20 +- .../docs/zh-cn/channels/domestic/index.md | 18 + .../{partners => channels/domestic}/mochat.md | 32 +- .../{partners => channels/domestic}/qq.md | 21 +- .../{partners => channels/domestic}/wecom.md | 12 +- .../{partners => channels/domestic}/weixin.md | 16 +- docs/src/content/docs/zh-cn/channels/index.md | 28 + .../international}/discord.md | 19 +- .../international}/email.md | 27 +- .../zh-cn/channels/international/index.md | 21 + .../international}/matrix.md | 18 +- .../international}/mattermost.md | 19 +- .../international}/msteams.md | 26 +- .../international}/slack.md | 22 +- .../international}/telegram.md | 21 +- .../international}/whatsapp.md | 10 +- .../international}/zulip.md | 14 +- .../src/content/docs/zh-cn/channels/schema.md | 404 +++++ docs/src/content/docs/zh-cn/cli/server-api.md | 368 ----- .../subagents.md => customize/agents.md} | 6 +- .../{ecosystem => customize}/cli-apps.md | 6 +- .../zh-cn/{ecosystem => customize}/eduhub.md | 6 +- .../src/content/docs/zh-cn/customize/index.md | 23 + .../zh-cn/{ecosystem => customize}/mcp.md | 6 +- .../content/docs/zh-cn/customize/personas.md | 24 + .../rag-integration.md => customize/rag.md} | 8 +- .../zh-cn/{ecosystem => customize}/skills.md | 10 +- .../docs/zh-cn/developers/architecture.md | 23 + .../guides}/agent-handoff.md | 6 +- .../index.md => developers/guides/cli.md} | 14 +- .../{ => developers/guides}/contributing.md | 0 .../guides/repl.md} | 6 +- .../guides/sdk.md} | 6 +- .../developers/reference/capabilities.md | 21 + .../reference/cli.md} | 18 +- .../zh-cn/developers/reference/http-api.md | 1404 +++++++++++++++++ .../developers/reference/turn-protocol.md | 35 + .../src/content/docs/zh-cn/ecosystem/index.md | 35 - .../docs/zh-cn/explore/chat-workspace.md | 205 --- docs/src/content/docs/zh-cn/explore/index.md | 50 - .../content/docs/zh-cn/explore/learning.md | 39 - .../content/docs/zh-cn/explore/partners.md | 103 -- .../docs/zh-cn/explore/personalization.md | 56 - .../content/docs/zh-cn/get-started/desktop.md | 2 +- .../content/docs/zh-cn/get-started/docker.md | 166 +- .../content/docs/zh-cn/get-started/index.md | 16 +- docs/src/content/docs/zh-cn/index.mdx | 63 +- .../zh-cn/learning-workspace/agent-loop.md | 44 + .../book.md => learning-workspace/books.md} | 6 +- .../calendar.md | 2 +- .../docs/zh-cn/learning-workspace/chat.md | 137 ++ .../favorites.md | 4 +- .../docs/zh-cn/learning-workspace/index.md | 50 + .../knowledge.md | 33 +- .../mastery.md} | 6 +- .../{explore => learning-workspace}/memory.md | 28 +- .../notebook.md} | 4 +- .../questions.md} | 9 +- .../reading.md | 8 +- .../docs/zh-cn/learning-workspace/research.md | 24 + .../resources.md} | 18 +- .../task-board.md | 4 +- .../zh-cn/learning-workspace/vision-solver.md | 30 + .../workspaces.md | 2 +- .../docs/zh-cn/multimodal-studio/index.md | 17 + .../zh-cn/multimodal-studio/math-animator.md | 23 + .../zh-cn/multimodal-studio/video-lesson.md | 23 + .../docs/zh-cn/multimodal-studio/visualize.md | 23 + .../content/docs/zh-cn/partners/channels.md | 109 -- docs/src/content/docs/zh-cn/partners/index.md | 123 -- .../{get-started => self-hosting}/cli-only.md | 14 +- .../docs/zh-cn/self-hosting/configuration.md | 36 + .../docs/zh-cn/self-hosting/desktop.md | 29 + .../content/docs/zh-cn/self-hosting/docker.md | 173 ++ .../content/docs/zh-cn/self-hosting/index.md | 23 + .../multi-user.md | 2 +- .../content/docs/zh-cn/self-hosting/oauth.md | 24 + .../{get-started => self-hosting}/pypi.md | 12 +- .../{explore => self-hosting}/settings.md | 20 +- .../from-source.md => self-hosting/source.md} | 8 +- .../troubleshooting.md | 2 +- docs/src/content/docs/zh-cn/welcome.mdx | 44 + docs/src/styles/global.css | 5 +- docs/src/styles/landing.css | 1008 ++++++++++++ docs/src/styles/starlight.css | 17 + 176 files changed, 8072 insertions(+), 3626 deletions(-) create mode 100644 .github/workflows/docs.yml create mode 100644 docs/scripts/check_docs.py create mode 100644 docs/scripts/generate_reference.py create mode 100644 docs/src/components/HomeLanding.astro rename docs/src/content/docs/{partners => channels/domestic}/dingtalk.md (84%) rename docs/src/content/docs/{partners => channels/domestic}/feishu.md (78%) create mode 100644 docs/src/content/docs/channels/domestic/index.md rename docs/src/content/docs/{partners => channels/domestic}/mochat.md (59%) rename docs/src/content/docs/{partners => channels/domestic}/qq.md (71%) rename docs/src/content/docs/{partners => channels/domestic}/wecom.md (84%) rename docs/src/content/docs/{partners => channels/domestic}/weixin.md (72%) create mode 100644 docs/src/content/docs/channels/index.md rename docs/src/content/docs/{partners => channels/international}/discord.md (73%) rename docs/src/content/docs/{partners => channels/international}/email.md (65%) create mode 100644 docs/src/content/docs/channels/international/index.md rename docs/src/content/docs/{partners => channels/international}/matrix.md (72%) rename docs/src/content/docs/{partners => channels/international}/mattermost.md (76%) rename docs/src/content/docs/{partners => channels/international}/msteams.md (67%) rename docs/src/content/docs/{partners => channels/international}/slack.md (70%) rename docs/src/content/docs/{partners => channels/international}/telegram.md (68%) rename docs/src/content/docs/{partners => channels/international}/whatsapp.md (89%) rename docs/src/content/docs/{partners => channels/international}/zulip.md (75%) create mode 100644 docs/src/content/docs/channels/schema.md delete mode 100644 docs/src/content/docs/cli/server-api.md rename docs/src/content/docs/{explore/subagents.md => customize/agents.md} (95%) rename docs/src/content/docs/{ecosystem => customize}/cli-apps.md (94%) rename docs/src/content/docs/{ecosystem => customize}/eduhub.md (92%) create mode 100644 docs/src/content/docs/customize/index.md rename docs/src/content/docs/{ecosystem => customize}/mcp.md (94%) create mode 100644 docs/src/content/docs/customize/personas.md rename docs/src/content/docs/{ecosystem/rag-integration.md => customize/rag.md} (88%) rename docs/src/content/docs/{ecosystem => customize}/skills.md (90%) create mode 100644 docs/src/content/docs/developers/architecture.md rename docs/src/content/docs/{cli => developers/guides}/agent-handoff.md (97%) rename docs/src/content/docs/{cli/index.md => developers/guides/cli.md} (92%) rename docs/src/content/docs/{ => developers/guides}/contributing.md (100%) rename docs/src/content/docs/{cli/chat-repl.md => developers/guides/repl.md} (97%) rename docs/src/content/docs/{cli/python-sdk.md => developers/guides/sdk.md} (91%) create mode 100644 docs/src/content/docs/developers/reference/capabilities.md rename docs/src/content/docs/{cli/commands.md => developers/reference/cli.md} (96%) create mode 100644 docs/src/content/docs/developers/reference/http-api.md create mode 100644 docs/src/content/docs/developers/reference/turn-protocol.md delete mode 100644 docs/src/content/docs/ecosystem/index.md delete mode 100644 docs/src/content/docs/explore/chat-workspace.md delete mode 100644 docs/src/content/docs/explore/index.md delete mode 100644 docs/src/content/docs/explore/learning.md delete mode 100644 docs/src/content/docs/explore/partners.md delete mode 100644 docs/src/content/docs/explore/personalization.md create mode 100644 docs/src/content/docs/learning-workspace/agent-loop.md rename docs/src/content/docs/{explore/book.md => learning-workspace/books.md} (95%) rename docs/src/content/docs/{explore => learning-workspace}/calendar.md (93%) create mode 100644 docs/src/content/docs/learning-workspace/chat.md rename docs/src/content/docs/{explore => learning-workspace}/favorites.md (92%) create mode 100644 docs/src/content/docs/learning-workspace/index.md rename docs/src/content/docs/{explore => learning-workspace}/knowledge.md (82%) rename docs/src/content/docs/{explore/mastery-path.md => learning-workspace/mastery.md} (93%) rename docs/src/content/docs/{explore => learning-workspace}/memory.md (78%) rename docs/src/content/docs/{explore/co-writer.md => learning-workspace/notebook.md} (89%) rename docs/src/content/docs/{explore/practice.md => learning-workspace/questions.md} (82%) rename docs/src/content/docs/{explore => learning-workspace}/reading.md (96%) create mode 100644 docs/src/content/docs/learning-workspace/research.md rename docs/src/content/docs/{explore/space.md => learning-workspace/resources.md} (70%) rename docs/src/content/docs/{explore => learning-workspace}/task-board.md (74%) create mode 100644 docs/src/content/docs/learning-workspace/vision-solver.md rename docs/src/content/docs/{explore => learning-workspace}/workspaces.md (88%) create mode 100644 docs/src/content/docs/multimodal-studio/index.md create mode 100644 docs/src/content/docs/multimodal-studio/math-animator.md create mode 100644 docs/src/content/docs/multimodal-studio/video-lesson.md create mode 100644 docs/src/content/docs/multimodal-studio/visualize.md delete mode 100644 docs/src/content/docs/partners/channels.md delete mode 100644 docs/src/content/docs/partners/index.md rename docs/src/content/docs/{get-started => self-hosting}/cli-only.md (92%) create mode 100644 docs/src/content/docs/self-hosting/configuration.md create mode 100644 docs/src/content/docs/self-hosting/desktop.md create mode 100644 docs/src/content/docs/self-hosting/docker.md create mode 100644 docs/src/content/docs/self-hosting/index.md rename docs/src/content/docs/{get-started => self-hosting}/multi-user.md (99%) create mode 100644 docs/src/content/docs/self-hosting/oauth.md rename docs/src/content/docs/{get-started => self-hosting}/pypi.md (93%) rename docs/src/content/docs/{explore => self-hosting}/settings.md (90%) rename docs/src/content/docs/{get-started/from-source.md => self-hosting/source.md} (96%) rename docs/src/content/docs/{get-started => self-hosting}/troubleshooting.md (99%) create mode 100644 docs/src/content/docs/welcome.mdx rename docs/src/content/docs/zh-cn/{partners => channels/domestic}/dingtalk.md (82%) rename docs/src/content/docs/zh-cn/{partners => channels/domestic}/feishu.md (77%) create mode 100644 docs/src/content/docs/zh-cn/channels/domestic/index.md rename docs/src/content/docs/zh-cn/{partners => channels/domestic}/mochat.md (58%) rename docs/src/content/docs/zh-cn/{partners => channels/domestic}/qq.md (68%) rename docs/src/content/docs/zh-cn/{partners => channels/domestic}/wecom.md (84%) rename docs/src/content/docs/zh-cn/{partners => channels/domestic}/weixin.md (74%) create mode 100644 docs/src/content/docs/zh-cn/channels/index.md rename docs/src/content/docs/zh-cn/{partners => channels/international}/discord.md (71%) rename docs/src/content/docs/zh-cn/{partners => channels/international}/email.md (64%) create mode 100644 docs/src/content/docs/zh-cn/channels/international/index.md rename docs/src/content/docs/zh-cn/{partners => channels/international}/matrix.md (72%) rename docs/src/content/docs/zh-cn/{partners => channels/international}/mattermost.md (75%) rename docs/src/content/docs/zh-cn/{partners => channels/international}/msteams.md (66%) rename docs/src/content/docs/zh-cn/{partners => channels/international}/slack.md (69%) rename docs/src/content/docs/zh-cn/{partners => channels/international}/telegram.md (67%) rename docs/src/content/docs/zh-cn/{partners => channels/international}/whatsapp.md (88%) rename docs/src/content/docs/zh-cn/{partners => channels/international}/zulip.md (75%) create mode 100644 docs/src/content/docs/zh-cn/channels/schema.md delete mode 100644 docs/src/content/docs/zh-cn/cli/server-api.md rename docs/src/content/docs/zh-cn/{explore/subagents.md => customize/agents.md} (95%) rename docs/src/content/docs/zh-cn/{ecosystem => customize}/cli-apps.md (93%) rename docs/src/content/docs/zh-cn/{ecosystem => customize}/eduhub.md (90%) create mode 100644 docs/src/content/docs/zh-cn/customize/index.md rename docs/src/content/docs/zh-cn/{ecosystem => customize}/mcp.md (94%) create mode 100644 docs/src/content/docs/zh-cn/customize/personas.md rename docs/src/content/docs/zh-cn/{ecosystem/rag-integration.md => customize/rag.md} (86%) rename docs/src/content/docs/zh-cn/{ecosystem => customize}/skills.md (90%) create mode 100644 docs/src/content/docs/zh-cn/developers/architecture.md rename docs/src/content/docs/zh-cn/{cli => developers/guides}/agent-handoff.md (97%) rename docs/src/content/docs/zh-cn/{cli/index.md => developers/guides/cli.md} (91%) rename docs/src/content/docs/zh-cn/{ => developers/guides}/contributing.md (100%) rename docs/src/content/docs/zh-cn/{cli/chat-repl.md => developers/guides/repl.md} (97%) rename docs/src/content/docs/zh-cn/{cli/python-sdk.md => developers/guides/sdk.md} (91%) create mode 100644 docs/src/content/docs/zh-cn/developers/reference/capabilities.md rename docs/src/content/docs/zh-cn/{cli/commands.md => developers/reference/cli.md} (96%) create mode 100644 docs/src/content/docs/zh-cn/developers/reference/http-api.md create mode 100644 docs/src/content/docs/zh-cn/developers/reference/turn-protocol.md delete mode 100644 docs/src/content/docs/zh-cn/ecosystem/index.md delete mode 100644 docs/src/content/docs/zh-cn/explore/chat-workspace.md delete mode 100644 docs/src/content/docs/zh-cn/explore/index.md delete mode 100644 docs/src/content/docs/zh-cn/explore/learning.md delete mode 100644 docs/src/content/docs/zh-cn/explore/partners.md delete mode 100644 docs/src/content/docs/zh-cn/explore/personalization.md create mode 100644 docs/src/content/docs/zh-cn/learning-workspace/agent-loop.md rename docs/src/content/docs/zh-cn/{explore/book.md => learning-workspace/books.md} (95%) rename docs/src/content/docs/zh-cn/{explore => learning-workspace}/calendar.md (91%) create mode 100644 docs/src/content/docs/zh-cn/learning-workspace/chat.md rename docs/src/content/docs/zh-cn/{explore => learning-workspace}/favorites.md (90%) create mode 100644 docs/src/content/docs/zh-cn/learning-workspace/index.md rename docs/src/content/docs/zh-cn/{explore => learning-workspace}/knowledge.md (82%) rename docs/src/content/docs/zh-cn/{explore/mastery-path.md => learning-workspace/mastery.md} (91%) rename docs/src/content/docs/zh-cn/{explore => learning-workspace}/memory.md (77%) rename docs/src/content/docs/zh-cn/{explore/co-writer.md => learning-workspace/notebook.md} (89%) rename docs/src/content/docs/zh-cn/{explore/practice.md => learning-workspace/questions.md} (81%) rename docs/src/content/docs/zh-cn/{explore => learning-workspace}/reading.md (95%) create mode 100644 docs/src/content/docs/zh-cn/learning-workspace/research.md rename docs/src/content/docs/zh-cn/{explore/space.md => learning-workspace/resources.md} (67%) rename docs/src/content/docs/zh-cn/{explore => learning-workspace}/task-board.md (74%) create mode 100644 docs/src/content/docs/zh-cn/learning-workspace/vision-solver.md rename docs/src/content/docs/zh-cn/{explore => learning-workspace}/workspaces.md (87%) create mode 100644 docs/src/content/docs/zh-cn/multimodal-studio/index.md create mode 100644 docs/src/content/docs/zh-cn/multimodal-studio/math-animator.md create mode 100644 docs/src/content/docs/zh-cn/multimodal-studio/video-lesson.md create mode 100644 docs/src/content/docs/zh-cn/multimodal-studio/visualize.md delete mode 100644 docs/src/content/docs/zh-cn/partners/channels.md delete mode 100644 docs/src/content/docs/zh-cn/partners/index.md rename docs/src/content/docs/zh-cn/{get-started => self-hosting}/cli-only.md (91%) create mode 100644 docs/src/content/docs/zh-cn/self-hosting/configuration.md create mode 100644 docs/src/content/docs/zh-cn/self-hosting/desktop.md create mode 100644 docs/src/content/docs/zh-cn/self-hosting/docker.md create mode 100644 docs/src/content/docs/zh-cn/self-hosting/index.md rename docs/src/content/docs/zh-cn/{get-started => self-hosting}/multi-user.md (99%) create mode 100644 docs/src/content/docs/zh-cn/self-hosting/oauth.md rename docs/src/content/docs/zh-cn/{get-started => self-hosting}/pypi.md (91%) rename docs/src/content/docs/zh-cn/{explore => self-hosting}/settings.md (91%) rename docs/src/content/docs/zh-cn/{get-started/from-source.md => self-hosting/source.md} (95%) rename docs/src/content/docs/zh-cn/{get-started => self-hosting}/troubleshooting.md (99%) create mode 100644 docs/src/content/docs/zh-cn/welcome.mdx create mode 100644 docs/src/styles/landing.css diff --git a/.github/ISSUE_TEMPLATE/docs.yml b/.github/ISSUE_TEMPLATE/docs.yml index 4a0c9ab5d..ee7f7e3ea 100644 --- a/.github/ISSUE_TEMPLATE/docs.yml +++ b/.github/ISSUE_TEMPLATE/docs.yml @@ -1,5 +1,5 @@ name: Documentation Issue -description: Report an inaccuracy, broken link, missing topic, or unclear explanation in the docs at deeptutor.info +description: Report an inaccuracy, broken link, missing topic, or unclear explanation in the docs at docs.deeptutor.info title: "[Docs]: " labels: ["docs", "triage"] @@ -10,13 +10,13 @@ body: 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. + - label: This is about the docs at https://docs.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/... + placeholder: https://docs.deeptutor.info/... validations: required: true - type: dropdown diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 000000000..b2e12a22d --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,61 @@ +name: Docs + +on: + push: + branches: + - main + - dev + - preview + paths: + - "docs/**" + - "deeptutor/modules/manifests/**" + - "deeptutor/api/router_index.json" + - "assets/figs/web-dev/**" + - ".github/workflows/docs.yml" + pull_request: + paths: + - "docs/**" + - "deeptutor/modules/manifests/**" + - "deeptutor/api/router_index.json" + - "assets/figs/web-dev/**" + - ".github/workflows/docs.yml" + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + docs: + name: Build and check the docs site + runs-on: ubuntu-latest + defaults: + run: + working-directory: docs + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: "22" + cache: npm + cache-dependency-path: docs/package-lock.json + + - name: Check sources + working-directory: . + run: python3 docs/scripts/check_docs.py + + - name: Install and build + run: npm ci + env: + ASTRO_TELEMETRY_DISABLED: "1" + + - name: Build + run: npm run build + env: + ASTRO_TELEMETRY_DISABLED: "1" + + - name: Check built links + working-directory: . + run: python3 docs/scripts/check_docs.py dist diff --git a/docs/README.md b/docs/README.md index 295fd8db2..af8d323d3 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,127 +1,152 @@ # DeepTutor Documentation -This directory contains the public DeepTutor documentation site (`docs.deeptutor.info`), built with [Astro](https://astro.build/) and [Starlight](https://starlight.astro.build/). +Public documentation for DeepTutor, published at [https://docs.deeptutor.info](https://docs.deeptutor.info). The site is Astro and Starlight. This file is the authoring guide for `docs/`. -## Stack +Three sites stay separate: -- Astro + Starlight -- English source locale at `/` (`src/content/docs/`) -- Simplified Chinese mirror at `/zh-cn/` (`src/content/docs/zh-cn/`) -- Static screenshots and icons in `public/` +| Surface | Role | +| --- | --- | +| `docs/` | This site. End users, self-hosters, and integrators. | +| [deeptutor.info](https://deeptutor.info/) | Marketing site. Its source is not in this repository. The docs homepage reproduces that landing. | +| `docs-for-dev/` | Internal notes. Unpublished, and not linked from the sidebar. A public page may link to a file on GitHub when the reader needs the internal manual. | -## Local Development +The repository root `README.md` is the GitHub project page. It is not the source of truth for this site. -```bash -cd docs -npm install -npm run dev -``` +## Design -Build the static site: +Organize pages by what the reader is trying to do, then by product area. Diátaxis decides the job of a page. The quadrant name never appears in a folder, a slug, or a sidebar label. -```bash -npm run build -``` - -Preview the built output: - -```bash -npm run preview -``` - -## Documentation Layout - -```text -src/content/docs/ # English docs (root locale /) -src/content/docs/zh-cn/ # Simplified Chinese docs (locale /zh-cn/) -astro.config.mjs # Starlight config, sidebar, redirects, i18n -src/content.config.ts # docs schema, including the quadrant field -src/components/ # Custom header / social icon components -src/styles/ # Global & Starlight theme styles -public/screenshots/ # Documentation screenshots -``` - -When adding a docs page, add both locale files in the same relative path. Example: - -```text -src/content/docs/partners/channels.md -src/content/docs/zh-cn/partners/channels.md -``` - -Then add a sidebar item in `astro.config.mjs` with a Chinese translation label. - -The public site stays English and Simplified Chinese. Sidebar groups follow product areas (Get started, Learning workspace, Multimodal studio, Customize, Channels, Self-hosting, Developers). Page slugs stay on their current paths until a later directory move; the sidebar already hangs existing pages under those groups. - -## Diátaxis quadrant - -Every page except the splash homepage (`index.mdx`) sets exactly one `quadrant` in frontmatter: +Every page except the splash homepage sets exactly one `quadrant` in frontmatter: | Value | Job | | --- | --- | -| `tutorial` | One shortest path to a first success. No alternate install or feature branches. | -| `how-to` | Steps for one task. Link out for theory and parameter lists. | +| `tutorial` | The shortest path to a first success. One path, with no alternate install or feature branches in the body. | +| `how-to` | Steps for one task. Link out for theory and for parameter lists. | | `reference` | Parameters, schemas, and catalogs. Prefer a code source over a second prose copy. | | `explanation` | How a design fits together. No procedures. | -Do not put the quadrant name in the sidebar label or the folder name. The homepage is the only page without the field. +The homepage is `template: splash` and omits `quadrant`. Welcome (`welcome.mdx`) is an explanation page and is the front door of the documentation. Its cards follow one concrete task each: a title, one sentence, and a link to the page that finishes that task. -## Current Docs Map +### Install paths -Sidebar groups and the paths they currently open: +Desktop is the only default install tutorial (`get-started/desktop/`). Docker is a second, independent tutorial (`get-started/docker/`) and stops at the first successful run. Host folders, reverse proxies, local models, and upgrades live on the self-hosting operations page. -- **Get started** — `get-started/` including Desktop quickstart and Changelog. Docker still opens the existing install page. -- **Learning workspace** — `explore/` study pages (Chat, practice, mastery, knowledge, books, reading, notebook, memory). -- **Multimodal studio** — generation still opens Chat until dedicated guides exist. -- **Customize** — `explore/personalization`, `explore/subagents`, and `ecosystem/`. -- **Channels** — `explore/partners`, `partners/`, with domestic and international IM grouped in the sidebar. -- **Self-hosting** — PyPI, source, CLI-only, multi-user, settings, troubleshooting. -- **Developers** — `cli/` and `contributing.md`. +PyPI, source, CLI-only, multi-user, and troubleshooting are self-hosting how-tos. `get-started/` explains the choice among those paths and links to them. It does not repeat their steps. -## Screenshot Policy +### Homepage -Prefer screenshots synced from canonical assets or freshly captured from a running local DeepTutor UI using synthetic demo data (never personal history, credentials, or private paths). Keep docs references under `/screenshots/...` and verify the files exist before building. +`src/components/HomeLanding.astro` renders the marketing landing for both locales: navigation, hero, product shot, eight places, and four install tabs in this order: PyPI, Docker, source, CLI. Both `index.mdx` files import that component and do not set Starlight `hero` frontmatter. -## Checks +The Docs button and the Docs nav item open Welcome (`/welcome/` and `/zh-cn/welcome/`). Eight-place and footer links use the current docs slugs. Community and Collaborate stay on deeptutor.info. `src/styles/landing.css` hides the Starlight header, sidebar, and the splash `

`. Hide that heading, not the content panel that contains the landing. -Before opening a PR, run from `docs/`: +### Product areas + +Sidebar groups are product areas. Add a page under the area that owns the task, with a `zh-CN` label. + +| Group | Slug | What belongs here | +| --- | --- | --- | +| Get started | `welcome/`, `get-started/` | Welcome, install choices, Desktop, Docker, providers, changelog | +| Learning workspace | `learning-workspace/` | Chat, agent loop, Vision Solver, questions, mastery, knowledge, books, reading, research, notebook, resources, calendar, memory | +| Multimodal studio | `multimodal-studio/` | Which generator to use, Visualize, Math Animator, Video Lesson | +| Customize | `customize/` | Personas, skills, MCP, CLI apps, EduHub, agents, RAG | +| Channels | `channels/` | Create a partner, channel schema, domestic IM, international IM | +| Self-hosting | `self-hosting/` | Runtime home, PyPI, source, Docker operations, CLI-only, multi-user, Codex sign-in, desktop editions, settings, configuration files, troubleshooting | +| Developers | `developers/` | Architecture, CLI guides, capabilities, command reference, turn protocol, HTTP API | + +Home, Learning, and Resources follow the active workspace. Partners and Personalization belong to the account. Say that when a page could mix the two. + +Settings in the product are **Settings → Models & services**. Configuration lives in `data/user/settings/*.json`. Process environment variables override only a few startup values. `.env.example` documents Podman host ports, not application settings. + +Desktop data and logs: + +| | macOS | Windows | +| --- | --- | --- | +| Data | `~/Library/Application Support/Open DeepTutor/workspace/data` | `%LOCALAPPDATA%\Open DeepTutor\workspace\data` | +| Logs | `~/Library/Application Support/Open DeepTutor/logs/runtime.log` | `%LOCALAPPDATA%\Open DeepTutor\logs\runtime.log` | + +Public download links use the unversioned files on the latest GitHub Release. Packaging and signing stay in `apps/desktop/README.md`. + +The changelog page keeps the five newest user-visible releases. Older notes point at GitHub Releases and `assets/releases/`. + +### Reference that follows code + +Hand-write a reference page when the prose is the guide. Generate or check it when the page would drift from code: + +- `docs/scripts/generate_reference.py` rewrites the capability table and appends the HTTP route index from `deeptutor/modules/manifests/*.json` and `deeptutor/api/router_index.json`. Run it after those sources change, then commit the generated Markdown. +- `channels/schema.md` stays hand-written in both locales. `check_docs.py` requires every config field declared under `deeptutor/partners/channels` to appear in the matching section. Channel how-tos describe the platform steps and link here for fields. + +Keep one primary job per page. Move content to the successor page before deleting the old one, and add a redirect. + +## Languages + +English is the source locale at `/`. Simplified Chinese is the mirror at `/zh-cn/`, with the same relative path. Other README languages do not get Starlight locales. + +Add both files together: + +```text +src/content/docs/learning-workspace/chat.md +src/content/docs/zh-cn/learning-workspace/chat.md +``` + +Starlight rewrites Markdown links between locales. It does not rewrite `href` values in MDX or Astro components. Chinese `LinkCard`, hero actions, and landing links must start with `/zh-cn/`. + +Quote a frontmatter `description` that contains a colon. + +## Layout + +```text +src/content/docs/ English pages +src/content/docs/zh-cn/ Simplified Chinese pages +src/components/ HomeLanding, header, social icons +src/styles/ global.css, starlight.css, landing.css +public/screenshots/dev/ Product screenshots and their manifest +astro.config.mjs Locales, sidebar, redirects +src/content.config.ts Docs schema, including quadrant +scripts/check_docs.py Locale, quadrant, screenshot, channel, and link checks +scripts/generate_reference.py +``` + +When a slug moves, add both `/old/` and `/zh-cn/old/` to `redirects` in `astro.config.mjs`, pointing at the final slug. Prefer that final slug in new links. Do not rewrite a short fragment such as `/partners/` across the tree; it also appears inside paths like `data/partners/`. + +Legacy `/explore/`, `/ecosystem/`, `/partners/`, `/tutorbot/`, `/cli/`, and `/contributing/` URLs already redirect. Leave the pre-existing `/docs` redirect conflict alone. + +## Screenshots + +Use `public/screenshots/dev/` and refer to files as `/screenshots/dev/.png`. Images that also exist in `assets/figs/web-dev/` must keep that manifest's SHA-256. Capture new shots from a local DeepTutor UI with synthetic demo data. Do not include personal history, credentials, or private paths. + +## Local development + +Use Node.js 22, the version CI installs. + +```bash +cd docs +npm ci +npm run dev +``` + +Build and preview: ```bash npm run build +npm run preview ``` -And check EN / ZH locale parity from the repository root: +Set `ASTRO_TELEMETRY_DISABLED=1` if the Astro telemetry directory cannot be created. + +## Checks + +From the repository root, before opening a PR: ```bash -python3 - <<'PY' -from pathlib import Path -root = Path('docs/src/content/docs') - -def pages(base: Path): - found = set() - for pattern in ('*.md', '*.mdx'): - for path in base.rglob(pattern): - rel = path.relative_to(base).as_posix() - if rel.startswith('zh-cn/'): - continue - found.add(rel) - return found - -en = pages(root) -zh = pages(root / 'zh-cn') -print('only_en', sorted(en - zh)) -print('only_zh', sorted(zh - en)) - -missing_quadrant = [] -for path in list(root.rglob('*.md')) + list(root.rglob('*.mdx')): - rel = path.relative_to(root).as_posix() - if rel in {'index.mdx', 'zh-cn/index.mdx'}: - continue - text = path.read_text(encoding='utf-8') - end = text.find('\n---', 3) - if 'quadrant:' not in text[:end]: - missing_quadrant.append(rel) -print('missing_quadrant', missing_quadrant) -PY +python3 docs/scripts/check_docs.py +cd docs && ASTRO_TELEMETRY_DISABLED=1 npm run build && cd .. +python3 docs/scripts/check_docs.py dist ``` -Both lists should be empty; otherwise language switching can fall back to the wrong locale. +`check_docs.py` checks that English and Chinese paths match, that every page except the splash homepage has `quadrant`, that copied screenshots match `assets/figs/web-dev/manifest.json`, and that channel schema pages name the source fields. `dist` also checks that internal links in the built HTML resolve. GitHub Actions runs the same steps in `.github/workflows/docs.yml`. + +After changing a module manifest or `router_index.json`: + +```bash +python3 docs/scripts/generate_reference.py +``` diff --git a/docs/astro.config.mjs b/docs/astro.config.mjs index 5d940f8ed..bf061c434 100644 --- a/docs/astro.config.mjs +++ b/docs/astro.config.mjs @@ -10,36 +10,144 @@ const zh = "zh-CN"; export default defineConfig({ site: "https://docs.deeptutor.info", redirects: { - "/developer/contributing/": "/contributing/", - "/zh-cn/developer/contributing/": "/zh-cn/contributing/", - "/tutorbot/": "/partners/", - "/tutorbot/discord/": "/partners/discord/", - "/tutorbot/slack/": "/partners/slack/", - "/tutorbot/telegram/": "/partners/telegram/", - "/tutorbot/whatsapp/": "/partners/whatsapp/", - "/tutorbot/wecom/": "/partners/wecom/", - "/tutorbot/feishu/": "/partners/feishu/", - "/tutorbot/dingtalk/": "/partners/dingtalk/", - "/tutorbot/qq/": "/partners/qq/", - "/tutorbot/mattermost/": "/partners/mattermost/", - "/tutorbot/matrix/": "/partners/matrix/", - "/tutorbot/zulip/": "/partners/zulip/", - "/tutorbot/mochat/": "/partners/mochat/", - "/zh-cn/tutorbot/": "/zh-cn/partners/", - "/zh-cn/tutorbot/discord/": "/zh-cn/partners/discord/", - "/zh-cn/tutorbot/slack/": "/zh-cn/partners/slack/", - "/zh-cn/tutorbot/telegram/": "/zh-cn/partners/telegram/", - "/zh-cn/tutorbot/whatsapp/": "/zh-cn/partners/whatsapp/", - "/zh-cn/tutorbot/wecom/": "/zh-cn/partners/wecom/", - "/zh-cn/tutorbot/feishu/": "/zh-cn/partners/feishu/", - "/zh-cn/tutorbot/dingtalk/": "/zh-cn/partners/dingtalk/", - "/zh-cn/tutorbot/qq/": "/zh-cn/partners/qq/", - "/zh-cn/tutorbot/mattermost/": "/zh-cn/partners/mattermost/", - "/zh-cn/tutorbot/matrix/": "/zh-cn/partners/matrix/", - "/zh-cn/tutorbot/zulip/": "/zh-cn/partners/zulip/", - "/zh-cn/tutorbot/mochat/": "/zh-cn/partners/mochat/", - "/explore/extensions/": "/ecosystem/", - "/zh-cn/explore/extensions/": "/zh-cn/ecosystem/", + "/tutorbot/": "/channels/", + "/tutorbot/discord/": "/channels/international/discord/", + "/tutorbot/slack/": "/channels/international/slack/", + "/tutorbot/telegram/": "/channels/international/telegram/", + "/tutorbot/whatsapp/": "/channels/international/whatsapp/", + "/tutorbot/wecom/": "/channels/domestic/wecom/", + "/tutorbot/feishu/": "/channels/domestic/feishu/", + "/tutorbot/dingtalk/": "/channels/domestic/dingtalk/", + "/tutorbot/qq/": "/channels/domestic/qq/", + "/tutorbot/mattermost/": "/channels/international/mattermost/", + "/tutorbot/matrix/": "/channels/international/matrix/", + "/tutorbot/zulip/": "/channels/international/zulip/", + "/tutorbot/mochat/": "/channels/domestic/mochat/", + "/zh-cn/tutorbot/": "/zh-cn/channels/", + "/zh-cn/tutorbot/discord/": "/zh-cn/channels/international/discord/", + "/zh-cn/tutorbot/slack/": "/zh-cn/channels/international/slack/", + "/zh-cn/tutorbot/telegram/": "/zh-cn/channels/international/telegram/", + "/zh-cn/tutorbot/whatsapp/": "/zh-cn/channels/international/whatsapp/", + "/zh-cn/tutorbot/wecom/": "/zh-cn/channels/domestic/wecom/", + "/zh-cn/tutorbot/feishu/": "/zh-cn/channels/domestic/feishu/", + "/zh-cn/tutorbot/dingtalk/": "/zh-cn/channels/domestic/dingtalk/", + "/zh-cn/tutorbot/qq/": "/zh-cn/channels/domestic/qq/", + "/zh-cn/tutorbot/mattermost/": "/zh-cn/channels/international/mattermost/", + "/zh-cn/tutorbot/matrix/": "/zh-cn/channels/international/matrix/", + "/zh-cn/tutorbot/zulip/": "/zh-cn/channels/international/zulip/", + "/zh-cn/tutorbot/mochat/": "/zh-cn/channels/domestic/mochat/", + "/explore/extensions/": "/customize/", + "/zh-cn/explore/extensions/": "/zh-cn/customize/", + "/ecosystem/rag-integration/": "/customize/rag/", + "/zh-cn/ecosystem/rag-integration/": "/zh-cn/customize/rag/", + "/explore/personalization/": "/customize/", + "/zh-cn/explore/personalization/": "/zh-cn/customize/", + "/explore/chat-workspace/": "/learning-workspace/chat/", + "/zh-cn/explore/chat-workspace/": "/zh-cn/learning-workspace/chat/", + "/explore/mastery-path/": "/learning-workspace/mastery/", + "/zh-cn/explore/mastery-path/": "/zh-cn/learning-workspace/mastery/", + "/partners/mattermost/": "/channels/international/mattermost/", + "/zh-cn/partners/mattermost/": "/zh-cn/channels/international/mattermost/", + "/explore/task-board/": "/learning-workspace/task-board/", + "/zh-cn/explore/task-board/": "/zh-cn/learning-workspace/task-board/", + "/explore/workspaces/": "/learning-workspace/workspaces/", + "/zh-cn/explore/workspaces/": "/zh-cn/learning-workspace/workspaces/", + "/ecosystem/cli-apps/": "/customize/cli-apps/", + "/zh-cn/ecosystem/cli-apps/": "/zh-cn/customize/cli-apps/", + "/explore/co-writer/": "/learning-workspace/notebook/", + "/zh-cn/explore/co-writer/": "/zh-cn/learning-workspace/notebook/", + "/explore/subagents/": "/customize/agents/", + "/zh-cn/explore/subagents/": "/zh-cn/customize/agents/", + "/explore/knowledge/": "/learning-workspace/knowledge/", + "/zh-cn/explore/knowledge/": "/zh-cn/learning-workspace/knowledge/", + "/explore/favorites/": "/learning-workspace/favorites/", + "/zh-cn/explore/favorites/": "/zh-cn/learning-workspace/favorites/", + "/partners/channels/": "/channels/schema/", + "/zh-cn/partners/channels/": "/zh-cn/channels/schema/", + "/partners/dingtalk/": "/channels/domestic/dingtalk/", + "/zh-cn/partners/dingtalk/": "/zh-cn/channels/domestic/dingtalk/", + "/partners/telegram/": "/channels/international/telegram/", + "/zh-cn/partners/telegram/": "/zh-cn/channels/international/telegram/", + "/partners/whatsapp/": "/channels/international/whatsapp/", + "/zh-cn/partners/whatsapp/": "/zh-cn/channels/international/whatsapp/", + "/explore/settings/": "/self-hosting/settings/", + "/zh-cn/explore/settings/": "/zh-cn/self-hosting/settings/", + "/explore/calendar/": "/learning-workspace/calendar/", + "/zh-cn/explore/calendar/": "/zh-cn/learning-workspace/calendar/", + "/explore/partners/": "/channels/", + "/zh-cn/explore/partners/": "/zh-cn/channels/", + "/explore/practice/": "/learning-workspace/questions/", + "/zh-cn/explore/practice/": "/zh-cn/learning-workspace/questions/", + "/explore/learning/": "/learning-workspace/", + "/zh-cn/explore/learning/": "/zh-cn/learning-workspace/", + "/ecosystem/skills/": "/customize/skills/", + "/zh-cn/ecosystem/skills/": "/zh-cn/customize/skills/", + "/ecosystem/eduhub/": "/customize/eduhub/", + "/zh-cn/ecosystem/eduhub/": "/zh-cn/customize/eduhub/", + "/partners/discord/": "/channels/international/discord/", + "/zh-cn/partners/discord/": "/zh-cn/channels/international/discord/", + "/partners/msteams/": "/channels/international/msteams/", + "/zh-cn/partners/msteams/": "/zh-cn/channels/international/msteams/", + "/explore/reading/": "/learning-workspace/reading/", + "/zh-cn/explore/reading/": "/zh-cn/learning-workspace/reading/", + "/partners/weixin/": "/channels/domestic/weixin/", + "/zh-cn/partners/weixin/": "/zh-cn/channels/domestic/weixin/", + "/partners/feishu/": "/channels/domestic/feishu/", + "/zh-cn/partners/feishu/": "/zh-cn/channels/domestic/feishu/", + "/partners/mochat/": "/channels/domestic/mochat/", + "/zh-cn/partners/mochat/": "/zh-cn/channels/domestic/mochat/", + "/partners/matrix/": "/channels/international/matrix/", + "/zh-cn/partners/matrix/": "/zh-cn/channels/international/matrix/", + "/explore/memory/": "/learning-workspace/memory/", + "/zh-cn/explore/memory/": "/zh-cn/learning-workspace/memory/", + "/partners/wecom/": "/channels/domestic/wecom/", + "/zh-cn/partners/wecom/": "/zh-cn/channels/domestic/wecom/", + "/partners/slack/": "/channels/international/slack/", + "/zh-cn/partners/slack/": "/zh-cn/channels/international/slack/", + "/partners/zulip/": "/channels/international/zulip/", + "/zh-cn/partners/zulip/": "/zh-cn/channels/international/zulip/", + "/partners/email/": "/channels/international/email/", + "/zh-cn/partners/email/": "/zh-cn/channels/international/email/", + "/explore/space/": "/learning-workspace/resources/", + "/zh-cn/explore/space/": "/zh-cn/learning-workspace/resources/", + "/ecosystem/mcp/": "/customize/mcp/", + "/zh-cn/ecosystem/mcp/": "/zh-cn/customize/mcp/", + "/explore/book/": "/learning-workspace/books/", + "/zh-cn/explore/book/": "/zh-cn/learning-workspace/books/", + "/partners/qq/": "/channels/domestic/qq/", + "/zh-cn/partners/qq/": "/zh-cn/channels/domestic/qq/", + "/explore/": "/learning-workspace/", + "/zh-cn/explore/": "/zh-cn/learning-workspace/", + "/ecosystem/": "/customize/", + "/zh-cn/ecosystem/": "/zh-cn/customize/", + "/partners/": "/channels/", + "/zh-cn/partners/": "/zh-cn/channels/", + "/get-started/pypi/": "/self-hosting/pypi/", + "/zh-cn/get-started/pypi/": "/zh-cn/self-hosting/pypi/", + "/get-started/from-source/": "/self-hosting/source/", + "/zh-cn/get-started/from-source/": "/zh-cn/self-hosting/source/", + "/get-started/cli-only/": "/self-hosting/cli-only/", + "/zh-cn/get-started/cli-only/": "/zh-cn/self-hosting/cli-only/", + "/get-started/multi-user/": "/self-hosting/multi-user/", + "/zh-cn/get-started/multi-user/": "/zh-cn/self-hosting/multi-user/", + "/get-started/troubleshooting/": "/self-hosting/troubleshooting/", + "/zh-cn/get-started/troubleshooting/": "/zh-cn/self-hosting/troubleshooting/", + "/cli/commands/": "/developers/reference/cli/", + "/zh-cn/cli/commands/": "/zh-cn/developers/reference/cli/", + "/cli/chat-repl/": "/developers/guides/repl/", + "/zh-cn/cli/chat-repl/": "/zh-cn/developers/guides/repl/", + "/cli/python-sdk/": "/developers/guides/sdk/", + "/zh-cn/cli/python-sdk/": "/zh-cn/developers/guides/sdk/", + "/cli/agent-handoff/": "/developers/guides/agent-handoff/", + "/zh-cn/cli/agent-handoff/": "/zh-cn/developers/guides/agent-handoff/", + "/cli/server-api/": "/developers/reference/http-api/", + "/zh-cn/cli/server-api/": "/zh-cn/developers/reference/http-api/", + "/cli/": "/developers/guides/cli/", + "/zh-cn/cli/": "/zh-cn/developers/guides/cli/", + "/contributing/": "/developers/guides/contributing/", + "/zh-cn/contributing/": "/zh-cn/developers/guides/contributing/", + "/developer/contributing/": "/developers/guides/contributing/", + "/zh-cn/developer/contributing/": "/zh-cn/developers/guides/contributing/", // 旧的 /docs/* 路径(拆站前)整体回到根 "/docs": "/", "/docs/[...slug]": "/[...slug]", @@ -58,7 +166,11 @@ export default defineConfig({ src: "./src/assets/logo.png", replacesTitle: false, }, - customCss: ["./src/styles/global.css", "./src/styles/starlight.css"], + customCss: [ + "./src/styles/global.css", + "./src/styles/starlight.css", + "./src/styles/landing.css", + ], components: { SiteTitle: "./src/components/SiteTitle.astro", SocialIcons: "./src/components/SocialIcons.astro", @@ -75,12 +187,13 @@ export default defineConfig({ href: "https://discord.gg/eRsjPgMU4t", }, ], - // Product-domain groups. Slugs stay on current paths until the directory move. + // Product-domain groups. Legacy paths redirect to these slugs. sidebar: [ { label: "Get started", translations: { "zh-CN": "从这里开始" }, items: [ + { label: "Welcome", translations: { "zh-CN": "欢迎" }, slug: "welcome" }, { label: "Install choices", translations: { "zh-CN": "安装方式" }, slug: "get-started" }, { label: "Desktop", translations: { "zh-CN": "桌面端" }, slug: "get-started/desktop" }, { label: "Docker", translations: { "zh-CN": "Docker" }, slug: "get-started/docker" }, @@ -92,80 +205,82 @@ export default defineConfig({ label: "Learning workspace", translations: { "zh-CN": "学习工作区" }, items: [ - { label: "A first study session", translations: { "zh-CN": "串起一次完整学习" }, slug: "explore" }, - { label: "Workspaces", translations: { "zh-CN": "工作区" }, slug: "explore/workspaces" }, - { label: "Chat", translations: { "zh-CN": "对话" }, slug: "explore/chat-workspace" }, - { label: "Questions & practice", translations: { "zh-CN": "出题与练习" }, slug: "explore/practice" }, - { label: "Mastery Path", translations: { "zh-CN": "精通之路" }, slug: "explore/mastery-path" }, - { label: "Knowledge", translations: { "zh-CN": "知识库" }, slug: "explore/knowledge" }, - { label: "Books", translations: { "zh-CN": "书籍" }, slug: "explore/book" }, - { label: "Immersive Reading", translations: { "zh-CN": "沉浸式阅读" }, slug: "explore/reading" }, - { label: "Notebook", translations: { "zh-CN": "笔记本" }, slug: "explore/co-writer" }, - { label: "Favorites", translations: { "zh-CN": "收藏夹" }, slug: "explore/favorites" }, - { label: "Resources", translations: { "zh-CN": "资料" }, slug: "explore/space" }, - { label: "Task Board", translations: { "zh-CN": "任务看板" }, slug: "explore/task-board" }, - { label: "Calendar", translations: { "zh-CN": "日历" }, slug: "explore/calendar" }, - { label: "Memory", translations: { "zh-CN": "记忆" }, slug: "explore/memory" }, - { label: "Choose a learning method", translations: { "zh-CN": "选择学习方式" }, slug: "explore/learning" }, + { label: "A first study session", translations: { "zh-CN": "串起一次完整学习" }, slug: "learning-workspace" }, + { label: "Workspaces", translations: { "zh-CN": "工作区" }, slug: "learning-workspace/workspaces" }, + { label: "Chat", translations: { "zh-CN": "对话" }, slug: "learning-workspace/chat" }, + { label: "How the agent loop works", translations: { "zh-CN": "智能体循环" }, slug: "learning-workspace/agent-loop" }, + { label: "Vision Solver", translations: { "zh-CN": "视觉解题" }, slug: "learning-workspace/vision-solver" }, + { label: "Questions & practice", translations: { "zh-CN": "出题与练习" }, slug: "learning-workspace/questions" }, + { label: "Mastery Path", translations: { "zh-CN": "精通之路" }, slug: "learning-workspace/mastery" }, + { label: "Knowledge", translations: { "zh-CN": "知识库" }, slug: "learning-workspace/knowledge" }, + { label: "Books", translations: { "zh-CN": "书籍" }, slug: "learning-workspace/books" }, + { label: "Immersive Reading", translations: { "zh-CN": "沉浸式阅读" }, slug: "learning-workspace/reading" }, + { label: "Research", translations: { "zh-CN": "深度研究" }, slug: "learning-workspace/research" }, + { label: "Notebook", translations: { "zh-CN": "笔记本" }, slug: "learning-workspace/notebook" }, + { label: "Favorites", translations: { "zh-CN": "收藏夹" }, slug: "learning-workspace/favorites" }, + { label: "Resources", translations: { "zh-CN": "资料" }, slug: "learning-workspace/resources" }, + { label: "Task Board", translations: { "zh-CN": "任务看板" }, slug: "learning-workspace/task-board" }, + { label: "Calendar", translations: { "zh-CN": "日历" }, slug: "learning-workspace/calendar" }, + { label: "Memory", translations: { "zh-CN": "记忆" }, slug: "learning-workspace/memory" }, ], }, { label: "Multimodal studio", translations: { "zh-CN": "多模态工作室" }, items: [ - { - label: "Generate from Chat", - translations: { "zh-CN": "在对话里生成" }, - slug: "explore/chat-workspace", - }, + { label: "Which generator to use", translations: { "zh-CN": "该用哪种生成" }, slug: "multimodal-studio" }, + { label: "Visualize", translations: { "zh-CN": "可视化" }, slug: "multimodal-studio/visualize" }, + { label: "Math Animator", translations: { "zh-CN": "数学动画" }, slug: "multimodal-studio/math-animator" }, + { label: "Video Lesson", translations: { "zh-CN": "视频课" }, slug: "multimodal-studio/video-lesson" }, ], }, { label: "Customize", translations: { "zh-CN": "定制" }, items: [ - { label: "Personas & account", translations: { "zh-CN": "人格与账号" }, slug: "explore/personalization" }, - { label: "Skills", translations: { "zh-CN": "技能" }, slug: "ecosystem/skills" }, - { label: "MCP services", translations: { "zh-CN": "MCP 服务" }, slug: "ecosystem/mcp" }, - { label: "CLI Apps", translations: { "zh-CN": "CLI 应用" }, slug: "ecosystem/cli-apps" }, - { label: "EduHub", translations: { "zh-CN": "EduHub" }, slug: "ecosystem/eduhub" }, - { label: "My Agents", translations: { "zh-CN": "我的智能体" }, slug: "explore/subagents" }, - { label: "RAG integrations", translations: { "zh-CN": "RAG 集成" }, slug: "ecosystem/rag-integration" }, - { label: "Extension overview", translations: { "zh-CN": "扩展概览" }, slug: "ecosystem" }, + { label: "Overview", translations: { "zh-CN": "概览" }, slug: "customize" }, + { label: "Personas", translations: { "zh-CN": "人格" }, slug: "customize/personas" }, + { label: "Skills", translations: { "zh-CN": "技能" }, slug: "customize/skills" }, + { label: "MCP services", translations: { "zh-CN": "MCP 服务" }, slug: "customize/mcp" }, + { label: "CLI Apps", translations: { "zh-CN": "CLI 应用" }, slug: "customize/cli-apps" }, + { label: "EduHub", translations: { "zh-CN": "EduHub" }, slug: "customize/eduhub" }, + { label: "My Agents", translations: { "zh-CN": "我的智能体" }, slug: "customize/agents" }, + { label: "RAG integrations", translations: { "zh-CN": "RAG 集成" }, slug: "customize/rag" }, ], }, { label: "Channels", translations: { "zh-CN": "渠道" }, items: [ - { label: "Partners", translations: { "zh-CN": "伙伴" }, slug: "explore/partners" }, - { label: "Create & manage", translations: { "zh-CN": "创建与管理" }, slug: "partners" }, - { label: "Channel matrix", translations: { "zh-CN": "渠道矩阵" }, slug: "partners/channels" }, + { label: "Create a partner", translations: { "zh-CN": "创建一个伙伴" }, slug: "channels" }, + { label: "Channel schema", translations: { "zh-CN": "渠道 schema" }, slug: "channels/schema" }, { label: "Domestic IM", translations: { "zh-CN": "国内 IM" }, items: [ - { label: "WeChat", translations: { "zh-CN": "个人微信" }, slug: "partners/weixin" }, - { label: "WeCom", translations: { "zh-CN": "企业微信" }, slug: "partners/wecom" }, - { label: "QQ / NapCat", translations: { "zh-CN": "QQ / NapCat" }, slug: "partners/qq" }, - { label: "Feishu / Lark", translations: { "zh-CN": "飞书 / Lark" }, slug: "partners/feishu" }, - { label: "DingTalk", translations: { "zh-CN": "钉钉" }, slug: "partners/dingtalk" }, - { label: "Mochat", translations: { "zh-CN": "Mochat" }, slug: "partners/mochat" }, + { label: "How to choose", translations: { "zh-CN": "怎么选" }, slug: "channels/domestic" }, + { label: "WeChat", translations: { "zh-CN": "个人微信" }, slug: "channels/domestic/weixin" }, + { label: "WeCom", translations: { "zh-CN": "企业微信" }, slug: "channels/domestic/wecom" }, + { label: "QQ / NapCat", translations: { "zh-CN": "QQ / NapCat" }, slug: "channels/domestic/qq" }, + { label: "Feishu / Lark", translations: { "zh-CN": "飞书 / Lark" }, slug: "channels/domestic/feishu" }, + { label: "DingTalk", translations: { "zh-CN": "钉钉" }, slug: "channels/domestic/dingtalk" }, + { label: "Mochat", translations: { "zh-CN": "Mochat" }, slug: "channels/domestic/mochat" }, ], }, { label: "International IM", translations: { "zh-CN": "海外 IM" }, items: [ - { label: "Telegram", translations: { "zh-CN": "Telegram" }, slug: "partners/telegram" }, - { label: "Discord", translations: { "zh-CN": "Discord" }, slug: "partners/discord" }, - { label: "Slack", translations: { "zh-CN": "Slack" }, slug: "partners/slack" }, - { label: "WhatsApp", translations: { "zh-CN": "WhatsApp" }, slug: "partners/whatsapp" }, - { label: "Matrix", translations: { "zh-CN": "Matrix" }, slug: "partners/matrix" }, - { label: "Zulip", translations: { "zh-CN": "Zulip" }, slug: "partners/zulip" }, - { label: "Mattermost", translations: { "zh-CN": "Mattermost" }, slug: "partners/mattermost" }, - { label: "Microsoft Teams", translations: { "zh-CN": "Microsoft Teams" }, slug: "partners/msteams" }, - { label: "Email", translations: { "zh-CN": "邮件" }, slug: "partners/email" }, + { label: "How to choose", translations: { "zh-CN": "怎么选" }, slug: "channels/international" }, + { label: "Telegram", translations: { "zh-CN": "Telegram" }, slug: "channels/international/telegram" }, + { label: "Discord", translations: { "zh-CN": "Discord" }, slug: "channels/international/discord" }, + { label: "Slack", translations: { "zh-CN": "Slack" }, slug: "channels/international/slack" }, + { label: "WhatsApp", translations: { "zh-CN": "WhatsApp" }, slug: "channels/international/whatsapp" }, + { label: "Matrix", translations: { "zh-CN": "Matrix" }, slug: "channels/international/matrix" }, + { label: "Zulip", translations: { "zh-CN": "Zulip" }, slug: "channels/international/zulip" }, + { label: "Mattermost", translations: { "zh-CN": "Mattermost" }, slug: "channels/international/mattermost" }, + { label: "Microsoft Teams", translations: { "zh-CN": "Microsoft Teams" }, slug: "channels/international/msteams" }, + { label: "Email", translations: { "zh-CN": "邮件" }, slug: "channels/international/email" }, ], }, ], @@ -174,25 +289,33 @@ export default defineConfig({ label: "Self-hosting", translations: { "zh-CN": "自部署" }, items: [ - { label: "PyPI", translations: { "zh-CN": "PyPI 安装" }, slug: "get-started/pypi" }, - { label: "From source", translations: { "zh-CN": "从源码运行" }, slug: "get-started/from-source" }, - { label: "CLI only", translations: { "zh-CN": "纯 CLI" }, slug: "get-started/cli-only" }, - { label: "Multi-user", translations: { "zh-CN": "多用户部署" }, slug: "get-started/multi-user" }, - { label: "Settings", translations: { "zh-CN": "设置" }, slug: "explore/settings" }, - { label: "Troubleshooting", translations: { "zh-CN": "故障排查" }, slug: "get-started/troubleshooting" }, + { label: "Runtime home", translations: { "zh-CN": "运行目录" }, slug: "self-hosting" }, + { label: "PyPI", translations: { "zh-CN": "PyPI 安装" }, slug: "self-hosting/pypi" }, + { label: "From source", translations: { "zh-CN": "从源码运行" }, slug: "self-hosting/source" }, + { label: "Docker operations", translations: { "zh-CN": "Docker 运维" }, slug: "self-hosting/docker" }, + { label: "CLI only", translations: { "zh-CN": "纯 CLI" }, slug: "self-hosting/cli-only" }, + { label: "Multi-user", translations: { "zh-CN": "多用户部署" }, slug: "self-hosting/multi-user" }, + { label: "Codex sign-in", translations: { "zh-CN": "Codex 登录" }, slug: "self-hosting/oauth" }, + { label: "Desktop editions", translations: { "zh-CN": "桌面版本" }, slug: "self-hosting/desktop" }, + { label: "Settings", translations: { "zh-CN": "设置" }, slug: "self-hosting/settings" }, + { label: "Configuration files", translations: { "zh-CN": "配置文件" }, slug: "self-hosting/configuration" }, + { label: "Troubleshooting", translations: { "zh-CN": "故障排查" }, slug: "self-hosting/troubleshooting" }, ], }, { label: "Developers", translations: { "zh-CN": "开发者" }, items: [ - { label: "CLI overview", translations: { "zh-CN": "CLI 概览" }, slug: "cli" }, - { label: "Command reference", translations: { "zh-CN": "命令参考" }, slug: "cli/commands" }, - { label: "Interactive REPL", translations: { "zh-CN": "交互式 REPL" }, slug: "cli/chat-repl" }, - { label: "Agent handoff", translations: { "zh-CN": "Agent 交接" }, slug: "cli/agent-handoff" }, - { label: "Python SDK", translations: { "zh-CN": "Python SDK" }, slug: "cli/python-sdk" }, - { label: "Server API", translations: { "zh-CN": "服务端 API" }, slug: "cli/server-api" }, - { label: "Contributing", translations: { "zh-CN": "参与贡献" }, slug: "contributing" }, + { label: "Architecture", translations: { "zh-CN": "架构" }, slug: "developers/architecture" }, + { label: "CLI overview", translations: { "zh-CN": "CLI 概览" }, slug: "developers/guides/cli" }, + { label: "Interactive REPL", translations: { "zh-CN": "交互式 REPL" }, slug: "developers/guides/repl" }, + { label: "Python SDK", translations: { "zh-CN": "Python SDK" }, slug: "developers/guides/sdk" }, + { label: "Agent handoff", translations: { "zh-CN": "Agent 交接" }, slug: "developers/guides/agent-handoff" }, + { label: "Contributing", translations: { "zh-CN": "参与贡献" }, slug: "developers/guides/contributing" }, + { label: "Capabilities", translations: { "zh-CN": "能力" }, slug: "developers/reference/capabilities" }, + { label: "Command reference", translations: { "zh-CN": "命令参考" }, slug: "developers/reference/cli" }, + { label: "Turn protocol", translations: { "zh-CN": "Turn 协议" }, slug: "developers/reference/turn-protocol" }, + { label: "HTTP API", translations: { "zh-CN": "HTTP API" }, slug: "developers/reference/http-api" }, ], }, ], diff --git a/docs/scripts/check_docs.py b/docs/scripts/check_docs.py new file mode 100644 index 000000000..9092e1795 --- /dev/null +++ b/docs/scripts/check_docs.py @@ -0,0 +1,238 @@ +"""Locale parity, screenshot hashes, channel-schema drift, and built-site link checks.""" + +from __future__ import annotations + +import ast +import hashlib +import json +import re +import sys +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[2] +CONTENT = ROOT / "docs" / "src" / "content" / "docs" +PUBLIC = ROOT / "docs" / "public" / "screenshots" / "dev" +MANIFEST = ROOT / "assets" / "figs" / "web-dev" / "manifest.json" +DIST = ROOT / "docs" / "dist" +CHANNELS = ROOT / "deeptutor" / "partners" / "channels" +CHANNEL_SCHEMA = ROOT / "deeptutor" / "partners" / "config" / "schema.py" +HREF = re.compile(r"""(?:href|src)=["']([^"']+)["']""") +SKIP_CHANNEL_MODULES = {"base", "manager", "registry", "weixin_qr", "lark_http"} +SHARED_SWITCHES = {"enabled", "send_progress", "send_tool_hints", "streaming", "allow_from"} + + +def pages(base: Path) -> set[str]: + found = set() + for pattern in ("*.md", "*.mdx"): + for path in base.rglob(pattern): + rel = path.relative_to(base).as_posix() + if rel.startswith("zh-cn/"): + continue + found.add(rel) + return found + + +def check_parity() -> list[str]: + errors = [] + en = pages(CONTENT) + zh = pages(CONTENT / "zh-cn") + if en - zh: + errors.append("only English: " + ", ".join(sorted(en - zh))) + if zh - en: + errors.append("only Chinese: " + ", ".join(sorted(zh - en))) + for path in list(CONTENT.rglob("*.md")) + list(CONTENT.rglob("*.mdx")): + rel = path.relative_to(CONTENT).as_posix() + if rel in {"index.mdx", "zh-cn/index.mdx"}: + continue + text = path.read_text() + if not text.startswith("---"): + errors.append(f"{rel} is missing frontmatter") + continue + block = text.split("---", 2)[1] + if "quadrant:" not in block and "template: splash" not in block: + errors.append(f"{rel} is missing quadrant") + return errors + + +def check_screenshots() -> list[str]: + errors = [] + manifest = json.loads(MANIFEST.read_text()) + for row in manifest["files"]: + name = row["file"] + copy = PUBLIC / name + if not copy.exists(): + continue + digest = hashlib.sha256(copy.read_bytes()).hexdigest() + if digest != row["sha256"]: + errors.append(f"{name} sha256 {digest} != manifest {row['sha256']}") + referenced = set() + for path in CONTENT.rglob("*"): + if path.suffix not in {".md", ".mdx"}: + continue + referenced.update(re.findall(r"/screenshots/dev/([A-Za-z0-9_.-]+)", path.read_text())) + for name in sorted(referenced): + if not (PUBLIC / name).exists(): + errors.append(f"missing screenshot {name}") + return errors + + +def dest_exists(url: str) -> bool: + path = url.split("#", 1)[0].split("?", 1)[0] + if path in {"", "/"}: + return (DIST / "index.html").exists() + relative = path.lstrip("/") + candidates = [ + DIST / relative, + DIST / relative / "index.html", + DIST / f"{relative}.html", + ] + return any(item.exists() for item in candidates) + + +def _class_fields(node: ast.ClassDef) -> list[str]: + fields = [] + for stmt in node.body: + if isinstance(stmt, ast.AnnAssign) and isinstance(stmt.target, ast.Name): + name = stmt.target.id + if not name.startswith("_"): + fields.append(name) + return fields + + +def _class_index(paths: list[Path]) -> dict[str, tuple[list[str], list[str]]]: + index: dict[str, tuple[list[str], list[str]]] = {} + for path in paths: + tree = ast.parse(path.read_text()) + for node in tree.body: + if not isinstance(node, ast.ClassDef): + continue + bases = [] + for base in node.bases: + if isinstance(base, ast.Name): + bases.append(base.id) + elif isinstance(base, ast.Attribute): + bases.append(base.attr) + index[node.name] = (bases, _class_fields(node)) + return index + + +def _resolved_fields(index: dict[str, tuple[list[str], list[str]]], name: str, seen: set[str] | None = None) -> list[str]: + seen = seen or set() + if name in seen or name not in index: + return [] + seen.add(name) + bases, fields = index[name] + resolved: list[str] = [] + for base in bases: + resolved.extend(_resolved_fields(index, base, seen)) + resolved.extend(fields) + return resolved + + +def _channel_configs() -> dict[str, list[str]]: + index = _class_index([CHANNEL_SCHEMA, *sorted(CHANNELS.glob("*.py"))]) + configs: dict[str, list[str]] = {} + for path in sorted(CHANNELS.glob("*.py")): + if path.stem in SKIP_CHANNEL_MODULES: + continue + tree = ast.parse(path.read_text()) + for node in tree.body: + if not isinstance(node, ast.ClassDef) or not node.name.endswith("Channel"): + continue + key = None + for stmt in node.body: + if ( + isinstance(stmt, ast.Assign) + and any(isinstance(target, ast.Name) and target.id == "name" for target in stmt.targets) + and isinstance(stmt.value, ast.Constant) + and isinstance(stmt.value.value, str) + ): + key = stmt.value.value + if not key: + continue + config_name = node.name.replace("Channel", "Config") + fields = _resolved_fields(index, config_name) + if fields: + configs[key] = list(dict.fromkeys(fields)) + return configs + + +def _mentioned_fields(text: str) -> set[str]: + names = set(re.findall(r"`([a-z][a-z0-9_]*)`", text)) + for label in re.findall(r"\*\*([^*]+)\*\*", text): + slug = re.sub(r"[^a-z0-9_]", "", label.strip().lower().replace(" ", "_").replace("-", "_")) + if slug: + names.add(slug) + return names + + +def _schema_sections(text: str) -> tuple[str, dict[str, str]]: + parts = re.split(r'', text) + sections: dict[str, str] = {} + iterator = iter(parts[1:]) + for key, body in zip(iterator, iterator): + sections[key] = body + shared = "" + match = re.search(r"## (?:Shared delivery switches|共享投递开关)(.*?)(?:\n## |\Z)", parts[0], re.S) + if match: + shared = match.group(1) + return shared, sections + + +def check_channel_schema() -> list[str]: + """The hand-written channel pages must name every config field the source declares.""" + errors = [] + configs = _channel_configs() + if not configs: + return ["channel schema source produced no configs"] + pages = { + "en": CONTENT / "channels" / "schema.md", + "zh": CONTENT / "zh-cn" / "channels" / "schema.md", + } + for locale, path in pages.items(): + text = path.read_text() + shared, sections = _schema_sections(text) + shared_names = _mentioned_fields(shared) + for key, fields in sorted(configs.items()): + if f"`{key}`" not in text: + errors.append(f"{locale} channel matrix is missing `{key}`") + section = sections.get(key, "") + if not section: + errors.append(f"{locale} channel schema is missing the {key} field section") + continue + mentioned = _mentioned_fields(section) | (shared_names & SHARED_SWITCHES) + missing = [field for field in fields if field not in mentioned] + if missing: + errors.append(f"{locale} {key} docs omit {', '.join(missing)}") + return errors + + +def check_links() -> list[str]: + if not DIST.exists(): + return ["docs/dist is missing; run the docs build first"] + errors = [] + for page in DIST.rglob("*.html"): + for match in HREF.findall(page.read_text(errors="ignore")): + if match.startswith(("http://", "https://", "mailto:", "data:", "#", "javascript:")): + continue + if not match.startswith("/"): + continue + if not dest_exists(match): + errors.append(f"{page.relative_to(DIST)} -> {match}") + return errors + + +def main() -> int: + mode = sys.argv[1] if len(sys.argv) > 1 else "source" + errors = check_parity() + check_screenshots() + check_channel_schema() + if mode == "dist": + errors.extend(check_links()) + if errors: + print("\n".join(errors)) + return 1 + print("docs checks passed") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/docs/scripts/generate_reference.py b/docs/scripts/generate_reference.py new file mode 100644 index 000000000..5066c9514 --- /dev/null +++ b/docs/scripts/generate_reference.py @@ -0,0 +1,162 @@ +"""Regenerate public reference pages from module manifests and the router index. + +Run from the repository root: + + python3 docs/scripts/generate_reference.py +""" + +from __future__ import annotations + +import json +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[2] +MANIFESTS = ROOT / "deeptutor" / "modules" / "manifests" +ROUTER_INDEX = ROOT / "deeptutor" / "api" / "router_index.json" +DOCS = ROOT / "docs" / "src" / "content" / "docs" +MARKER = "" + +EXTRA_MOUNTS = { + "deeptutor.api.routers.modules:router": { + "prefix": "/api/modules", + "auth": "authenticated", + "module": "server", + } +} + + +def load_mounts() -> dict[str, dict]: + mounts = dict(EXTRA_MOUNTS) + for path in sorted(MANIFESTS.glob("*.json")): + data = json.loads(path.read_text()) + for route in data.get("routes", []): + options = route.get("options") or {} + mounts[route["reference"]] = { + "prefix": options.get("prefix") or "", + "auth": route.get("auth") or "", + "module": data["id"], + } + return mounts + + +def route_index(locale: str) -> str: + index = json.loads(ROUTER_INDEX.read_text()) + mounts = load_mounts() + groups: list[tuple[str, str, str, list[dict]]] = [] + missing = [] + for reference, patterns in index["routers"].items(): + mount = mounts.get(reference) + if mount is None: + missing.append(reference) + continue + groups.append((mount["module"], mount["prefix"], mount["auth"], reference, patterns)) + groups.sort(key=lambda row: (row[0], row[1], row[3])) + + if locale == "zh": + intro = ( + "## 路由索引\n\n" + "下面的表由 `deeptutor/modules/manifests/*.json` 与 " + "`deeptutor/api/router_index.json` 生成。路径是挂载前缀加上路由模板。" + "字段和请求体以运行中的 `GET /openapi.json` 为准。\n" + ) + columns = "| 方法 | 路径 |\n| --- | --- |" + missing_label = "索引里有、清单未挂载" + else: + intro = ( + "## Route index\n\n" + "Generated from `deeptutor/modules/manifests/*.json` and " + "`deeptutor/api/router_index.json`. Each path is the mount prefix plus the route template. " + "Request and response fields stay in the live `GET /openapi.json`.\n" + ) + columns = "| Method | Path |\n| --- | --- |" + missing_label = "Indexed but not mounted by a manifest" + + lines = [MARKER, "", intro] + current = None + for module, prefix, auth, reference, patterns in groups: + if module != current: + current = module + lines.append(f"### {module}\n") + short = reference.rsplit(".", 1)[-1] + lines.append(f"#### `{short}` — `{prefix or '/'}` · {auth}\n") + lines.append(columns) + for pattern in patterns: + methods = ", ".join(pattern["methods"]) or "WS" + path = f"{prefix}{pattern['path']}" + lines.append(f"| `{methods}` | `{path}` |") + lines.append("") + if missing: + lines.append(f"### {missing_label}\n") + for reference in missing: + lines.append(f"- `{reference}`") + lines.append("") + return "\n".join(lines).rstrip() + "\n" + + +def capabilities(locale: str) -> str: + rows = [] + for path in sorted(MANIFESTS.glob("*.json")): + data = json.loads(path.read_text()) + for name, spec in (data.get("capabilities") or {}).items(): + manifest = spec.get("manifest") or {} + stages = ", ".join(f"`{stage}`" for stage in manifest.get("stages") or []) + aliases = ", ".join(f"`{alias}`" for alias in manifest.get("cli_aliases") or []) or "—" + description = (manifest.get("description") or "").replace("|", "\\|") + rows.append((spec.get("order", 0), data["id"], name, stages, aliases, description)) + rows.sort(key=lambda row: (row[1], row[0], row[2])) + if locale == "zh": + head = """--- +title: 能力 +description: 已注册能力的名称、阶段、所属模块和 CLI 别名。 +quadrant: reference +--- + +名称、阶段和 CLI 别名来自 `deeptutor/modules/manifests/*.json` 里每个能力的 `manifest`。描述保持清单中的英文原文。 + +| 能力 | 模块 | 阶段 | CLI | 说明 | +| --- | --- | --- | --- | --- | +""" + else: + head = """--- +title: Capabilities +description: Registered capability names, stages, owning modules, and CLI aliases. +quadrant: reference +--- + +Names, stages, and CLI aliases come from each capability `manifest` in `deeptutor/modules/manifests/*.json`. + +| Capability | Module | Stages | CLI | Description | +| --- | --- | --- | --- | --- | +""" + body = "\n".join( + f"| `{name}` | `{module}` | {stages or '—'} | {aliases} | {description} |" + for _, module, name, stages, aliases, description in rows + ) + return head + body + "\n" + + +def write_capabilities() -> None: + for locale, folder in (("en", DOCS), ("zh", DOCS / "zh-cn")): + target = folder / "developers" / "reference" / "capabilities.md" + target.parent.mkdir(parents=True, exist_ok=True) + target.write_text(capabilities(locale)) + + +def append_routes() -> None: + for locale, folder in (("en", DOCS), ("zh", DOCS / "zh-cn")): + target = folder / "developers" / "reference" / "http-api.md" + text = target.read_text() + if MARKER in text: + text = text.split(MARKER, 1)[0].rstrip() + "\n\n" + else: + text = text.rstrip() + "\n\n" + target.write_text(text + route_index(locale)) + + +def main() -> None: + write_capabilities() + append_routes() + + +if __name__ == "__main__": + main() diff --git a/docs/src/components/HomeLanding.astro b/docs/src/components/HomeLanding.astro new file mode 100644 index 000000000..71c173483 --- /dev/null +++ b/docs/src/components/HomeLanding.astro @@ -0,0 +1,449 @@ +--- +interface Props { + locale?: "en" | "zh"; +} + +const { locale = "en" } = Astro.props; +const zh = locale === "zh"; +const root = zh ? "/zh-cn" : ""; + +const copy = zh + ? { + docs: "文档", + eduhub: "EduHub", + community: "社区", + collaborate: "合作", + theme: "主题", + auto: "自动", + light: "浅色", + dark: "深色", + language: "语言", + taglineLead: "个性化学习,", + taglineEm: "重新想象。", + subLead: "Agent-native 学习伴侣,与你一起成长。", + subRest: "完全开源。", + docsBtn: "文档", + eduhubBtn: "EduHub 生态", + stars: "Stars", + shotAlt: "当前 dev 主页:主页、学习、资料随工作区切换,伙伴和个性化属于账户。", + eightLead: "八个入口,", + eightEm: "串起", + eightRest: "你的学习。", + eightBody: + "对话、日历、笔记本、学习、资料跟随当前工作区;伙伴与个性化属于账户。切换科目时复用熟悉的助手,同时让各项目的材料保持清晰。", + installLead: "几", + installEm: "分钟", + installRest: "就能跑起来。", + installBody: "四种安装方式 —— 挑一个适合你的。最终都落到同一个配置好的工作区。", + fullGuide: "完整指南", + footerDocs: "文档", + footerCommunity: "社区", + footerProject: "项目", + footerLead: "源自", + footerEm1: "社区", + footerMid: ",连接", + footerEm2: "世界", + footerEnd: "。", + footerLatest: "最新:", + visits: "次访问", + requests: "次请求", + credit: "香港大学数据智能实验室", + license: "基于 Apache 2.0 协议发布", + } + : { + docs: "Docs", + eduhub: "EduHub", + community: "Community", + collaborate: "Collaborate", + theme: "Theme", + auto: "Auto", + light: "Light", + dark: "Dark", + language: "Language", + taglineLead: "Personal tutoring,", + taglineEm: "reimagined.", + subLead: "Agent-native Learning Companion that grows with you.", + subRest: "Fully Open-Sourced.", + docsBtn: "Docs", + eduhubBtn: "EduHub Ecosystem", + stars: "Stars", + shotAlt: + "Current dev Home, with workspace-scoped Home, Learning and Resources and account-level Partners and Personalization.", + eightLead: "Eight places, ", + eightEm: "one", + eightRest: " learning flow.", + eightBody: + "Chat, Calendar, Notebook, Learning, and Resources follow your active workspace. Partners and Personalization belong to your account, ready to support another subject without mixing its materials with this one.", + installLead: "Up and running in ", + installEm: "minutes", + installRest: ".", + installBody: "Four ways to install — pick the one that fits. Every path lands at the same configured workspace.", + fullGuide: "Full guide", + footerDocs: "Docs", + footerCommunity: "Community", + footerProject: "Project", + footerLead: "From the ", + footerEm1: "community", + footerMid: ", to ", + footerEm2: "the world", + footerEnd: ".", + footerLatest: "Latest:", + visits: "Visits", + requests: "Requests", + credit: "Data Intelligence Lab @ The University of Hong Kong", + license: "Released under the Apache 2.0 License", + }; + +const places = zh + ? [ + ["I", "工作区", "按科目或项目分开组织,让各自的对话、学习与资料留在对应工作区。", `${root}/learning-workspace/workspaces/`], + ["II", "对话", "结合上下文提问、选择模式,由同一个智能体循环调用工具、技能与资料。", `${root}/learning-workspace/chat/`], + ["III", "日历", "把账号日程与工作区任务、到期复习、定时指令和学习活动放在一起规划。", `${root}/learning-workspace/calendar/`], + ["IV", "笔记本", "把来源整理成自己的页面,与 Dito 讨论段落,并从收藏夹插入证据。", `${root}/learning-workspace/notebook/`], + ["V", "学习", "通过书籍、精通之路、阅读与练习开展学习,对话始终围绕当前活动。", `${root}/learning-workspace/`], + ["VI", "资料", "复用当前工作区的聊天记录、收藏、题目、学习日志与知识库。", `${root}/learning-workspace/resources/`], + ["VII", "伙伴", "账户级的持久伙伴,拥有明确的工作上下文、可复用指令与 IM 渠道。", `${root}/channels/`], + ["VIII", "个性化", "将角色、技能、外部智能体和已连接工具带到不同工作区使用。", `${root}/customize/`], + ] + : [ + ["I", "Workspaces", "Separate subjects and projects; keep each workspace’s conversations, learning, and resources together.", `${root}/learning-workspace/workspaces/`], + ["II", "Chat", "Ask with context, pick a mode, and let one agent loop use your tools, skills, and sources.", `${root}/learning-workspace/chat/`], + ["III", "Calendar", "Plan account events beside workspace tasks, due reviews, scheduled instructions, and study activity.", `${root}/learning-workspace/calendar/`], + ["IV", "Notebook", "Turn sources into your own pages; discuss a passage with Dito and insert evidence from Favorites.", `${root}/learning-workspace/notebook/`], + ["V", "Learning", "Study through Books, Mastery Paths, Reading, and Practice, with conversations tied to the activity.", `${root}/learning-workspace/`], + ["VI", "Resources", "Reuse chat history, Favorites, questions, learning records, and knowledge bases from this workspace.", `${root}/learning-workspace/resources/`], + ["VII", "Partners", "Account-level companions with explicit working context, reusable instructions, and IM channels.", `${root}/channels/`], + ["VIII", "Personalization", "Bring your personas, skills, agents, and connected tools into different workspaces.", `${root}/customize/`], + ]; + +const installs = zh + ? [ + { + id: "pypi", + mark: "I", + name: "PyPI", + tag: "推荐", + blurb: "1.7.0 发布后的完整 Web 应用 + CLI 安装方式。现在体验 dev 请选源码。", + code: `# 1. 准备运行数据目录\nmkdir -p my-deeptutor && cd my-deeptutor\n\n# 2. 安装、配置、启动\npip install -U "deeptutor[full]"\ndeeptutor init\ndeeptutor start`, + note: "然后打开 127.0.0.1:3782", + href: `${root}/self-hosting/pypi/`, + }, + { + id: "docker", + mark: "II", + name: "Docker", + tag: "单容器", + blurb: "已发布的稳定版镜像。需要当前 dev 时,请使用源码构建 Dockerfile。", + code: `docker run --rm --name deeptutor \\\n -p 127.0.0.1:3782:3782 \\\n -v deeptutor-data:/app/data \\\n ghcr.io/hkuds/deeptutor:latest`, + note: "打开 127.0.0.1:3782 即可,应用会在内部代理 API。数据持久化在命名 volume 里。", + href: `${root}/get-started/docker/`, + }, + { + id: "source", + mark: "III", + name: "源码", + tag: "贡献者", + blurb: "使用当前 dev 源码,安装完整 Python 依赖与前端。", + code: `git clone --branch dev https://github.com/HKUDS/DeepTutor.git\ncd DeepTutor\n\npython3 -m venv .venv && source .venv/bin/activate\npython -m pip install -r requirements/full.txt\npython -m pip install -e . --no-deps\n( cd web && npm ci --legacy-peer-deps )\n\ndeeptutor init && deeptutor start`, + note: "Python 3.11–3.14 · Node.js 22 LTS。start 加 --dev 可启用前端热重载。", + href: `${root}/self-hosting/source/`, + }, + { + id: "cli", + mark: "IV", + name: "CLI", + tag: "无界面", + blurb: "从终端使用当前 dev 源码;若要最小 core 环境,请按指南选择独立 wheel 安装。", + code: `git clone --branch dev https://github.com/HKUDS/DeepTutor.git\ncd DeepTutor\n\npython3 -m venv .venv-cli && source .venv-cli/bin/activate\npython -m pip install -r requirements/full.txt\npython -m pip install -e . --no-deps\n\ndeeptutor init --cli\ndeeptutor chat`, + note: "跳过前端安装。使用知识库时配置 embedding;运行可选能力前检查模块状态。", + href: `${root}/self-hosting/cli-only/`, + }, + ] + : [ + { + id: "pypi", + mark: "I", + name: "PyPI", + tag: "After 1.7.0", + blurb: "Full Web app + CLI after 1.7.0 publication. Use Source to try the current dev now.", + code: `# 1. Choose a runtime-home directory\nmkdir -p my-deeptutor && cd my-deeptutor\n\n# 2. Install, configure, launch\npip install -U "deeptutor[full]"\ndeeptutor init\ndeeptutor start`, + note: "Then open 127.0.0.1:3782", + href: `${root}/self-hosting/pypi/`, + }, + { + id: "docker", + mark: "II", + name: "Docker", + tag: "One container", + blurb: "Published stable image. To run current dev, build the source Dockerfile.", + code: `docker run --rm --name deeptutor \\\n -p 127.0.0.1:3782:3782 \\\n -v deeptutor-data:/app/data \\\n ghcr.io/hkuds/deeptutor:latest`, + note: "Open 127.0.0.1:3782 — the app proxies the API internally. Data persists in the named volume.", + href: `${root}/get-started/docker/`, + }, + { + id: "source", + mark: "III", + name: "Source", + tag: "Contributors", + blurb: "Use the current dev source with the complete Python dependencies and frontend.", + code: `git clone --branch dev https://github.com/HKUDS/DeepTutor.git\ncd DeepTutor\n\npython3 -m venv .venv && source .venv/bin/activate\npython -m pip install -r requirements/full.txt\npython -m pip install -e . --no-deps\n( cd web && npm ci --legacy-peer-deps )\n\ndeeptutor init && deeptutor start`, + note: "Python 3.11–3.14 · Node.js 22 LTS. Add --dev to start for frontend hot reload.", + href: `${root}/self-hosting/source/`, + }, + { + id: "cli", + mark: "IV", + name: "CLI", + tag: "Headless", + blurb: "Use the current source from a terminal. The minimal core wheel is a separate installation choice.", + code: `git clone --branch dev https://github.com/HKUDS/DeepTutor.git\ncd DeepTutor\n\npython3 -m venv .venv-cli && source .venv-cli/bin/activate\npython -m pip install -r requirements/full.txt\npython -m pip install -e . --no-deps\n\ndeeptutor init --cli\ndeeptutor chat`, + note: "No frontend setup. Configure embedding when using knowledge bases; check modules before running optional capabilities.", + href: `${root}/self-hosting/cli-only/`, + }, + ]; + +const communityHref = zh ? "https://deeptutor.info/zh-cn/community/" : "https://deeptutor.info/community/"; +const collaborateHref = zh ? "https://deeptutor.info/zh-cn/collaborate/" : "https://deeptutor.info/collaborate/"; +const arrow = ``; +--- + +
+ + +
+
+ + DeepTutor +

{copy.taglineLead}
{copy.taglineEm}

+

{copy.subLead}
{copy.subRest}

+ +
+ +
+
+ {copy.shotAlt} +
+
+ +
+
+

{copy.eightLead}{copy.eightEm}{copy.eightRest}

+

{copy.eightBody}

+
+
+ {places.map(([mark, title, body, href]) => ( + + {mark} +

{title}

+

{body}

+ +
+ ))} +
+
+ +
+
+

{copy.installLead}{copy.installEm}{copy.installRest}

+

{copy.installBody}

+
+
+
+ {installs.map((item, index) => ( + + ))} +
+
+ {installs.map((item, index) => ( +
+

{item.blurb}

+
{item.code}
+
+ {item.note} + {copy.fullGuide} +
+
+ ))} +
+
+
+
+ + +
+ + diff --git a/docs/src/content/docs/partners/dingtalk.md b/docs/src/content/docs/channels/domestic/dingtalk.md similarity index 84% rename from docs/src/content/docs/partners/dingtalk.md rename to docs/src/content/docs/channels/domestic/dingtalk.md index 0bf550179..b44838014 100644 --- a/docs/src/content/docs/partners/dingtalk.md +++ b/docs/src/content/docs/channels/domestic/dingtalk.md @@ -35,14 +35,8 @@ pip install "deeptutor[partners]" Open **Partners -> your partner -> Channels -> DingTalk**. -| Field | What to enter | -| --- | --- | -| **Send Progress** | Keep on while testing. It delivers narration updates during long turns. | -| **Send Tool Hints** | Keep on for debugging; turn off if users should not see one-line tool calls. | -| **Enabled** | Turn on only when you are ready to start the channel. | -| **Client Id** | The AppKey from Credentials & Basic Info (often starts with `ding...`). | -| **Client Secret** | The AppSecret from the same page. Stored as a secret and masked after save. | -| **Allow From** | One value per line. Use `*` for a first test, or DingTalk staff ids (the partner logs print the sender id with every inbound message). Empty denies everyone. | +Card fields for this channel are in the [channel schema](/channels/schema/#dingtalk). + Replies are sent as markdown messages, so headings, lists, and links render natively in DingTalk. Voice messages are handled too: DingTalk's built-in speech-to-text result is forwarded to the partner as plain text. @@ -80,5 +74,5 @@ Almost always **Allow From**. An empty list denies everyone — including you. P ## See also -- [Channel Matrix](/partners/channels/) — all channels at a glance -- [Feishu](/partners/feishu/) — the other major Chinese workplace chat, same no-webhook model +- [Channel Matrix](/channels/schema/) — all channels at a glance +- [Feishu](/channels/domestic/feishu/) — the other major Chinese workplace chat, same no-webhook model diff --git a/docs/src/content/docs/partners/feishu.md b/docs/src/content/docs/channels/domestic/feishu.md similarity index 78% rename from docs/src/content/docs/partners/feishu.md rename to docs/src/content/docs/channels/domestic/feishu.md index 4184a9dbf..881d7e2a8 100644 --- a/docs/src/content/docs/partners/feishu.md +++ b/docs/src/content/docs/channels/domestic/feishu.md @@ -51,20 +51,8 @@ If you enable event encryption on the platform (under Events & Callbacks), also Open **Partners -> your partner -> Channels -> Feishu**. -| Field | What to enter | -| --- | --- | -| **Streaming** | Off by default. Streams the reply live into a CardKit card with a typewriter effect. Requires **Send Progress**: narration rounds stream as they happen. | -| **Send Progress** | Keep on while testing. It delivers narration updates during long turns. | -| **Send Tool Hints** | Keep on for debugging; turn off if users should not see one-line tool calls. | -| **Enabled** | Turn on only when you are ready to start the channel. | -| **App Id** | The `cli_...` App ID from Credentials & Basic Info. | -| **App Secret** | The App Secret from the same page. Stored as a secret and masked after save. | -| **Domain** | `feishu` (default) for mainland Feishu apps; select `lark` for international Lark tenants so the SDK uses `open.larksuite.com`. The scan flow fills this automatically. | -| **Encrypt Key** | Only needed when event encryption is enabled on the platform. Leave blank otherwise. | -| **Verification Token** | The event Verification Token from the platform; used to verify event signatures. Leave blank if you did not configure one. | -| **Allow From** | One value per line. Use `*` for an open test bot, or `ou_...` open ids (copy them from the partner logs after a first message). Empty denies everyone. | -| **React Emoji** | The reaction the bot adds to every message it accepts, as an instant acknowledgement. Default `THUMBSUP`; other common types: `OK`, `EYES`, `DONE`, `OnIt`, `HEART`. | -| **Group Policy** | `mention` (default): in groups the bot only answers when @mentioned. `open`: it answers every group message. DMs always get a response. | +Card fields for this channel are in the [channel schema](/channels/schema/#feishu). + DeepTutor picks the outbound message format automatically: short plain text goes out as a text message, link-only content as a rich-text post, and anything with headings, code blocks, lists, or tables as an interactive card. Feishu allows one table per card, so multi-table replies are split across several cards. @@ -102,5 +90,5 @@ If you configured an Encrypt Key on the platform, the same value must be in the ## See also -- [Channel Matrix](/partners/channels/) — all channels at a glance -- [DingTalk](/partners/dingtalk/) — the other major Chinese workplace chat, similar no-webhook model +- [Channel Matrix](/channels/schema/) — all channels at a glance +- [DingTalk](/channels/domestic/dingtalk/) — the other major Chinese workplace chat, similar no-webhook model diff --git a/docs/src/content/docs/channels/domestic/index.md b/docs/src/content/docs/channels/domestic/index.md new file mode 100644 index 000000000..564d7bab3 --- /dev/null +++ b/docs/src/content/docs/channels/domestic/index.md @@ -0,0 +1,18 @@ +--- +title: Domestic IM +description: Which built-in China-region chat channels fit which kind of partner. +quadrant: explanation +--- + +These channels deliver the same partner. They differ in who operates the account and how the connection is held. + +| Channel | Connection | Fits | +| --- | --- | --- | +| [WeChat](/channels/domestic/weixin/) | QR login and HTTP long-poll | A personal WeChat assistant. A person has to scan. | +| [WeCom](/channels/domestic/wecom/) | WeCom AI Bot WebSocket | Enterprise WeChat / WeChat Work | +| [QQ / NapCat](/channels/domestic/qq/) | Official bot WebSocket, or a personal account through NapCat | An official QQ bot, or a personal QQ you intentionally bridge | +| [Feishu / Lark](/channels/domestic/feishu/) | Open Platform WebSocket and CardKit cards | Feishu or Lark enterprise chat | +| [DingTalk](/channels/domestic/dingtalk/) | Stream Mode | DingTalk enterprise chat, without a public callback URL | +| [Mochat](/channels/domestic/mochat/) | Socket.IO, with HTTP polling as fallback | A customer-support panel | + +Use one channel until it answers, then add another. Shared switches and per-card fields are in the [channel schema](/channels/schema/). diff --git a/docs/src/content/docs/partners/mochat.md b/docs/src/content/docs/channels/domestic/mochat.md similarity index 59% rename from docs/src/content/docs/partners/mochat.md rename to docs/src/content/docs/channels/domestic/mochat.md index 64d043470..d4a02ed04 100644 --- a/docs/src/content/docs/partners/mochat.md +++ b/docs/src/content/docs/channels/domestic/mochat.md @@ -30,39 +30,15 @@ In your Mochat admin panel, create a bot account and copy its **Claw Token**. Th Open **Partners -> your partner -> Channels -> Mochat**. -| Field | What to enter | -| --- | --- | -| **Send Progress** | Keep on while testing. It sends narration updates during long turns. | -| **Send Tool Hints** | Keep on for debugging; turn off if you do not want users to see one-line tool calls. | -| **Enabled** | Turn on only when you are ready to start the channel. | -| **Base Url** | Your Mochat instance. Default: `https://mochat.io`. | -| **Socket Url** | Optional separate Socket.IO endpoint. Blank means use **Base Url**. | -| **Socket Path** | Socket.IO mount path. Default: `/socket.io`. | -| **Socket Disable Msgpack** | Off by default (msgpack is used when available). Turn on to force JSON if your server has no msgpack parser. | -| **Socket Reconnect Delay Ms** | Initial reconnect delay. Default `1000`. | -| **Socket Max Reconnect Delay Ms** | Reconnect backoff cap. Default `10000`. | -| **Socket Connect Timeout Ms** | Connection timeout. Default `10000`. | -| **Refresh Interval Ms** | How often the channel refreshes its session/panel directory. Default `30000`. | -| **Watch Timeout Ms** | Long-poll timeout in HTTP fallback mode. Default `25000`. | -| **Claw Token** | Required. The bot token from your Mochat admin panel. | -| **Sessions** | Session ids to watch, one per line. `*` auto-discovers and subscribes new sessions. | -| **Panels** | Panel ids to watch, one per line. `*` auto-discovers panels. Leave both lists empty and the channel watches nothing. | -| **Allow From** | One value per line. Use `*` for an open test channel, or specific Mochat user ids. Empty denies access. | +Card fields for this channel are in the [channel schema](/channels/schema/#mochat). + ### Advanced fields These tune retries and group behavior; the defaults are fine for a first deployment. -| Field | Notes | -| --- | --- | -| **Watch Limit** | Max events fetched per poll. Default `100`. | -| **Retry Delay Ms** | Delay between failed HTTP retries. Default `500`. | -| **Max Retry Attempts** | Maximum Socket.IO reconnection attempts. `0` means reconnect forever. This field does not cap HTTP fallback loops. | -| **Agent User Id** | The bot's own Mochat user id. Used to ignore the bot's own messages and to detect @-mentions. | -| **Mention** | `require_in_groups` — require an @-mention before answering in group sessions. | -| **Groups** | Per-group overrides, keyed by group id: `{"": {"require_mention": true}}`. | -| **Reply Delay Mode** | `non-mention` (default) buffers panel messages that do not mention the bot; any other value disables buffering. | -| **Reply Delay Ms** | Buffer window. Default `120000` (2 minutes). | +Card fields for this channel are in the [channel schema](/channels/schema/#mochat). + With the default reply-delay mode, rapid-fire panel messages are batched into one Partner turn: each new message restarts the timer, and a direct @-mention flushes the buffer immediately. diff --git a/docs/src/content/docs/partners/qq.md b/docs/src/content/docs/channels/domestic/qq.md similarity index 71% rename from docs/src/content/docs/partners/qq.md rename to docs/src/content/docs/channels/domestic/qq.md index 93f15bdac..ef5617511 100644 --- a/docs/src/content/docs/partners/qq.md +++ b/docs/src/content/docs/channels/domestic/qq.md @@ -23,13 +23,8 @@ Install the Partners extra, then create a bot in the [QQ Bot Development Platfor Configuration fields: -| Field | Notes | -| --- | --- | -| `enabled` | Start the channel with the partner. | -| `app_id` | App ID from Tencent's bot platform. | -| `secret` | Bot secret. | -| `allow_from` | Allowed QQ user ids / openids. Empty denies access; use explicit ids for production. | -| `msg_format` | `plain` or `markdown`. Start with `plain` if clients render Markdown inconsistently. | +Card fields for this channel are in the [channel schema](/channels/schema/#qq). + Start with: @@ -45,16 +40,8 @@ NapCat exposes a personal QQ account through a OneBot v11 WebSocket endpoint. Ru Configuration fields: -| Field | Notes | -| --- | --- | -| `enabled` | Start the channel with the partner. | -| `ws_url` | NapCat WebSocket endpoint, default `ws://127.0.0.1:3001`. | -| `access_token` | Optional OneBot access token. | -| `allow_from` | Allowed user ids. Use `*` only for local testing. | -| `group_policy` | `mention`, `open`, or a probability between `0` and `1`. Mentions/replies always respond. | -| `group_policy_overrides` | Per-group policy map, keyed by group id. | -| `welcome_new_members` | Whether to welcome new group members. | -| `max_image_bytes` | Hard cap for inbound image downloads. | +Card fields for this channel are in the [channel schema](/channels/schema/#qq). + ## Choosing between them diff --git a/docs/src/content/docs/partners/wecom.md b/docs/src/content/docs/channels/domestic/wecom.md similarity index 84% rename from docs/src/content/docs/partners/wecom.md rename to docs/src/content/docs/channels/domestic/wecom.md index 8893c2808..8deda0d9d 100644 --- a/docs/src/content/docs/partners/wecom.md +++ b/docs/src/content/docs/channels/domestic/wecom.md @@ -6,7 +6,7 @@ quadrant: how-to -Use `wecom` for Enterprise WeChat / WeChat Work. It connects through the WeCom AI Bot WebSocket long connection and is different from personal [WeChat (`weixin`)](/partners/weixin/). +Use `wecom` for Enterprise WeChat / WeChat Work. It connects through the WeCom AI Bot WebSocket long connection and is different from personal [WeChat (`weixin`)](/channels/domestic/weixin/). ![WeCom channel configuration](/screenshots/dev/partners-channel-wecom.png) @@ -45,14 +45,8 @@ Use the manual Bot ID / Secret path below when QR onboarding is not suitable for Open **Partners -> your partner -> Channels -> WeCom** and fill: -| Field | Notes | -| --- | --- | -| `enabled` | Start this channel when the partner starts. | -| `bot_id` | Bot ID from WeCom AI Bot platform. | -| `secret` | Secret from WeCom. Treat it as a credential. | -| `allow_from` | User ids allowed to talk to this partner. Empty denies access; `*` opens it where supported by the base channel policy. | -| `welcome_message` | Optional text sent when a user opens the chat. | -| `send_progress` / `send_tool_hints` | Delivery switches for narration and one-line tool calls. | +Card fields for this channel are in the [channel schema](/channels/schema/#wecom). + ## Access control and visibility diff --git a/docs/src/content/docs/partners/weixin.md b/docs/src/content/docs/channels/domestic/weixin.md similarity index 72% rename from docs/src/content/docs/partners/weixin.md rename to docs/src/content/docs/channels/domestic/weixin.md index 7ded445a1..9cbce1b6a 100644 --- a/docs/src/content/docs/partners/weixin.md +++ b/docs/src/content/docs/channels/domestic/weixin.md @@ -6,7 +6,7 @@ quadrant: how-to -The `weixin` channel connects a Partner to a personal WeChat account through the iLink long-poll API. It is different from **WeCom**: use this page for normal personal WeChat, and [WeCom](/partners/wecom/) for Enterprise WeChat / WeChat Work. +The `weixin` channel connects a Partner to a personal WeChat account through the iLink long-poll API. It is different from **WeCom**: use this page for normal personal WeChat, and [WeCom](/channels/domestic/wecom/) for Enterprise WeChat / WeChat Work. ![WeChat channel configuration](/screenshots/dev/partners-channel-weixin.png) @@ -26,18 +26,8 @@ pip install "deeptutor[partners]" Open **Partners -> your partner -> Channels -> WeChat**. -| Field | What to enter | -| --- | --- | -| **Send Progress** | Keep on while testing. It sends narration updates during long turns. | -| **Send Tool Hints** | Keep on for debugging; turn off if you do not want users to see one-line tool calls. | -| **Enabled** | Turn on only when you are ready to login/start the channel. | -| **Allow From** | One value per line. Use `*` for an open test channel, or specific WeChat user ids once you know them. Empty denies access. | -| **Base Url** | Default: `https://ilinkai.weixin.qq.com`. Usually leave unchanged. | -| **Cdn Base Url** | Default: `https://novac2c.cdn.weixin.qq.com/c2c`. Used for media upload/download. | -| **Route Tag** | Optional Tencent route tag. Leave blank unless your deployment requires it. | -| **Token** | Optional bot token. Leave blank for QR-code login; the channel saves the token after a successful scan. | -| **State Dir** | Optional custom state directory. Blank means DeepTutor uses `data/partners//channels/weixin/` for `account.json`. | -| **Poll Timeout** | Long-poll timeout in seconds. `35` is the default and works for most networks. | +Card fields for this channel are in the [channel schema](/channels/schema/#weixin). + ## Login flow diff --git a/docs/src/content/docs/channels/index.md b/docs/src/content/docs/channels/index.md new file mode 100644 index 000000000..469f23de2 --- /dev/null +++ b/docs/src/content/docs/channels/index.md @@ -0,0 +1,28 @@ +--- +title: Create a partner +description: Create one partner, talk to it in the app, then deliver one reply through a single channel. +quadrant: how-to +--- + +A partner is a persistent companion on the same chat loop as [Chat](/learning-workspace/chat/). It has its own soul, library, and memory. A channel only delivers that loop to an external app. + +Partners used to be a separate TutorBot engine with `deeptutor bot` commands and YAML channels. Those URLs redirect here. The companion now runs as a scoped chat turn, and channels are cards in the partner UI. + +## Create one and send one message + +1. Open **Partners** and choose **New partner**. +2. Set **Identity** (name and default reply language) and **Soul** (role and tone). The first reply uses this soul. +3. In **Mind**, pick a model. Leave extra tools off until the first reply works. +4. In **Library**, copy one small knowledge base or skill into a private library, or bind one existing workspace. Finish the wizard. +5. Open the partner's **Chat** tab and send one question. Continue only after it answers in the soul you wrote. +6. Open **Channels**, enable one channel, and save. Use your own sender id in **Allow From**. Keep **Send Progress** and **Send Tool Hints** on for this test. +7. Send one message from that app. The reply should land in the same thread you see in the partner's Chat tab. + +Field names for the card are in the [channel schema](/channels/schema/). Choose the app in [Domestic IM](/channels/domestic/) or [International IM](/channels/international/). + +You own the partners you create. An admin can assign one to other people; they can talk to it and cannot see its credentials. Each person gets a private conversation and relationship memory. + +## See also + +- [My Agents](/customize/agents/) — consult a partner from a normal chat turn +- [Memory](/learning-workspace/memory/) — what the partner can read and write diff --git a/docs/src/content/docs/partners/discord.md b/docs/src/content/docs/channels/international/discord.md similarity index 73% rename from docs/src/content/docs/partners/discord.md rename to docs/src/content/docs/channels/international/discord.md index faadf958e..8dbf92384 100644 --- a/docs/src/content/docs/partners/discord.md +++ b/docs/src/content/docs/channels/international/discord.md @@ -36,17 +36,8 @@ pip install "deeptutor[partners]" Open **Partners -> your partner -> Channels -> Discord**. -| Field | What to enter | -| --- | --- | -| **Streaming** | Off by default. Streams the reply live by editing the message in place as text arrives. Requires **Send Progress**: narration rounds stream as they happen. | -| **Send Progress** | Keep on while testing. It delivers narration updates during long turns. | -| **Send Tool Hints** | Keep on for debugging; turn off if users should not see one-line tool calls. | -| **Enabled** | Turn on only when you are ready to start the channel. | -| **Token** | The bot token from the Developer Portal (**Bot** -> **Reset Token**). Stored as a secret and masked after save. | -| **Allow From** | One value per line. Use `*` for an open test bot, or Discord user ids (right-click -> Copy User ID with Developer Mode on). Empty denies everyone. | -| **Gateway Url** | Default `wss://gateway.discord.gg/?v=10&encoding=json`. Change it only if you proxy the gateway. | -| **Intents** | Gateway intent bitfield. The default `37377` covers Guilds, Guild Messages, Direct Messages, and Message Content. Any privileged intent in this number must also be enabled in the Developer Portal. | -| **Group Policy** | `mention` (default): in server channels the bot only answers when @mentioned. `open`: it answers every message in channels it can read. DMs always get a response. | +Card fields for this channel are in the [channel schema](/channels/schema/#discord). + Replies longer than Discord's 2000-character limit are split into multiple messages automatically. @@ -87,6 +78,6 @@ With **Group Policy** = `mention`, the message must actually @mention the bot. A ## See also -- [Channel Matrix](/partners/channels/) — all channels at a glance -- [Telegram](/partners/telegram/) — simpler polling model, same streaming switch -- [Slack](/partners/slack/) — similar developer-portal feel, Socket Mode +- [Channel Matrix](/channels/schema/) — all channels at a glance +- [Telegram](/channels/international/telegram/) — simpler polling model, same streaming switch +- [Slack](/channels/international/slack/) — similar developer-portal feel, Socket Mode diff --git a/docs/src/content/docs/partners/email.md b/docs/src/content/docs/channels/international/email.md similarity index 65% rename from docs/src/content/docs/partners/email.md rename to docs/src/content/docs/channels/international/email.md index 262edc111..e5e293fda 100644 --- a/docs/src/content/docs/partners/email.md +++ b/docs/src/content/docs/channels/international/email.md @@ -35,31 +35,8 @@ The Partner needs its own mailbox with IMAP and SMTP access. Do not reuse a pers Open **Partners -> your partner -> Channels -> Email**. -| Field | What to enter | -| --- | --- | -| **Send Progress** | Each progress update becomes a separate email. Fine for a first test; most deployments turn it off to keep inboxes quiet. | -| **Send Tool Hints** | Same caveat — one email per hint. Turn off outside debugging. | -| **Enabled** | Turn on when you are ready to start polling. | -| **Consent Granted** | Hard privacy gate. The channel refuses to read or send any mail until this is on. Enable it only after the mailbox owner has explicitly agreed to let DeepTutor process the inbox. | -| **Imap Host** | e.g. `imap.gmail.com`. | -| **Imap Port** | Default `993` (IMAP over SSL). | -| **Imap Username** | Usually the full address, e.g. `tutor@example.com`. | -| **Imap Password** | The App Password (Gmail/Outlook with 2FA) or account password (self-hosted). Stored as a secret. | -| **Imap Mailbox** | Default `INBOX`. Some providers spell folders differently — check webmail if polling finds nothing. | -| **Imap Use Ssl** | Keep on for port 993. | -| **Smtp Host** | e.g. `smtp.gmail.com`. | -| **Smtp Port** | Default `587` (STARTTLS). Use `465` together with **Smtp Use Ssl**. | -| **Smtp Username** | Usually the same as Imap Username. | -| **Smtp Password** | Usually the same App Password. Stored as a secret. | -| **Smtp Use Tls** | STARTTLS on port 587. Keep on unless you switch to implicit SSL below. | -| **Smtp Use Ssl** | Implicit SSL, typically port 465. Enable one of the two TLS options, not both. | -| **From Address** | Optional. Blank falls back to Smtp Username, then Imap Username. | -| **Auto Reply Enabled** | When off, the Partner stops replying automatically to inbound mail (proactive sends still work). Useful as a brake while testing. | -| **Poll Interval Seconds** | Default `30`. How often the inbox is checked; values below 5 are clamped to 5. | -| **Mark Seen** | Marks processed mail as read — this is the primary duplicate protection. Leave on. | -| **Max Body Chars** | Default `12000`. Longer bodies are truncated before reaching the Partner. | -| **Subject Prefix** | Default `Re: `. Prepended to reply subjects unless the subject already starts with `Re:`. | -| **Allow From** | One email address per line, lowercase. `*` for an open test channel. Empty denies everyone. | +Card fields for this channel are in the [channel schema](/channels/schema/#email). + Each unique sender address is its own session, and replies carry `In-Reply-To` headers so they thread correctly in the sender's mail client. diff --git a/docs/src/content/docs/channels/international/index.md b/docs/src/content/docs/channels/international/index.md new file mode 100644 index 000000000..b9a2a23ce --- /dev/null +++ b/docs/src/content/docs/channels/international/index.md @@ -0,0 +1,21 @@ +--- +title: International IM +description: Which built-in international and asynchronous channels fit which kind of partner. +quadrant: explanation +--- + +These channels deliver the same partner outside the domestic set. Email is in this group because it is an asynchronous inbox, not a regional IM. + +| Channel | Connection | Fits | +| --- | --- | --- | +| [Telegram](/channels/international/telegram/) | Bot API long-poll | The shortest setup: a BotFather token and no public URL | +| [Discord](/channels/international/discord/) | Gateway WebSocket | A Discord server or DMs | +| [Slack](/channels/international/slack/) | Socket Mode | A Slack workspace, including threads | +| [Microsoft Teams](/channels/international/msteams/) | Bot Framework webhook | Teams, with a public messaging endpoint | +| [WhatsApp](/channels/international/whatsapp/) | An external bridge | WhatsApp through that bridge runtime | +| [Matrix](/channels/international/matrix/) | Sync against a homeserver | Rooms on a homeserver you choose, with optional encryption | +| [Zulip](/channels/international/zulip/) | Event queue | Stream and topic conversations | +| [Mattermost](/channels/international/mattermost/) | Native v4 WebSocket | A Mattermost server you host | +| [Email](/channels/international/email/) | IMAP poll and SMTP reply | An inbox, when a delayed reply is acceptable | + +Shared switches and per-card fields are in the [channel schema](/channels/schema/). diff --git a/docs/src/content/docs/partners/matrix.md b/docs/src/content/docs/channels/international/matrix.md similarity index 72% rename from docs/src/content/docs/partners/matrix.md rename to docs/src/content/docs/channels/international/matrix.md index 73ce5c3bc..1b52a7f52 100644 --- a/docs/src/content/docs/partners/matrix.md +++ b/docs/src/content/docs/channels/international/matrix.md @@ -59,22 +59,8 @@ curl -X POST https://matrix.org/_matrix/client/r0/login \ Open **Partners -> your partner -> Channels -> Matrix**. -| Field | What to enter | -| --- | --- | -| **Send Progress** | Keep on while testing. It sends narration updates during long turns. | -| **Send Tool Hints** | Keep on for debugging; turn off if you do not want users to see one-line tool calls. | -| **Enabled** | Turn on when you are ready to start the channel. | -| **Homeserver** | Default `https://matrix.org`. Use your own server's URL if self-hosted. | -| **Access Token** | The token from Element or the login API. Stored as a secret. | -| **User Id** | The bot's full Matrix id, e.g. `@my-bot:matrix.org`. Also used to detect mentions. | -| **Device Id** | Optional but recommended: pick any stable string and keep it. If blank, a restart may replay recent messages. | -| **E2Ee Enabled** | Turn on only after installing the `[matrix-e2e]` extra plus libolm. Without them the bot cannot decrypt encrypted rooms. | -| **Sync Stop Grace Seconds** | Default `2`. How long an in-flight sync may finish during shutdown. Rarely changed. | -| **Max Media Bytes** | Default `20971520` (20 MB). Size cap for attachment uploads and downloads. | -| **Allow From** | One Matrix user id per line, e.g. `@frank:matrix.org`. `*` for an open test channel. Empty denies everyone — including room invites. | -| **Group Policy** | For multi-person rooms: `open` (default) answers every message, `mention` answers only when the bot is mentioned, `allowlist` answers only in rooms listed below. Direct 1:1 chats are always answered. | -| **Group Allow From** | Room ids (`!abc123:matrix.org`), one per line. Only used with the `allowlist` policy. | -| **Allow Room Mentions** | Whether an `@room` ping counts as mentioning the bot under the `mention` policy. Off by default. | +Card fields for this channel are in the [channel schema](/channels/schema/#matrix). + ## After you save diff --git a/docs/src/content/docs/partners/mattermost.md b/docs/src/content/docs/channels/international/mattermost.md similarity index 76% rename from docs/src/content/docs/partners/mattermost.md rename to docs/src/content/docs/channels/international/mattermost.md index 66e3f0306..9a0c855f9 100644 --- a/docs/src/content/docs/partners/mattermost.md +++ b/docs/src/content/docs/channels/international/mattermost.md @@ -36,17 +36,8 @@ pip install "deeptutor[partners]" Open **Partners -> your partner -> Channels -> Mattermost**. -| Field | What to enter | -| --- | --- | -| **Send Progress** | Keep on while testing. It delivers narration updates during long turns. | -| **Send Tool Hints** | Keep on for debugging; turn off if users should not see one-line tool calls. | -| **Enabled** | Turn on only when you are ready to start the channel. | -| **Server Url** | Your Mattermost base URL, e.g. `https://mattermost.example.com`. The scheme is optional (defaults to `https`) and the WebSocket URL is derived automatically — do not append `/api/v4`. | -| **Bot Token** | The bot account's access token from **Integrations -> Bot Accounts**. Stored as a secret and masked after save. | -| **Allow From** | One value per line. Use `*` for an open test bot, or Mattermost user ids. Empty denies everyone. | -| **Group Policy** | `mention` (default): in channels the bot only answers when @mentioned. `open`: it answers every message in channels it has joined. Direct messages always get a reply. | -| **Reply In Thread** | On (default): the bot answers in a thread rooted at the triggering post. Thread follow-ups still pass **Group Policy** first, so with the default `mention` policy they must @mention the bot. Off: replies go straight into the channel. | -| **Verify Ssl** | On (default). Turn off only for a self-hosted server whose TLS certificate is self-signed or issued by an internal CA. | +Card fields for this channel are in the [channel schema](/channels/schema/#mattermost). + Replies longer than Mattermost's post limit (~16k characters) are split into multiple messages automatically; file attachments up to 50 MB are supported. @@ -87,6 +78,6 @@ Two gates to check: ## See also -- [Channel Matrix](/partners/channels/) — all channels at a glance -- [Slack](/partners/slack/) — the team-chat channel Mattermost's native API replaces -- [Discord](/partners/discord/) — the same direct WebSocket + REST transport +- [Channel Matrix](/channels/schema/) — all channels at a glance +- [Slack](/channels/international/slack/) — the team-chat channel Mattermost's native API replaces +- [Discord](/channels/international/discord/) — the same direct WebSocket + REST transport diff --git a/docs/src/content/docs/partners/msteams.md b/docs/src/content/docs/channels/international/msteams.md similarity index 67% rename from docs/src/content/docs/partners/msteams.md rename to docs/src/content/docs/channels/international/msteams.md index 0ba009dc6..9d60517e0 100644 --- a/docs/src/content/docs/partners/msteams.md +++ b/docs/src/content/docs/channels/international/msteams.md @@ -39,26 +39,8 @@ pip install "deeptutor[partners]" Open **Partners -> your partner -> Channels -> Microsoft Teams**. -| Field | What to enter | -| --- | --- | -| **Send Progress** | Keep on while testing. It delivers narration updates during long turns. | -| **Send Tool Hints** | Keep on for debugging; turn off if users should not see one-line tool calls. | -| **Enabled** | Turn on only when you are ready to start the channel. | -| **App Id** | The Application (client) ID of the app registration. Also used as the expected audience when validating inbound JWTs. | -| **App Password** | The client secret value. Stored as a secret and masked after save. | -| **Tenant Id** | The Directory (tenant) ID. Required for single-tenant registrations; leave blank only for multi-tenant bots. | -| **Host** | Bind address for the built-in HTTP server. Default `0.0.0.0` listens on all interfaces; use `127.0.0.1` if a local reverse proxy is the only client. | -| **Port** | Listening port. Default `3978`, the Bot Framework convention. It must be unique among all enabled Teams Partners running on the same host. | -| **Path** | URL path for inbound activities. Default `/api/messages`; it must match the tail of the messaging endpoint. | -| **Allow From** | One value per line. Use `*` for a first test, or Microsoft Entra object ids — the partner logs print the id of any denied sender. Empty denies everyone. | -| **Reply In Thread** | When on (default), replies attach to the triggering message instead of starting a new one. | -| **Mention Only Response** | The text sent back when a message contains nothing but the bot @mention. | -| **Validate Inbound Auth** | Keep on. Verifies the Bot Framework JWT on every request (RS256 against Microsoft's published keys, audience = App Id). Turning it off lets anyone who finds the URL talk to your partner as any user — local testing only. | -| **Ref Ttl Days** | Days an idle conversation reference is kept before pruning. Default `30`. | -| **Prune Web Chat Refs** | Drops Bot Framework Web Chat conversations from the stored references (Web Chat is not supported). | -| **Prune Non Personal Refs** | Drops group/channel conversation references; the channel is DM-only for now. | -| **Ref Touch Interval S** | Minimum seconds between timestamp refreshes on an active conversation reference. Default `300`. | -| **Trusted Service Url Hosts** | Allowlist of Bot Framework hosts the channel accepts and replies to. The default covers the public, GCC, and DoD Teams clouds — extend it only if Microsoft routes you elsewhere. | +Card fields for this channel are in the [channel schema](/channels/schema/#msteams). + ## After you save @@ -94,5 +76,5 @@ By design: the channel is currently DM-only. Non-personal conversations are drop ## See also -- [Channel Matrix](/partners/channels/) — all channels at a glance -- [Slack](/partners/slack/) — the other big workplace platform, Socket Mode instead of a public endpoint +- [Channel Matrix](/channels/schema/) — all channels at a glance +- [Slack](/channels/international/slack/) — the other big workplace platform, Socket Mode instead of a public endpoint diff --git a/docs/src/content/docs/partners/slack.md b/docs/src/content/docs/channels/international/slack.md similarity index 70% rename from docs/src/content/docs/partners/slack.md rename to docs/src/content/docs/channels/international/slack.md index b4723595e..decaeef56 100644 --- a/docs/src/content/docs/partners/slack.md +++ b/docs/src/content/docs/channels/international/slack.md @@ -36,22 +36,8 @@ pip install "deeptutor[partners]" Open **Partners -> your partner -> Channels -> Slack**. -| Field | What to enter | -| --- | --- | -| **Send Progress** | Keep on while testing. It delivers narration updates during long turns. | -| **Send Tool Hints** | Keep on for debugging; turn off if users should not see one-line tool calls. | -| **Enabled** | Turn on only when you are ready to start the channel. | -| **Mode** | `socket` is the only supported mode. Leave it unchanged. | -| **Webhook Path** | Reserved for a future webhook mode; unused while **Mode** is `socket`. Leave the default `/slack/events`. | -| **Bot Token** | The `xoxb-…` token from **OAuth & Permissions**. Stored as a secret and masked after save. | -| **App Token** | The `xapp-…` App-Level Token from **Socket Mode** (needs `connections:write`). Also a secret. Do not swap it with the Bot Token. | -| **User Token Read Only** | Keep the default (on). | -| **Reply In Thread** | On (default): the bot answers in a thread under the triggering message. Follow-ups in that thread still pass **Group Policy** first, so with the default `mention` policy they must @mention the bot. Off: replies go straight into the channel. | -| **React Emoji** | Emoji name (no colons) the bot adds to your message as a receipt acknowledgement. Default `eyes`. | -| **Allow From** | One value per line. Use `*` for an open test bot, or Slack user ids (`U…`). Empty denies everyone. | -| **Group Policy** | `mention` (default): in channels the bot only answers @mentions. `open`: it answers every message in channels it is in. `allowlist`: only channels listed in **Group Allow From**. | -| **Group Allow From** | Channel ids (`C…`), one per line. Used when **Group Policy** is `allowlist`. | -| **Dm** | DM sub-policy: **Enabled** toggles DMs as a whole; **Policy** `open` answers any DM, `allowlist` restricts DMs to the ids in its own **Allow From** list. | +Card fields for this channel are in the [channel schema](/channels/schema/#slack). + ## After you save @@ -91,5 +77,5 @@ Three gates to check: ## See also -- [Channel Matrix](/partners/channels/) — all channels at a glance -- [Discord](/partners/discord/) — similar developer-portal setup over a Gateway WebSocket +- [Channel Matrix](/channels/schema/) — all channels at a glance +- [Discord](/channels/international/discord/) — similar developer-portal setup over a Gateway WebSocket diff --git a/docs/src/content/docs/partners/telegram.md b/docs/src/content/docs/channels/international/telegram.md similarity index 68% rename from docs/src/content/docs/partners/telegram.md rename to docs/src/content/docs/channels/international/telegram.md index 0c17f8119..0e2184a8a 100644 --- a/docs/src/content/docs/partners/telegram.md +++ b/docs/src/content/docs/channels/international/telegram.md @@ -36,21 +36,8 @@ pip install "deeptutor[partners]" Open **Partners -> your partner -> Channels -> Telegram**. -| Field | What to enter | -| --- | --- | -| **Streaming** | Off by default. Streams the reply live by editing the Telegram message in place as text arrives. Requires **Send Progress**: narration rounds stream as they happen. | -| **Send Progress** | Keep on while testing. It delivers narration updates during long turns. | -| **Send Tool Hints** | Keep on for debugging; turn off if users should not see one-line tool calls. | -| **Enabled** | Turn on only when you are ready to start the channel. | -| **Token** | The HTTP API token from BotFather. Stored as a secret and masked after save. | -| **Allow From** | One value per line. Use `*` for an open test bot, or numeric user ids from `@userinfobot` (usernames also match). Empty denies everyone. | -| **Proxy** | Optional proxy URL for networks where Telegram is unreachable, e.g. `socks5://127.0.0.1:1080` or `http://proxy:8080`. Leave blank for a direct connection. | -| **Reply To Message** | When on, the bot's answers quote the message that triggered them. Useful in busy groups, redundant in DMs. | -| **Group Policy** | Fallback for groups: `mention` (default) requires an @mention or bot reply; `open` answers every message. DMs bypass group policies; **Allow From** still applies. | -| **Chat Policies** | Per-chat overrides keyed by `chat_id`: `open`, `mention`, or `topics_only`. The latter auto-replies in `allowed_topics`; elsewhere an @mention or bot reply is required. First matching rule wins. | -| **Connection Pool Size** | HTTP connection pool for the Bot API client. Default `16` is fine for one bot. | -| **Pool Timeout** | Seconds to wait for a free pooled connection. Default `15`. | -| **Stream Edit Interval** | Minimum seconds between in-place edits while streaming. Default `0.6`; raise it if Telegram answers with flood-control errors. | +Card fields for this channel are in the [channel schema](/channels/schema/#telegram). + Replies longer than Telegram's 4096-character limit are split into multiple messages automatically (DeepTutor splits at 4000 to stay clear of the cap). @@ -91,5 +78,5 @@ Fill in **Proxy** with a SOCKS or HTTP proxy URL (e.g. `socks5://127.0.0.1:1080` ## See also -- [Channel Matrix](/partners/channels/) — all channels at a glance -- [Discord](/partners/discord/) — Gateway WebSocket model, similar streaming support +- [Channel Matrix](/channels/schema/) — all channels at a glance +- [Discord](/channels/international/discord/) — Gateway WebSocket model, similar streaming support diff --git a/docs/src/content/docs/partners/whatsapp.md b/docs/src/content/docs/channels/international/whatsapp.md similarity index 89% rename from docs/src/content/docs/partners/whatsapp.md rename to docs/src/content/docs/channels/international/whatsapp.md index 9bd57ff59..c0c0c0b30 100644 --- a/docs/src/content/docs/partners/whatsapp.md +++ b/docs/src/content/docs/channels/international/whatsapp.md @@ -97,14 +97,8 @@ Voice messages are not transcribed yet; they arrive as a placeholder note. Open **Partners -> your partner -> Channels -> WhatsApp**. -| Field | What to enter | -| --- | --- | -| **Send Progress** | Keep on while testing. It sends narration updates during long turns. | -| **Send Tool Hints** | Keep on for debugging; turn off if you do not want users to see one-line tool calls. | -| **Enabled** | Turn on only when the bridge is running and you are ready to start the channel. | -| **Bridge Url** | WebSocket URL of the bridge. Default: `ws://localhost:3001`. | -| **Bridge Token** | Optional shared secret. Set it only if your bridge checks the `auth` message. | -| **Allow From** | One value per line. Use `*` for an open test channel, or specific sender ids (the part before `@` in WhatsApp ids — usually the phone number). Empty denies access. | +Card fields for this channel are in the [channel schema](/channels/schema/#whatsapp). + ## After you save diff --git a/docs/src/content/docs/partners/zulip.md b/docs/src/content/docs/channels/international/zulip.md similarity index 75% rename from docs/src/content/docs/partners/zulip.md rename to docs/src/content/docs/channels/international/zulip.md index 89c7a0cf6..14f14f7f7 100644 --- a/docs/src/content/docs/partners/zulip.md +++ b/docs/src/content/docs/channels/international/zulip.md @@ -34,18 +34,8 @@ pip install "deeptutor[partners]" Open **Partners -> your partner -> Channels -> Zulip**. -| Field | What to enter | -| --- | --- | -| **Send Progress** | Keep on while testing. It sends narration updates during long turns. | -| **Send Tool Hints** | Keep on for debugging; turn off if you do not want users to see one-line tool calls. | -| **Enabled** | Turn on when you are ready to start the channel. | -| **Site** | Your Zulip server URL, e.g. `https://yourorg.zulipchat.com`. Include the scheme and the correct realm subdomain. | -| **Email** | The bot's generated email from the creation page — not your own. | -| **Api Key** | The bot's API key. Stored as a secret. | -| **Allow From** | One Zulip user id or email per line — either form matches. `*` for an open test channel. Empty denies everyone. | -| **Group Policy** | For stream messages: `mention` (default) answers only when the bot is @-mentioned, `open` answers every message in subscribed streams. Direct messages are always answered. | -| **Subscribe Streams** | Stream names, one per line. The channel subscribes the bot to them at startup. | -| **Timeout** | Event-queue long-poll timeout in seconds. Default `60` works for most servers. | +Card fields for this channel are in the [channel schema](/channels/schema/#zulip). + ## After you save diff --git a/docs/src/content/docs/channels/schema.md b/docs/src/content/docs/channels/schema.md new file mode 100644 index 000000000..ff2431ecb --- /dev/null +++ b/docs/src/content/docs/channels/schema.md @@ -0,0 +1,404 @@ +--- +title: Channel Matrix +description: All built-in Partner channels, their connection model, required fields, and when to use each one. +quadrant: reference +--- + +Partner channels are delivery adapters around the same Partner brain. They do not create a second agent runtime: an inbound IM event becomes a scoped chat turn, and the reply is delivered back through the channel. + +Use the web UI for most configuration: **Partners -> your partner -> Channels** renders the live schema from `/api/partners/channels/schema`, masks secret fields, polls `/channels/status`, and lets you reload channels without rewriting YAML by hand. + +![A Partner’s channel configuration](/screenshots/dev/partners-channels.png) + +## Built-in channels + +| Channel | Key | Connection model | Best for | Required core fields | +| --- | --- | --- | --- | --- | +| WeChat | `weixin` | HTTP long-poll + QR login | Personal WeChat assistant | `allow_from`; optional `token`, `state_dir`, `route_tag`, `poll_timeout` | +| WeCom | `wecom` | WeCom AI Bot WebSocket | Enterprise WeChat / WeChat Work | `bot_id`, `secret`, `allow_from` | +| QQ | `qq` | Tencent botpy WebSocket | Official QQ bot deployments | `app_id`, `secret`, `allow_from`, `msg_format` | +| QQ (NapCat) | `napcat` | OneBot v11 WebSocket | Personal QQ via NapCat | `ws_url`, optional `access_token`, `allow_from`, `group_policy` | +| Telegram | `telegram` | Bot API polling | Simple personal or group bot | `token`, `allow_from` | +| Discord | `discord` | Gateway WebSocket | Discord servers and DMs | `token`, `allow_from`, group policy fields | +| Slack | `slack` | Socket Mode | Slack teams, DMs, threaded channel help | `bot_token`, `app_token`, `allow_from`, `group_policy` | +| Feishu / Lark | `feishu` | Lark SDK WebSocket | Feishu/Lark enterprise chat | `app_id`, `app_secret`, verification/encryption fields where used | +| DingTalk | `dingtalk` | Stream Mode | DingTalk enterprise chat | `client_id`, `client_secret`, `allow_from` | +| Matrix | `matrix` | Matrix sync loop | Decentralized rooms, optional E2EE setup | `homeserver`, user credentials or `access_token`, `allow_from`, `group_policy` | +| Zulip | `zulip` | Event queue | Stream + topic workflows | `email`, `api_key`, `site`, `allow_from`, `group_policy` | +| Mattermost | `mattermost` | Native v4 WebSocket + REST | Self-hosted open-source team chat | `server_url`, `bot_token`, `allow_from`, optional `group_policy`, `reply_in_thread`, `verify_ssl` | +| WhatsApp | `whatsapp` | Bridge WebSocket | WhatsApp via a bridge runtime | bridge URL/token, `allow_from` | +| Email | `email` | IMAP poll + SMTP send | Async email tutoring/helpdesk | IMAP host/user/password, SMTP host/user/password, `allow_from` | +| Mochat | `mochat` | Socket.IO or HTTP polling | Customer-service style chat panel | `base_url` / socket URL, `claw_token`, `allow_from` | +| Microsoft Teams | `msteams` | Built-in HTTP webhook listener | Teams DM-first Bot Framework integration | `app_id`, `app_password`, `tenant_id`, host/port/path | + +## Install requirements + +Every built-in channel except Matrix is covered by the Partners extra: + +```bash +python scripts/install_extras.py partners +# or, from an installed release when partners extras are available: +pip install "deeptutor[partners]" +``` + +This pulls in all channel SDKs — `python-telegram-bot`, `slack-sdk`, `lark-oapi`, `dingtalk-stream`, `qq-botpy`, `wecom-aibot-sdk`, `python-socketio`, and friends (the full list lives in `requirements/partners.txt`). Email needs nothing beyond the Python standard library. Matrix ships as its own extra because encrypted rooms need the native `libolm` library: run `python scripts/install_extras.py matrix` for plain rooms or `python scripts/install_extras.py matrix-e2e` for E2EE in a source checkout. + +If a channel's dependency is missing on the server, the Channels panel greys that channel out and shows the import error (for example `No module named 'lark_oapi'`). Installed cards distinguish **Connected**, **Connecting**, **Listener running**, **Waiting for scan**, **Configuration required**, **Connection failed**, and **Not connected**. Install a missing package or fix the displayed setup action, then restart/reload the Partner. + +Stop DeepTutor before changing installed modules or dependencies. Run the source helper from the repository root, restart with the same data directory, then check `deeptutor module list` and the Channels status. Wheel-based installations should use the extras supported by their matching release; do not install feature wheels over a source checkout. + +## Shared delivery switches + +Most channels inherit the same delivery controls: + +| Field | Meaning | +| --- | --- | +| `enabled` | Whether the Partner should start this channel. | +| `send_progress` | Deliver narration/progress updates during long turns. | +| `send_tool_hints` | Deliver one-line tool-call hints. Useful while debugging, noisy in production. | +| `streaming` | Telegram, Discord, and Feishu only: stream the reply live by editing the message in place as text arrives (Feishu uses CardKit streaming cards). Requires `send_progress`. Off by default. | +| `allow_from` | User/chat allowlist. `*` is convenient for tests; explicit ids are safer for deployment. | + +## Configuration workflow + +1. Create and test the Partner in the web UI before enabling any IM channel. +2. Enable only one channel first. +3. Keep `send_progress` and `send_tool_hints` on while debugging. +4. Start with `allow_from: ["*"]` only in local/private tests. +5. Confirm the live card reaches a connected/listening state, send a short message, then replace `*` with real sender ids; inspect logs only if the status detail is insufficient. +6. Add more channels only after the first channel is stable. + +## Choosing a channel + +- Use **WeChat** for personal WeChat. It requires a human QR-code scan and persisted state. +- Use **WeCom**, **Feishu**, **DingTalk**, **Slack**, or **Teams** for enterprise/team deployments. +- Use **QQ** for official Tencent bot accounts; use **NapCat** only when you intentionally operate a personal QQ bridge. +- Use **Email** when asynchronous replies are acceptable and users prefer inbox workflows. +- Use **Matrix** or **Zulip** when room/topic structure matters more than consumer IM convenience. +- Use **Mattermost** for a self-hosted, open-source team chat you run yourself. + +## Where state lives + +Channel state is stored below the Partner's `channels/` directory, for example: + +```text +data/partners//channels/weixin/account.json +data/partners//channels/msteams/msteams_conversations.json +``` + +Persist the whole `data/partners/` tree in Docker or production hosts. Losing channel state can force new QR scans or conversation-reference collection. + +## Detailed pages + +Every built-in channel has a dedicated page with platform-side registration steps, a field-by-field walkthrough of the channel card, and troubleshooting: + +- [WeChat](/channels/domestic/weixin/) — personal WeChat QR login and long-poll setup +- [WeCom](/channels/domestic/wecom/) — Enterprise WeChat AI Bot setup +- [QQ / NapCat](/channels/domestic/qq/) — official QQ bot and personal QQ bridge paths +- [Telegram](/channels/international/telegram/) — BotFather registration, Bot API polling, live streaming +- [Discord](/channels/international/discord/) — Developer Portal app, intents, Gateway WebSocket +- [Slack](/channels/international/slack/) — Socket Mode app with bot + app tokens +- [Feishu / Lark](/channels/domestic/feishu/) — open-platform app and CardKit streaming cards +- [DingTalk](/channels/domestic/dingtalk/) — Stream Mode enterprise bot +- [Matrix](/channels/international/matrix/) — homeserver credentials and optional E2EE +- [Zulip](/channels/international/zulip/) — bot account and stream subscriptions +- [Mattermost](/channels/international/mattermost/) — self-hosted server via bot token over the native v4 API +- [WhatsApp](/channels/international/whatsapp/) — bridge runtime setup +- [Email](/channels/international/email/) — IMAP polling and SMTP replies +- [Mochat](/channels/domestic/mochat/) — Socket.IO customer-service panel +- [Microsoft Teams](/channels/international/msteams/) — Bot Framework webhook listener + +## Per-channel fields + +These are the fields on each channel card. The card is rendered from `GET /api/v1/partners/channels/schema`. Shared switches stay in the matrix above. + + + +### DingTalk + +| Field | What to enter | +| --- | --- | +| **Send Progress** | Keep on while testing. It delivers narration updates during long turns. | +| **Send Tool Hints** | Keep on for debugging; turn off if users should not see one-line tool calls. | +| **Enabled** | Turn on only when you are ready to start the channel. | +| **Client Id** | The AppKey from Credentials & Basic Info (often starts with `ding...`). | +| **Client Secret** | The AppSecret from the same page. Stored as a secret and masked after save. | +| **Allow From** | One value per line. Use `*` for a first test, or DingTalk staff ids (the partner logs print the sender id with every inbound message). Empty denies everyone. | + + +### Feishu + +| Field | What to enter | +| --- | --- | +| **Streaming** | Off by default. Streams the reply live into a CardKit card with a typewriter effect. Requires **Send Progress**: narration rounds stream as they happen. | +| **Send Progress** | Keep on while testing. It delivers narration updates during long turns. | +| **Send Tool Hints** | Keep on for debugging; turn off if users should not see one-line tool calls. | +| **Enabled** | Turn on only when you are ready to start the channel. | +| **App Id** | The `cli_...` App ID from Credentials & Basic Info. | +| **App Secret** | The App Secret from the same page. Stored as a secret and masked after save. | +| **Domain** | `feishu` (default) for mainland Feishu apps; select `lark` for international Lark tenants so the SDK uses `open.larksuite.com`. The scan flow fills this automatically. | +| **Encrypt Key** | Only needed when event encryption is enabled on the platform. Leave blank otherwise. | +| **Verification Token** | The event Verification Token from the platform; used to verify event signatures. Leave blank if you did not configure one. | +| **Allow From** | One value per line. Use `*` for an open test bot, or `ou_...` open ids (copy them from the partner logs after a first message). Empty denies everyone. | +| **React Emoji** | The reaction the bot adds to every message it accepts, as an instant acknowledgement. Default `THUMBSUP`; other common types: `OK`, `EYES`, `DONE`, `OnIt`, `HEART`. | +| **Group Policy** | `mention` (default): in groups the bot only answers when @mentioned. `open`: it answers every group message. DMs always get a response. | +| **Reply In Thread** | On by default. Group replies stay in the triggering message's thread. Single chats always get a plain reply. | +| **Thinking Notice** | On by default. Posts a short thinking notice while the model reasons, and removes it when the answer starts. | +| **Stream Print Frequency Ms** | CardKit typewriter interval in milliseconds. Default `30`. `0` uses the platform default. | +| **Stream Print Step** | Characters revealed on each typewriter step. Default `6`. `0` uses the platform default. | +| **Stream Print Strategy** | `fast` (default) or `delay`. | + + +### Mochat + +| Field | What to enter | +| --- | --- | +| **Send Progress** | Keep on while testing. It sends narration updates during long turns. | +| **Send Tool Hints** | Keep on for debugging; turn off if you do not want users to see one-line tool calls. | +| **Enabled** | Turn on only when you are ready to start the channel. | +| **Base Url** | Your Mochat instance. Default: `https://mochat.io`. | +| **Socket Url** | Optional separate Socket.IO endpoint. Blank means use **Base Url**. | +| **Socket Path** | Socket.IO mount path. Default: `/socket.io`. | +| **Socket Disable Msgpack** | Off by default (msgpack is used when available). Turn on to force JSON if your server has no msgpack parser. | +| **Socket Reconnect Delay Ms** | Initial reconnect delay. Default `1000`. | +| **Socket Max Reconnect Delay Ms** | Reconnect backoff cap. Default `10000`. | +| **Socket Connect Timeout Ms** | Connection timeout. Default `10000`. | +| **Refresh Interval Ms** | How often the channel refreshes its session/panel directory. Default `30000`. | +| **Watch Timeout Ms** | Long-poll timeout in HTTP fallback mode. Default `25000`. | +| **Claw Token** | Required. The bot token from your Mochat admin panel. | +| **Sessions** | Session ids to watch, one per line. `*` auto-discovers and subscribes new sessions. | +| **Panels** | Panel ids to watch, one per line. `*` auto-discovers panels. Leave both lists empty and the channel watches nothing. | +| **Allow From** | One value per line. Use `*` for an open test channel, or specific Mochat user ids. Empty denies access. | + +| Field | Notes | +| --- | --- | +| **Watch Limit** | Max events fetched per poll. Default `100`. | +| **Retry Delay Ms** | Delay between failed HTTP retries. Default `500`. | +| **Max Retry Attempts** | Maximum Socket.IO reconnection attempts. `0` means reconnect forever. This field does not cap HTTP fallback loops. | +| **Agent User Id** | The bot's own Mochat user id. Used to ignore the bot's own messages and to detect @-mentions. | +| **Mention** | `require_in_groups` — require an @-mention before answering in group sessions. | +| **Groups** | Per-group overrides, keyed by group id: `{"": {"require_mention": true}}`. | +| **Reply Delay Mode** | `non-mention` (default) buffers panel messages that do not mention the bot; any other value disables buffering. | +| **Reply Delay Ms** | Buffer window. Default `120000` (2 minutes). | + + +### QQ / NapCat + +| Field | Notes | +| --- | --- | +| `enabled` | Start the channel with the partner. | +| `app_id` | App ID from Tencent's bot platform. | +| `secret` | Bot secret. | +| `allow_from` | Allowed QQ user ids / openids. Empty denies access; use explicit ids for production. | +| `msg_format` | `plain` or `markdown`. Start with `plain` if clients render Markdown inconsistently. | + + + +| Field | Notes | +| --- | --- | +| `enabled` | Start the channel with the partner. | +| `ws_url` | NapCat WebSocket endpoint, default `ws://127.0.0.1:3001`. | +| `access_token` | Optional OneBot access token. | +| `allow_from` | Allowed user ids. Use `*` only for local testing. | +| `group_policy` | `mention`, `open`, or a probability between `0` and `1`. Mentions/replies always respond. | +| `group_policy_overrides` | Per-group policy map, keyed by group id. | +| `welcome_new_members` | Whether to welcome new group members. | +| `max_image_bytes` | Hard cap for inbound image downloads. | + + +### WeCom (WeChat Work) + +| Field | Notes | +| --- | --- | +| `enabled` | Start this channel when the partner starts. | +| `bot_id` | Bot ID from WeCom AI Bot platform. | +| `secret` | Secret from WeCom. Treat it as a credential. | +| `allow_from` | User ids allowed to talk to this partner. Empty denies access; `*` opens it where supported by the base channel policy. | +| `welcome_message` | Optional text sent when a user opens the chat. | +| `send_progress` / `send_tool_hints` | Delivery switches for narration and one-line tool calls. | + + +### WeChat (Personal Weixin) + +| Field | What to enter | +| --- | --- | +| **Send Progress** | Keep on while testing. It sends narration updates during long turns. | +| **Send Tool Hints** | Keep on for debugging; turn off if you do not want users to see one-line tool calls. | +| **Enabled** | Turn on only when you are ready to login/start the channel. | +| **Allow From** | One value per line. Use `*` for an open test channel, or specific WeChat user ids once you know them. Empty denies access. | +| **Base Url** | Default: `https://ilinkai.weixin.qq.com`. Usually leave unchanged. | +| **Cdn Base Url** | Default: `https://novac2c.cdn.weixin.qq.com/c2c`. Used for media upload/download. | +| **Route Tag** | Optional Tencent route tag. Leave blank unless your deployment requires it. | +| **Token** | Optional bot token. Leave blank for QR-code login; the channel saves the token after a successful scan. | +| **State Dir** | Optional custom state directory. Blank means DeepTutor uses `data/partners//channels/weixin/` for `account.json`. | +| **Poll Timeout** | Long-poll timeout in seconds. `35` is the default and works for most networks. | + + +### Discord + +| Field | What to enter | +| --- | --- | +| **Streaming** | Off by default. Streams the reply live by editing the message in place as text arrives. Requires **Send Progress**: narration rounds stream as they happen. | +| **Send Progress** | Keep on while testing. It delivers narration updates during long turns. | +| **Send Tool Hints** | Keep on for debugging; turn off if users should not see one-line tool calls. | +| **Enabled** | Turn on only when you are ready to start the channel. | +| **Token** | The bot token from the Developer Portal (**Bot** -> **Reset Token**). Stored as a secret and masked after save. | +| **Allow From** | One value per line. Use `*` for an open test bot, or Discord user ids (right-click -> Copy User ID with Developer Mode on). Empty denies everyone. | +| **Gateway Url** | Default `wss://gateway.discord.gg/?v=10&encoding=json`. Change it only if you proxy the gateway. | +| **Intents** | Gateway intent bitfield. The default `37377` covers Guilds, Guild Messages, Direct Messages, and Message Content. Any privileged intent in this number must also be enabled in the Developer Portal. | +| **Group Policy** | `mention` (default): in server channels the bot only answers when @mentioned. `open`: it answers every message in channels it can read. DMs always get a response. | + + +### Email + +| Field | What to enter | +| --- | --- | +| **Send Progress** | Each progress update becomes a separate email. Fine for a first test; most deployments turn it off to keep inboxes quiet. | +| **Send Tool Hints** | Same caveat — one email per hint. Turn off outside debugging. | +| **Enabled** | Turn on when you are ready to start polling. | +| **Consent Granted** | Hard privacy gate. The channel refuses to read or send any mail until this is on. Enable it only after the mailbox owner has explicitly agreed to let DeepTutor process the inbox. | +| **Imap Host** | e.g. `imap.gmail.com`. | +| **Imap Port** | Default `993` (IMAP over SSL). | +| **Imap Username** | Usually the full address, e.g. `tutor@example.com`. | +| **Imap Password** | The App Password (Gmail/Outlook with 2FA) or account password (self-hosted). Stored as a secret. | +| **Imap Mailbox** | Default `INBOX`. Some providers spell folders differently — check webmail if polling finds nothing. | +| **Imap Use Ssl** | Keep on for port 993. | +| **Smtp Host** | e.g. `smtp.gmail.com`. | +| **Smtp Port** | Default `587` (STARTTLS). Use `465` together with **Smtp Use Ssl**. | +| **Smtp Username** | Usually the same as Imap Username. | +| **Smtp Password** | Usually the same App Password. Stored as a secret. | +| **Smtp Use Tls** | STARTTLS on port 587. Keep on unless you switch to implicit SSL below. | +| **Smtp Use Ssl** | Implicit SSL, typically port 465. Enable one of the two TLS options, not both. | +| **From Address** | Optional. Blank falls back to Smtp Username, then Imap Username. | +| **Auto Reply Enabled** | When off, the Partner stops replying automatically to inbound mail (proactive sends still work). Useful as a brake while testing. | +| **Poll Interval Seconds** | Default `30`. How often the inbox is checked; values below 5 are clamped to 5. | +| **Mark Seen** | Marks processed mail as read — this is the primary duplicate protection. Leave on. | +| **Max Body Chars** | Default `12000`. Longer bodies are truncated before reaching the Partner. | +| **Subject Prefix** | Default `Re: `. Prepended to reply subjects unless the subject already starts with `Re:`. | +| **Allow From** | One email address per line, lowercase. `*` for an open test channel. Empty denies everyone. | + + +### Matrix + +| Field | What to enter | +| --- | --- | +| **Send Progress** | Keep on while testing. It sends narration updates during long turns. | +| **Send Tool Hints** | Keep on for debugging; turn off if you do not want users to see one-line tool calls. | +| **Enabled** | Turn on when you are ready to start the channel. | +| **Homeserver** | Default `https://matrix.org`. Use your own server's URL if self-hosted. | +| **Access Token** | The token from Element or the login API. Stored as a secret. | +| **User Id** | The bot's full Matrix id, e.g. `@my-bot:matrix.org`. Also used to detect mentions. | +| **Device Id** | Optional but recommended: pick any stable string and keep it. If blank, a restart may replay recent messages. | +| **E2Ee Enabled** | Turn on only after installing the `[matrix-e2e]` extra plus libolm. Without them the bot cannot decrypt encrypted rooms. | +| **Sync Stop Grace Seconds** | Default `2`. How long an in-flight sync may finish during shutdown. Rarely changed. | +| **Max Media Bytes** | Default `20971520` (20 MB). Size cap for attachment uploads and downloads. | +| **Allow From** | One Matrix user id per line, e.g. `@frank:matrix.org`. `*` for an open test channel. Empty denies everyone — including room invites. | +| **Group Policy** | For multi-person rooms: `open` (default) answers every message, `mention` answers only when the bot is mentioned, `allowlist` answers only in rooms listed below. Direct 1:1 chats are always answered. | +| **Group Allow From** | Room ids (`!abc123:matrix.org`), one per line. Only used with the `allowlist` policy. | +| **Allow Room Mentions** | Whether an `@room` ping counts as mentioning the bot under the `mention` policy. Off by default. | + + +### Mattermost + +| Field | What to enter | +| --- | --- | +| **Send Progress** | Keep on while testing. It delivers narration updates during long turns. | +| **Send Tool Hints** | Keep on for debugging; turn off if users should not see one-line tool calls. | +| **Enabled** | Turn on only when you are ready to start the channel. | +| **Server Url** | Your Mattermost base URL, e.g. `https://mattermost.example.com`. The scheme is optional (defaults to `https`) and the WebSocket URL is derived automatically — do not append `/api/v4`. | +| **Bot Token** | The bot account's access token from **Integrations -> Bot Accounts**. Stored as a secret and masked after save. | +| **Allow From** | One value per line. Use `*` for an open test bot, or Mattermost user ids. Empty denies everyone. | +| **Group Policy** | `mention` (default): in channels the bot only answers when @mentioned. `open`: it answers every message in channels it has joined. Direct messages always get a reply. | +| **Reply In Thread** | On (default): the bot answers in a thread rooted at the triggering post. Thread follow-ups still pass **Group Policy** first, so with the default `mention` policy they must @mention the bot. Off: replies go straight into the channel. | +| **Verify Ssl** | On (default). Turn off only for a self-hosted server whose TLS certificate is self-signed or issued by an internal CA. | + + +### Microsoft Teams + +| Field | What to enter | +| --- | --- | +| **Send Progress** | Keep on while testing. It delivers narration updates during long turns. | +| **Send Tool Hints** | Keep on for debugging; turn off if users should not see one-line tool calls. | +| **Enabled** | Turn on only when you are ready to start the channel. | +| **App Id** | The Application (client) ID of the app registration. Also used as the expected audience when validating inbound JWTs. | +| **App Password** | The client secret value. Stored as a secret and masked after save. | +| **Tenant Id** | The Directory (tenant) ID. Required for single-tenant registrations; leave blank only for multi-tenant bots. | +| **Host** | Bind address for the built-in HTTP server. Default `0.0.0.0` listens on all interfaces; use `127.0.0.1` if a local reverse proxy is the only client. | +| **Port** | Listening port. Default `3978`, the Bot Framework convention. It must be unique among all enabled Teams Partners running on the same host. | +| **Path** | URL path for inbound activities. Default `/api/messages`; it must match the tail of the messaging endpoint. | +| **Allow From** | One value per line. Use `*` for a first test, or Microsoft Entra object ids — the partner logs print the id of any denied sender. Empty denies everyone. | +| **Reply In Thread** | When on (default), replies attach to the triggering message instead of starting a new one. | +| **Mention Only Response** | The text sent back when a message contains nothing but the bot @mention. | +| **Validate Inbound Auth** | Keep on. Verifies the Bot Framework JWT on every request (RS256 against Microsoft's published keys, audience = App Id). Turning it off lets anyone who finds the URL talk to your partner as any user — local testing only. | +| **Ref Ttl Days** | Days an idle conversation reference is kept before pruning. Default `30`. | +| **Prune Web Chat Refs** | Drops Bot Framework Web Chat conversations from the stored references (Web Chat is not supported). | +| **Prune Non Personal Refs** | Drops group/channel conversation references; the channel is DM-only for now. | +| **Ref Touch Interval S** | Minimum seconds between timestamp refreshes on an active conversation reference. Default `300`. | +| **Trusted Service Url Hosts** | Allowlist of Bot Framework hosts the channel accepts and replies to. The default covers the public, GCC, and DoD Teams clouds — extend it only if Microsoft routes you elsewhere. | + + +### Slack + +| Field | What to enter | +| --- | --- | +| **Send Progress** | Keep on while testing. It delivers narration updates during long turns. | +| **Send Tool Hints** | Keep on for debugging; turn off if users should not see one-line tool calls. | +| **Enabled** | Turn on only when you are ready to start the channel. | +| **Mode** | `socket` is the only supported mode. Leave it unchanged. | +| **Webhook Path** | Reserved for a future webhook mode; unused while **Mode** is `socket`. Leave the default `/slack/events`. | +| **Bot Token** | The `xoxb-…` token from **OAuth & Permissions**. Stored as a secret and masked after save. | +| **App Token** | The `xapp-…` App-Level Token from **Socket Mode** (needs `connections:write`). Also a secret. Do not swap it with the Bot Token. | +| **User Token Read Only** | Keep the default (on). | +| **Reply In Thread** | On (default): the bot answers in a thread under the triggering message. Follow-ups in that thread still pass **Group Policy** first, so with the default `mention` policy they must @mention the bot. Off: replies go straight into the channel. | +| **React Emoji** | Emoji name (no colons) the bot adds to your message as a receipt acknowledgement. Default `eyes`. | +| **Allow From** | One value per line. Use `*` for an open test bot, or Slack user ids (`U…`). Empty denies everyone. | +| **Group Policy** | `mention` (default): in channels the bot only answers @mentions. `open`: it answers every message in channels it is in. `allowlist`: only channels listed in **Group Allow From**. | +| **Group Allow From** | Channel ids (`C…`), one per line. Used when **Group Policy** is `allowlist`. | +| **Dm** | DM sub-policy: **Enabled** toggles DMs as a whole; **Policy** `open` answers any DM, `allowlist` restricts DMs to the ids in its own **Allow From** list. | + + +### Telegram + +| Field | What to enter | +| --- | --- | +| **Streaming** | Off by default. Streams the reply live by editing the Telegram message in place as text arrives. Requires **Send Progress**: narration rounds stream as they happen. | +| **Send Progress** | Keep on while testing. It delivers narration updates during long turns. | +| **Send Tool Hints** | Keep on for debugging; turn off if users should not see one-line tool calls. | +| **Enabled** | Turn on only when you are ready to start the channel. | +| **Token** | The HTTP API token from BotFather. Stored as a secret and masked after save. | +| **Allow From** | One value per line. Use `*` for an open test bot, or numeric user ids from `@userinfobot` (usernames also match). Empty denies everyone. | +| **Proxy** | Optional proxy URL for networks where Telegram is unreachable, e.g. `socks5://127.0.0.1:1080` or `http://proxy:8080`. Leave blank for a direct connection. | +| **Reply To Message** | When on, the bot's answers quote the message that triggered them. Useful in busy groups, redundant in DMs. | +| **Group Policy** | Fallback for groups: `mention` (default) requires an @mention or bot reply; `open` answers every message. DMs bypass group policies; **Allow From** still applies. | +| **Chat Policies** | Per-chat overrides keyed by `chat_id`: `open`, `mention`, or `topics_only`. The latter auto-replies in `allowed_topics`; elsewhere an @mention or bot reply is required. First matching rule wins. | +| **Connection Pool Size** | HTTP connection pool for the Bot API client. Default `16` is fine for one bot. | +| **Pool Timeout** | Seconds to wait for a free pooled connection. Default `15`. | +| **Stream Edit Interval** | Minimum seconds between in-place edits while streaming. Default `0.6`; raise it if Telegram answers with flood-control errors. | + + +### WhatsApp + +| Field | What to enter | +| --- | --- | +| **Send Progress** | Keep on while testing. It sends narration updates during long turns. | +| **Send Tool Hints** | Keep on for debugging; turn off if you do not want users to see one-line tool calls. | +| **Enabled** | Turn on only when the bridge is running and you are ready to start the channel. | +| **Bridge Url** | WebSocket URL of the bridge. Default: `ws://localhost:3001`. | +| **Bridge Token** | Optional shared secret. Set it only if your bridge checks the `auth` message. | +| **Allow From** | One value per line. Use `*` for an open test channel, or specific sender ids (the part before `@` in WhatsApp ids — usually the phone number). Empty denies access. | + + +### Zulip + +| Field | What to enter | +| --- | --- | +| **Send Progress** | Keep on while testing. It sends narration updates during long turns. | +| **Send Tool Hints** | Keep on for debugging; turn off if you do not want users to see one-line tool calls. | +| **Enabled** | Turn on when you are ready to start the channel. | +| **Site** | Your Zulip server URL, e.g. `https://yourorg.zulipchat.com`. Include the scheme and the correct realm subdomain. | +| **Email** | The bot's generated email from the creation page — not your own. | +| **Api Key** | The bot's API key. Stored as a secret. | +| **Allow From** | One Zulip user id or email per line — either form matches. `*` for an open test channel. Empty denies everyone. | +| **Group Policy** | For stream messages: `mention` (default) answers only when the bot is @-mentioned, `open` answers every message in subscribed streams. Direct messages are always answered. | +| **Subscribe Streams** | Stream names, one per line. The channel subscribes the bot to them at startup. | +| **Timeout** | Event-queue long-poll timeout in seconds. Default `60` works for most servers. | diff --git a/docs/src/content/docs/cli/server-api.md b/docs/src/content/docs/cli/server-api.md deleted file mode 100644 index e2e76a289..000000000 --- a/docs/src/content/docs/cli/server-api.md +++ /dev/null @@ -1,368 +0,0 @@ ---- -title: Server API -description: The HTTP and WebSocket surface exposed by deeptutor serve -- for custom frontends and integrations. -quadrant: reference ---- - -`deeptutor serve` exposes a FastAPI backend at `http://localhost:8001/` unless you configured a different backend port. This page gives the high-signal map for custom frontends, mobile apps, and service-to-service integrations. - -For the exhaustive, always-current schema, start the server and open: - -```text -GET /openapi.json # Full OpenAPI 3.1 spec -GET /docs # Interactive Swagger UI -GET /redoc # Alternative ReDoc UI -``` - -## Starting the server - -```bash -# Backend only. Port comes from data/user/settings/system.json, default 8001. -deeptutor serve - -# Custom host/port for this process -deeptutor serve --host 127.0.0.1 --port 18001 - -# Development: hot reload on Python file changes -deeptutor serve --reload -``` - -## Authentication - -When enabled, protected routes require a Bearer JWT or `dt_token` cookie. Auth routes mix public login/bootstrap and guarded profile/admin endpoints; `GET /api/settings/ui` is public. MarginNote `/sync` and `/heartbeat` use `Authorization: MarginNote :`. - -```bash -# Login -curl -X POST http://localhost:8001/api/auth/login \ - -c cookies.txt \ - -H "Content-Type: application/json" \ - -d '{"username":"alice","password":"..."}' - -# Response contains user metadata; the JWT is set in the dt_token cookie. - -# Reuse the cookie -curl -b cookies.txt http://localhost:8001/api/sessions -``` - -If auth is disabled, auth dependencies are no-ops and local single-user requests do not need a token. - -## Turn execution WebSocket - -```text -WS /ws -``` - -This is the unified turn WebSocket used by the Web UI. It supports every capability uniformly and streams the same event family that `deeptutor run --format json` prints. - -Start a turn by sending a `type: "start_turn"` or `type: "message"` payload: - -```json -{ - "type": "start_turn", - "protocol_version": "2.0", - "content": "Find d/dx [sin(x^2)]", - "capability": "deep_solve", - "session_id": null, - "tools": ["reason"], - "knowledge_bases": ["math"], - "language": "en", - "config": {}, - "notebook_references": [], - "history_references": [], - "partner_group_references": [], - "attachments": [] -} -``` - -The example above shows the payload for one turn. Every client frame on `/ws` must also carry `"protocol_version": "2.0"` — `start_turn`, `subscribe_turn`, `cancel_turn`, `ping`, and the rest. A frame that omits it is rejected with a `protocol_error` event (`error_code: "unsupported_protocol_version"`) before the payload is validated against any command model. - -`skills` narrows the turn rather than being ignored: the selection is intersected with the workspace allowlist, so a turn that names skills gives `read_skill` only those. Omitting it, or sending an empty list, inherits the workspace's full visible set. A turn selection can never exceed what the workspace permits. - -Other client types include `subscribe_turn`, `subscribe_session`, `resume_from`, `unsubscribe`, `cancel_turn`, `submit_user_reply`, `regenerate`, and `ping`; subscriptions replay after `after_seq` and terminal turns end with `done` (`error` first on failure). - -Typical received events: - -```json -{"type":"stage_start","stage":"responding"} -{"type":"tool_call","content":"rag","metadata":{"args":{"query":"chain rule","kb_name":"math"}}} -{"type":"tool_result","content":"...","metadata":{"tool":"rag"}} -{"type":"content","content":"## Solution\n\nThe derivative..."} -{"type":"stage_end","stage":"responding"} -{"type":"done","session_id":"sess_abc123","turn_id":"turn_xyz789","metadata":{"status":"completed"}} -``` - -## WebSocket endpoints - -```text -WS /ws -WS /ws/books -WS /ws/questions/mimic -WS /ws/questions/generate -WS /ws/questions/judge -WS /ws/knowledge-bases/{kb_name}/progress -WS /ws/mastery-paths -WS /ws/partners/{partner_id} -WS /ws/partner-groups/{group_id} -``` - -The legacy `/api/v1/chat`, `/api/v1/ws`, and feature-specific API-prefixed sockets are removed. The list above is the complete canonical WebSocket namespace; `/ws` handles all turn capabilities, replay, cancellation, regeneration, and `ask_user` replies. - -## Sessions - -```text -GET /api/sessions List sessions -GET /api/sessions/{session_id} Get a session + messages -PATCH /api/sessions/{session_id} Rename (body: {"title":"..."}) -DELETE /api/sessions/{session_id} Delete -PUT /api/sessions/{session_id}/branch-selection -DELETE /api/sessions/{session_id}/messages/{message_id} -POST /api/sessions/{session_id}/quiz-results -``` - -Additional session-state endpoints: - -```text -GET /api/sessions/{session_id}/ask-hint -PATCH /api/sessions/{session_id}/organization -``` - -## Knowledge Bases - -```text -GET /api/knowledge-bases List KBs -GET /api/knowledge-bases/{kb_name} KB info -DELETE /api/knowledge-bases/{kb_name} Delete -POST /api/knowledge-bases Create a KB -POST /api/knowledge-bases/{kb_name}/upload Add documents -POST /api/knowledge-bases/{kb_name}/reindex Re-embed docs -GET /api/knowledge-bases/default Get default KB -PUT /api/knowledge-bases/default/{kb_name} Set default KB -GET /api/knowledge-bases/supported-file-types Supported uploads -GET /api/knowledge-bases/{kb_name}/files List source files -GET /api/knowledge-bases/{kb_name}/files/{filename} Serve a source file (preview / download) -GET /api/knowledge-bases/{kb_name}/file-preview-text/{filename} Extracted plain-text preview -GET /api/knowledge-bases/{kb_name}/progress Indexing progress -WS /ws/knowledge-bases/{kb_name}/progress `task_id` replays terminal; orphan → `knowledge_task_interrupted` -``` - -Ad-hoc KB search is exposed through the RAG runtime/tool path rather than a dedicated `POST /knowledge/{name}/search` route in the current API. From CLI, use `deeptutor kb search `. - -## Notebook - -```text -GET /api/notebooks -GET /api/notebooks/statistics -POST /api/notebooks -GET /api/notebooks/{notebook_id} -PUT /api/notebooks/{notebook_id} -DELETE /api/notebooks/{notebook_id} -POST /api/notebooks/actions/add-record -POST /api/notebooks/actions/add-record-with-summary -DELETE /api/notebooks/{notebook_id}/records/{record_id} -PUT /api/notebooks/{notebook_id}/records/{record_id} -POST /api/notebooks/{notebook_id}/records/{record_id}/actions/copy -POST /api/notebooks/{notebook_id}/records/{record_id}/actions/move -GET /api/notebooks/{notebook_id}/export -``` - -## Memory - -```text -GET /api/memory/overview -GET /api/memory/doc/{layer}/{key} -PUT /api/memory/doc/{layer}/{key} -POST /api/memory/doc/{layer}/{key}/reset -POST /api/memory/doc/{layer}/{key}/update -POST /api/memory/doc/{layer}/{key}/audit -POST /api/memory/doc/{layer}/{key}/dedup -POST /api/memory/runs/start -GET /api/memory/runs -GET /api/memory/runs/{run_id} -GET /api/memory/runs/{run_id}/events?since=N Absolute N = last_seen_seq + 1 -POST /api/memory/runs/{run_id}/cancel -POST /api/memory/runs/{run_id}/undo -GET /api/memory/trace/{surface} -DELETE /api/memory/trace/{surface} -GET /api/memory/settings -PUT /api/memory/settings -``` - -Layers are `L2` and `L3`; examples: `/api/memory/doc/L3/profile` and `/api/memory/doc/L2/chat`. - -## Settings, tools, visualizers, and system - -```text -GET /api/settings -GET /api/settings/catalog -PUT /api/settings/catalog -POST /api/settings/apply -POST /api/settings/model-capabilities -PUT /api/settings/enabled-tools -GET /api/tools -GET /api/system/status -GET /api/system/memory -GET /api/system/runtime -GET /api/system/update -POST /api/system/update/check -PUT /api/system/update/settings -GET /api/system/update/job -POST /api/system/update -POST /api/system/test/llm -POST /api/system/test/embeddings -POST /api/system/test/search -GET /api/visualizers/list -POST /api/visualizers/bundled/{visualizer_id}/install -POST /api/visualizers/{visualizer_id}/enable -POST /api/visualizers/{visualizer_id}/disable -DELETE /api/visualizers/{visualizer_id} -POST /api/visualizers/import -GET /api/visualizers/{visualizer_id}/assets/{asset_path} -``` - -Provider profiles are edited through the catalog endpoints; there are not separate `/settings/llm` or `/settings/embedding` routes in the current API. Capabilities run through the unified WebSocket/CLI contracts. Visualizer imports are declarative browser packages, not executable backend plugins. - -## Partners Manager - -```text -GET /api/partners -POST /api/partners -GET /api/partners/recent -GET /api/partners/channels/schema -GET /api/partners/tool-options -GET /api/partners/souls -POST /api/partners/souls -GET /api/partners/soul-sources -GET /api/partners/{partner_id} -PATCH /api/partners/{partner_id} -POST /api/partners/{partner_id}/start -POST /api/partners/{partner_id}/stop -DELETE /api/partners/{partner_id} -POST /api/partners/{partner_id}/channels/reload -GET /api/partners/{partner_id}/channels/status -POST /api/partners/{partner_id}/channel-onboarding/start -GET /api/partners/{partner_id}/channel-onboarding/{session_id} -DELETE /api/partners/{partner_id}/channel-onboarding/{session_id} -POST /api/partners/{partner_id}/channel-onboarding/{session_id}/apply -GET /api/partners/{partner_id}/soul -PUT /api/partners/{partner_id}/soul -GET /api/partners/{partner_id}/assets -POST /api/partners/{partner_id}/assets -DELETE /api/partners/{partner_id}/assets/{asset_type}/{name} -GET /api/partners/{partner_id}/history -GET /api/partners/{partner_id}/sessions -POST /api/partners/{partner_id}/sessions/archive -POST /api/partners/{partner_id}/sessions/resume -POST /api/partners/{partner_id}/sessions/delete -POST /api/partners/{partner_id}/sessions/branch -POST /api/partners/{partner_id}/chat -POST /api/partners/{partner_id}/chat/execute-stream -WS /ws/partners/{partner_id} -``` - -Authenticated users may create Partners. Resource routes enforce **use** or **manage** rights; owners/admins manage, while grants can be conversation-only. Secrets are masked unless manageable callers request `include_secrets=true`. - -## Book Engine - -```text -GET /api/books -POST /api/books -GET /api/books/block-types Available generated content types -GET /api/books/{book_id} -GET /api/books/{book_id}/spine -GET /api/books/{book_id}/pages/{page_id} -DELETE /api/books/{book_id} -POST /api/books/confirm-proposal -POST /api/books/confirm-spine -POST /api/books/compile-page -POST /api/books/pause Persist, cancel work, keep completed pages -POST /api/books/resume Queue unfinished pages only -POST /api/books/{book_id}/refresh-fingerprints -WS /ws/books Subscribe with `after_seq`; may acknowledge reset -``` - -## Immersive Reading - -```text -GET /api/reading/supported-formats Extensions, size cap, raw-view formats -GET /api/reading/materials List this account's materials -POST /api/reading/materials Upload a document (multipart) -GET /api/reading/materials/{material_id} Manifest: unit kind, unit count, outline -DELETE /api/reading/materials/{material_id} Forget a material -GET /api/reading/materials/{material_id}/units/{locator} One unit's text -GET /api/reading/materials/{material_id}/revisions Prior immutable URL snapshots -GET /api/reading/materials/{material_id}/revisions/{revision}/units/{locator} -GET /api/reading/materials/{material_id}/raw Original bytes (PDF) -GET /api/reading/materials/{material_id}/assets/{asset_name} Authenticated snapshot image -GET /api/reading/materials/{material_id}/bookmarks List bookmarks -POST /api/reading/materials/{material_id}/bookmarks Save a bookmark -DELETE /api/reading/materials/{material_id}/bookmarks/{bookmark_id} -GET /api/reading/materials/{material_id}/annotations List annotations -PUT /api/reading/materials/{material_id}/annotations Create or update one; returns AnnotationInfo -DELETE /api/reading/materials/{material_id}/annotations/{id} Delete one -GET /api/reading/materials/{material_id}/export?fmt=auto|pdf|markdown -``` - -A material is content-addressed: uploading the same bytes twice returns the same `material_id` and keeps the annotations already on it. `export?fmt=pdf` returns the original file with real PDF annotations written in, and is only available for materials that kept their raw bytes. - -URL refreshes preserve immutable prior revisions. Snapshot assets are authenticated, MIME-sniffed, and served with `nosniff` rather than exposing a live third-party page inside the reader. - -## Immersive Watching - -```text -GET /api/settings/video-learning -PUT /api/settings/video-learning -POST /api/settings/video-learning/test-invidious -POST /api/video-learning/materials/resolve -GET /api/video-learning/materials/{material_id} -PUT /api/video-learning/materials/{material_id}/progress -GET /api/video-learning/materials/{material_id}/subtitles.vtt -GET|HEAD /api/video-learning/materials/{material_id}/stream/{format_id} -``` - -These compatibility endpoints retain YouTube playback, transcript cues, and provider-independent progress. Current video sessions use Reading; legacy Watching sessions migrate when reopened. Resolve accepts a YouTube URL and optional language/provider override; VTT returns normalized cues. - -## Other routers - -Not every surface is expanded above. These exist and follow the same conventions; use `/openapi.json` for their schemas: - -```text -/api/skills Skill library and hub installs -/api/personas Persona presets -/api/plugins Managed plugin lifecycle and approvals -/api/learning-journal Workspace missions, handoffs, and confirmed records -/api/documents Co-Writer documents and edit streams -/api/mastery-paths Mastery paths, objectives, and progress -/api/subagents Connected agent configuration -/api/imports Claude Code / Codex conversation import -/api/space/mcp Per-account MCP services and the curated catalog -/api/space/cli-apps CLI app catalog, installs, and grants -/api/voice Text-to-speech and speech-to-text -/api/dashboard Recent activity, starter suggestions/refresh, and activity detail -``` - -## Outputs and attachments - -User-generated artifacts are served by an authenticated, request-scoped router: - -```text -GET /files/outputs/ -``` - -Requests resolve allowlisted files in the caller's or one visible Partner workspace; invalid/private/traversal paths fail closed. Original chat attachments are served under: - -```text -GET /files/attachments/{session_id}/{attachment_id}/{filename} -``` - -## Generate a typed client - -```bash -curl http://localhost:8001/openapi.json > deeptutor.openapi.json - -# TypeScript client -npx openapi-typescript deeptutor.openapi.json -o deeptutor.d.ts - -# Python client -pip install openapi-python-client -openapi-python-client generate --path deeptutor.openapi.json -``` diff --git a/docs/src/content/docs/explore/subagents.md b/docs/src/content/docs/customize/agents.md similarity index 95% rename from docs/src/content/docs/explore/subagents.md rename to docs/src/content/docs/customize/agents.md index b754ee46f..ab1456a82 100644 --- a/docs/src/content/docs/explore/subagents.md +++ b/docs/src/content/docs/customize/agents.md @@ -70,6 +70,6 @@ Imported agents show their source, conversation count, and last sync time. From ## See also -- [Home](/explore/chat-workspace/) — where you consult and reference agents -- [Partners](/explore/partners/) — connect a Partner as a consultable agent -- [Memory](/explore/memory/) — how imported context is kept separable from DeepTutor's own voice +- [Home](/learning-workspace/chat/) — where you consult and reference agents +- [Partners](/channels/) — connect a Partner as a consultable agent +- [Memory](/learning-workspace/memory/) — how imported context is kept separable from DeepTutor's own voice diff --git a/docs/src/content/docs/ecosystem/cli-apps.md b/docs/src/content/docs/customize/cli-apps.md similarity index 94% rename from docs/src/content/docs/ecosystem/cli-apps.md rename to docs/src/content/docs/customize/cli-apps.md index 21db72a9d..91eef8a99 100644 --- a/docs/src/content/docs/ecosystem/cli-apps.md +++ b/docs/src/content/docs/customize/cli-apps.md @@ -47,7 +47,7 @@ Administrators manage the installed environment and enabled state. If an update ## See also -- [MCP Services](/ecosystem/mcp/) — connect remote tools without installing host code -- [Home](/explore/chat-workspace/) — where permitted CLI Apps become callable tools -- [Multi-User Deployment](/get-started/multi-user/) — grant apps to accounts +- [MCP Services](/customize/mcp/) — connect remote tools without installing host code +- [Home](/learning-workspace/chat/) — where permitted CLI Apps become callable tools +- [Multi-User Deployment](/self-hosting/multi-user/) — grant apps to accounts diff --git a/docs/src/content/docs/ecosystem/eduhub.md b/docs/src/content/docs/customize/eduhub.md similarity index 92% rename from docs/src/content/docs/ecosystem/eduhub.md rename to docs/src/content/docs/customize/eduhub.md index 56ba37213..deca0035b 100644 --- a/docs/src/content/docs/ecosystem/eduhub.md +++ b/docs/src/content/docs/customize/eduhub.md @@ -48,7 +48,7 @@ deeptutor skill install clawhub: ## See also -- [Skills](/ecosystem/skills/) — how Skills work after they enter DeepTutor -- [CLI commands](/cli/commands/) — full Skill command reference -- [DeepTutor Ecosystem](/ecosystem/) — compare Skills with MCP Services and CLI Apps +- [Skills](/customize/skills/) — how Skills work after they enter DeepTutor +- [CLI commands](/developers/reference/cli/) — full Skill command reference +- [DeepTutor Ecosystem](/customize/) — compare Skills with MCP Services and CLI Apps diff --git a/docs/src/content/docs/customize/index.md b/docs/src/content/docs/customize/index.md new file mode 100644 index 000000000..fb1cba0af --- /dev/null +++ b/docs/src/content/docs/customize/index.md @@ -0,0 +1,23 @@ +--- +title: Customize +description: How account-level personas, skills, and connections relate to a workspace. +quadrant: explanation +--- + +**Personalization** is the account shelf. A workspace holds the work: conversations, learning activities, and materials. The shelf supplies ways of working that stay available when you switch workspaces. A workspace still decides which of those resources a turn may use, and a conversation can narrow that further. Nothing on the shelf is visible to another account. + +| You keep it here | It is | +| --- | --- | +| [Personas](/customize/personas/) | A voice and a response policy for a turn | +| [My Agents](/customize/agents/) | A connected harness, or an imported transcript you can consult | +| [Skills](/customize/skills/) | A reusable procedure the model reads when the task calls for it | +| [MCP services](/customize/mcp/) | Tools from a remote server, authorized on the account | +| [CLI Apps](/customize/cli-apps/) | A program an administrator installed, run in a sandbox | +| [Memory](/learning-workspace/memory/) | Preferences and summaries you can open and correct | +| [EduHub](/customize/eduhub/) | Community skills you review before import | + +Retrieval is not one of those account objects. A [RAG integration](/customize/rag/) belongs to a knowledge base and the files that base indexes. + +Each path has its own trust boundary. A skill is instructions. An MCP service is a remote tool boundary. A CLI app is code on the host. EduHub distributes skills and does not run them. The workspace assignment references the account catalog. It does not copy credentials or bypass a per-user grant. + +A partner can start from a persona, then keep its own soul, library, and channels. That identity is the partner's, so later edits to the persona do not rewrite it. See [Channels](/channels/). diff --git a/docs/src/content/docs/ecosystem/mcp.md b/docs/src/content/docs/customize/mcp.md similarity index 94% rename from docs/src/content/docs/ecosystem/mcp.md rename to docs/src/content/docs/customize/mcp.md index 8dcbded7b..e6550eb30 100644 --- a/docs/src/content/docs/ecosystem/mcp.md +++ b/docs/src/content/docs/customize/mcp.md @@ -50,7 +50,7 @@ Disabling or removing a server makes its tools unavailable. Review its reference ## See also -- [Skills](/ecosystem/skills/) — instruction-only workflow extensions -- [CLI Apps](/ecosystem/cli-apps/) — sandboxed command-line tools installed on the deployment -- [Multi-User Deployment](/get-started/multi-user/) — edit per-account grants +- [Skills](/customize/skills/) — instruction-only workflow extensions +- [CLI Apps](/customize/cli-apps/) — sandboxed command-line tools installed on the deployment +- [Multi-User Deployment](/self-hosting/multi-user/) — edit per-account grants diff --git a/docs/src/content/docs/customize/personas.md b/docs/src/content/docs/customize/personas.md new file mode 100644 index 000000000..1d0c889a3 --- /dev/null +++ b/docs/src/content/docs/customize/personas.md @@ -0,0 +1,24 @@ +--- +title: Personas +description: Create one persona and use it for a chat turn. +quadrant: how-to +--- + +A persona is an account-level preset: a name, a short description, and Markdown instructions for voice and pedagogy. The capability you select still decides the task. A persona only changes how that task is carried. + +## Create one and try it + +1. Open **Personalization → Personas**. +2. Create a preset. Name it, add a one-line description, and write behavior you can test. “Ask for my next step before showing a solution” is a usable instruction. +3. Save. +4. In [Chat](/learning-workspace/chat/), choose that persona in the composer and ask one short question. +5. If the reply ignores the instruction, edit the preset and ask again. Delete the preset when you no longer want it. + +`Default` is the plain assistant. Built-ins such as **peer**, **research-assistant**, and **teacher** are available before you create your own. On a shared deployment, deployment presets are read-only for ordinary users. Your own persona with the same name takes precedence. + +The same preset can be the starting text for a partner's soul. Creating the partner copies it. Later edits to the persona do not change that partner. Connect the partner in [Channels](/channels/). + +## See also + +- [Customize](/customize/) — where a persona sits relative to skills and memory +- [Chat](/learning-workspace/chat/) — the composer control diff --git a/docs/src/content/docs/ecosystem/rag-integration.md b/docs/src/content/docs/customize/rag.md similarity index 88% rename from docs/src/content/docs/ecosystem/rag-integration.md rename to docs/src/content/docs/customize/rag.md index 9bf688406..46f220f4a 100644 --- a/docs/src/content/docs/ecosystem/rag-integration.md +++ b/docs/src/content/docs/customize/rag.md @@ -4,7 +4,7 @@ description: Choose how DeepTutor retrieves from local indexes, agentic document quadrant: how-to --- -DeepTutor treats retrieval as an ecosystem boundary rather than one hard-coded vector store. A Knowledge Base in the [Knowledge Center](/explore/knowledge/) is the user-facing container; its **RAG integration** decides how material is indexed, queried, cited, and kept in sync. +DeepTutor treats retrieval as an ecosystem boundary rather than one hard-coded vector store. A Knowledge Base in the [Knowledge Center](/learning-workspace/knowledge/) is the user-facing container; its **RAG integration** decides how material is indexed, queried, cited, and kept in sync. ## Available integrations @@ -55,6 +55,6 @@ LightRAG's extra installs the supported LightRAG SDK only; document parsing rema ## See also -- [Knowledge Center](/explore/knowledge/) — create, version, sync, and use Knowledge Bases -- [Immersive Reading](/explore/reading/) — read one collection directly instead of indexing a corpus -- [Settings](/explore/settings/) — configure embedding providers and document parsing +- [Knowledge Center](/learning-workspace/knowledge/) — create, version, sync, and use Knowledge Bases +- [Immersive Reading](/learning-workspace/reading/) — read one collection directly instead of indexing a corpus +- [Settings](/self-hosting/settings/) — configure embedding providers and document parsing diff --git a/docs/src/content/docs/ecosystem/skills.md b/docs/src/content/docs/customize/skills.md similarity index 90% rename from docs/src/content/docs/ecosystem/skills.md rename to docs/src/content/docs/customize/skills.md index a25f3f420..6f2c0940a 100644 --- a/docs/src/content/docs/ecosystem/skills.md +++ b/docs/src/content/docs/customize/skills.md @@ -16,7 +16,7 @@ A useful skill says **when** to use it, what inputs it expects, the steps or con ## Import from EduHub -Choose **Import from EduHub** to browse and download community Skills directly into your library. Imports cross a security gate before they become available. See [EduHub](/ecosystem/eduhub/) for discovery, review, safety checks, publishing, and version management. +Choose **Import from EduHub** to browse and download community Skills directly into your library. Imports cross a security gate before they become available. See [EduHub](/customize/eduhub/) for discovery, review, safety checks, publishing, and version management. ## Install and publish from the CLI @@ -48,7 +48,7 @@ Keep reusable procedures in the account library and course-specific variations i ## See also -- [Personalization](/explore/personalization/) — the account shelf and workspace selection -- [EduHub](/ecosystem/eduhub/) — discover and publish community Skills -- [MCP Services](/ecosystem/mcp/) — connect tools that run outside DeepTutor -- [CLI commands](/cli/commands/) — full command reference +- [Personalization](/customize/) — the account shelf and workspace selection +- [EduHub](/customize/eduhub/) — discover and publish community Skills +- [MCP Services](/customize/mcp/) — connect tools that run outside DeepTutor +- [CLI commands](/developers/reference/cli/) — full command reference diff --git a/docs/src/content/docs/developers/architecture.md b/docs/src/content/docs/developers/architecture.md new file mode 100644 index 000000000..3a576595f --- /dev/null +++ b/docs/src/content/docs/developers/architecture.md @@ -0,0 +1,23 @@ +--- +title: Architecture +description: How a turn enters DeepTutor and reaches a tool or a capability. +quadrant: explanation +--- + +DeepTutor has three entry points: the CLI, the WebSocket API, and the Python SDK. All three enter the turn application service. That service persists the turn, then the turn engine routes one normalized context to the selected capability. The default capability is `chat`. + +```text +CLI | WebSocket /ws | Python SDK + | + Turn application service + | + Turn engine + / \ + Tool registry Capability registry +``` + +Tools are single functions the model calls during a turn. Capabilities are multi-stage pipelines that own the turn, such as `deep_solve`, `deep_research`, and `visualize`. The registered names, stages, and CLI aliases are in the [capability reference](/developers/reference/capabilities/). + +A running turn speaks the [turn protocol](/developers/reference/turn-protocol/) on `WS /ws`. HTTP routes outside that socket are indexed in the [HTTP API](/developers/reference/http-api/). + +Implementation layout, tests, and module ownership stay in the repository's [architecture notes](https://github.com/HKUDS/DeepTutor/blob/dev/docs-for-dev/ARCHITECTURE.md). This site does not publish that tree. diff --git a/docs/src/content/docs/cli/agent-handoff.md b/docs/src/content/docs/developers/guides/agent-handoff.md similarity index 97% rename from docs/src/content/docs/cli/agent-handoff.md rename to docs/src/content/docs/developers/guides/agent-handoff.md index b752a393b..b8c2ff490 100644 --- a/docs/src/content/docs/cli/agent-handoff.md +++ b/docs/src/content/docs/developers/guides/agent-handoff.md @@ -254,6 +254,6 @@ For RAG-heavy workflows, also allow whatever search provider you've configured ( ## See also -- [**Commands**](/cli/commands/) — full CLI reference -- [**Interactive REPL**](/cli/chat-repl/) — for human-driven sessions -- [**Memory**](/explore/memory/) — how persistent state flows through sessions +- [**Commands**](/developers/reference/cli/) — full CLI reference +- [**Interactive REPL**](/developers/guides/repl/) — for human-driven sessions +- [**Memory**](/learning-workspace/memory/) — how persistent state flows through sessions diff --git a/docs/src/content/docs/cli/index.md b/docs/src/content/docs/developers/guides/cli.md similarity index 92% rename from docs/src/content/docs/cli/index.md rename to docs/src/content/docs/developers/guides/cli.md index fbd863f54..2d0df27da 100644 --- a/docs/src/content/docs/cli/index.md +++ b/docs/src/content/docs/developers/guides/cli.md @@ -8,10 +8,10 @@ DeepTutor is built around an **agent-native CLI**: core runtime surfaces have te This section covers: -- [**Commands**](/cli/commands/) — every top-level command and subcommand group with flags, schemas, and examples -- [**Interactive REPL**](/cli/chat-repl/) — drive a long chat session with `/slash` commands inline -- [**Agent handoff**](/cli/agent-handoff/) — let Claude Code, Codex, OpenCode, or Hermes drive `deeptutor` for you -- [**Server API**](/cli/server-api/) — the HTTP / WebSocket surface that `deeptutor serve` exposes +- [**Commands**](/developers/reference/cli/) — every top-level command and subcommand group with flags, schemas, and examples +- [**Interactive REPL**](/developers/guides/repl/) — drive a long chat session with `/slash` commands inline +- [**Agent handoff**](/developers/guides/agent-handoff/) — let Claude Code, Codex, OpenCode, or Hermes drive `deeptutor` for you +- [**Server API**](/developers/reference/http-api/) — the HTTP / WebSocket surface that `deeptutor serve` exposes Current dev uses the source installation below from the repository root. With the 1.7.x modular family, bare `deeptutor` supplies core chat/SDK; add feature modules or `[full]` for the broader commands. Inspect `deeptutor module list` and `deeptutor plugin list` before using optional capabilities. @@ -75,7 +75,7 @@ This means: | `deeptutor provider` | Provider auth flows | `deeptutor provider login openai-codex` | | `deeptutor book` | Knowledge Books (Guided Learning) | `deeptutor book list / health` | -See [**Commands**](/cli/commands/) for the full reference. +See [**Commands**](/developers/reference/cli/) for the full reference. ## Two modes of use @@ -93,7 +93,7 @@ $ deeptutor chat --kb physics You> Explain the chain rule with a worked example ``` -Full guide: [**Interactive REPL**](/cli/chat-repl/). +Full guide: [**Interactive REPL**](/developers/guides/repl/). ### Mode 2 — Agent-style one-shot @@ -107,7 +107,7 @@ deeptutor run deep_solve "Find the eigenvalues of [[4,1],[2,3]]" \ Each JSON line is one event — `stage_start`, `content`, `tool_call`, `tool_result`, `thinking`, `done`. You can pipe these into a downstream agent or extract the final answer with `jq`. -Full guide: [**Agent handoff**](/cli/agent-handoff/). +Full guide: [**Agent handoff**](/developers/guides/agent-handoff/). ## Where state lives diff --git a/docs/src/content/docs/contributing.md b/docs/src/content/docs/developers/guides/contributing.md similarity index 100% rename from docs/src/content/docs/contributing.md rename to docs/src/content/docs/developers/guides/contributing.md diff --git a/docs/src/content/docs/cli/chat-repl.md b/docs/src/content/docs/developers/guides/repl.md similarity index 97% rename from docs/src/content/docs/cli/chat-repl.md rename to docs/src/content/docs/developers/guides/repl.md index 23c2d12a8..4ea6f6b52 100644 --- a/docs/src/content/docs/cli/chat-repl.md +++ b/docs/src/content/docs/developers/guides/repl.md @@ -99,7 +99,7 @@ $ Valid names: `chat`, `ask_questions`, `deep_solve`, `deep_question`, `deep_research`, `visualize`, `math_animator`, `mastery_path`, `immersive_reading`, `video_lesson`, `audio_overview`. CLI aliases also work — `ask`, `solve`, `quiz`, `research`, `viz`, `animate`, `mastery`, `reading` / `read`, `lesson`, and `audio-overview` / `overview`. -Note that `immersive_reading` runs the loop without a reader: the CLI has no viewport to scroll and no selection to act on, so use it for the web UI (see [Immersive Reading](/explore/reading/)). +Note that `immersive_reading` runs the loop without a reader: the CLI has no viewport to scroll and no selection to act on, so use it for the web UI (see [Immersive Reading](/learning-workspace/reading/)). ```text You> /cap deep_solve @@ -268,5 +268,5 @@ deeptutor notebook add-md my-answer.md --title "Chain rule explana ## See also -- [**Commands**](/cli/commands/) — full reference for `run`, `kb`, `partner`, etc. -- [**Agent handoff**](/cli/agent-handoff/) — letting an agent do this for you +- [**Commands**](/developers/reference/cli/) — full reference for `run`, `kb`, `partner`, etc. +- [**Agent handoff**](/developers/guides/agent-handoff/) — letting an agent do this for you diff --git a/docs/src/content/docs/cli/python-sdk.md b/docs/src/content/docs/developers/guides/sdk.md similarity index 91% rename from docs/src/content/docs/cli/python-sdk.md rename to docs/src/content/docs/developers/guides/sdk.md index 4a2aaba54..bfdd97b18 100644 --- a/docs/src/content/docs/cli/python-sdk.md +++ b/docs/src/content/docs/developers/guides/sdk.md @@ -68,6 +68,6 @@ Use the **CLI** for shell pipelines and agent handoff, the **Python SDK** for an ## See also -- [Agent Handoff](/cli/agent-handoff/) — consume the same stream as NDJSON -- [Server API](/cli/server-api/) — connect across a process or network boundary -- [Command Reference](/cli/commands/) — configure and inspect the shared workspace +- [Agent Handoff](/developers/guides/agent-handoff/) — consume the same stream as NDJSON +- [Server API](/developers/reference/http-api/) — connect across a process or network boundary +- [Command Reference](/developers/reference/cli/) — configure and inspect the shared workspace diff --git a/docs/src/content/docs/developers/reference/capabilities.md b/docs/src/content/docs/developers/reference/capabilities.md new file mode 100644 index 000000000..d681a72ab --- /dev/null +++ b/docs/src/content/docs/developers/reference/capabilities.md @@ -0,0 +1,21 @@ +--- +title: Capabilities +description: Registered capability names, stages, owning modules, and CLI aliases. +quadrant: reference +--- + +Names, stages, and CLI aliases come from each capability `manifest` in `deeptutor/modules/manifests/*.json`. + +| Capability | Module | Stages | CLI | Description | +| --- | --- | --- | --- | --- | +| `audio_overview` | `audio-overview` | `retrieving`, `script_writing`, `voice_generation`, `publishing` | `audio-overview`, `overview` | Create a grounded two-voice audio overview and transcript from a knowledge base. | +| `chat` | `core` | `exploring`, `responding` | `chat` | Agentic chat: an exploring agent loop with tools, followed by a respond stage that streams the answer. | +| `ask_questions` | `core` | `responding` | `ask` | Ask the user high-value questions to fill in missing context, then complete the original request with their answers. | +| `mastery_path` | `mastery` | `responding` | `mastery` | Mastery-based tutoring: a dedicated agent loop drives an adaptive mastery path with a hard, per-type mastery gate and spaced review. | +| `deep_question` | `questions` | `ideation`, `generation` | `quiz` | Fast question generation (Template batches -> Generate). | +| `immersive_reading` | `reading` | `responding` | `reading`, `read` | Read a document alongside the assistant, which cites the exact page or section behind every claim. | +| `math_animator` | `renderer-manim` | `concept_analysis`, `concept_design`, `code_generation`, `code_retry`, `summary`, `render_output` | `animate` | Generate math animations or storyboard images with Manim. | +| `deep_research` | `research` | `rephrasing`, `decomposing`, `researching`, `reporting` | `research` | Agentic-loop deep research with iterative report generation. | +| `deep_solve` | `solve` | `responding` | `solve` | Multi-step problem solving driven by the chat agent loop. | +| `video_lesson` | `video-lesson` | `code_generation`, `render_check`, `render_output` | `lesson` | Generate an animated video lesson (Remotion) that plays in the browser. | +| `visualize` | `visualize` | `analyzing`, `generating`, `reviewing`, `concept_analysis`, `concept_design`, `code_generation`, `code_retry`, `summary`, `render_output` | `visualize`, `viz` | Generate a validated visualization with any installed visualizer type, or render a Manim animation/storyboard artifact. | diff --git a/docs/src/content/docs/cli/commands.md b/docs/src/content/docs/developers/reference/cli.md similarity index 96% rename from docs/src/content/docs/cli/commands.md rename to docs/src/content/docs/developers/reference/cli.md index f82174ad4..38b7d7892 100644 --- a/docs/src/content/docs/cli/commands.md +++ b/docs/src/content/docs/developers/reference/cli.md @@ -4,7 +4,7 @@ description: Common deeptutor commands — flags, output schemas, examples. quadrant: reference --- -This page documents commonly used `deeptutor` subcommands and flags. For interactive REPL usage, see [**Interactive REPL**](/cli/chat-repl/). For automation patterns, see [**Agent handoff**](/cli/agent-handoff/). +This page documents commonly used `deeptutor` subcommands and flags. For interactive REPL usage, see [**Interactive REPL**](/developers/guides/repl/). For automation patterns, see [**Agent handoff**](/developers/guides/agent-handoff/). ## `deeptutor run` — single-turn capability execution @@ -97,7 +97,7 @@ Drop into an interactive chat session with `/slash` commands for in-session conf deeptutor chat [options] ``` -Options mirror the turn-shaping flags from `run`: `--session`, `--tool / -t`, `--capability / -c`, `--kb`, `--notebook-ref`, `--history-ref`, `--language / -l`, `--config`, and `--config-json`. Full walkthrough at [**Interactive REPL**](/cli/chat-repl/). +Options mirror the turn-shaping flags from `run`: `--session`, `--tool / -t`, `--capability / -c`, `--kb`, `--notebook-ref`, `--history-ref`, `--language / -l`, `--config`, and `--config-json`. Full walkthrough at [**Interactive REPL**](/developers/guides/repl/). ## `deeptutor init` — guided setup wizard @@ -406,7 +406,7 @@ Only `create` takes a notebook name, and `list` takes no argument at all. The ot ## `deeptutor memory` — three-layer memory -DeepTutor stores user memory in three layers (see [**Memory**](/explore/memory/) for the deep dive): +DeepTutor stores user memory in three layers (see [**Memory**](/learning-workspace/memory/) for the deep dive): - **L1** — raw event trace per surface (chat, notebook, quiz, etc.) - **L2** — per-surface curated markdown summaries @@ -456,7 +456,7 @@ deeptutor partner start math-tutor Subcommands: `list`, `create`, `start`, `stop`. `create` writes partner config and attempts to start the partner. The Web UI is the recommended place to configure channel schemas, assets, tools, and secrets; the CLI is best for listing, creating, starting, and stopping. -Partners run inside `data/partners//workspace/`. See [**Partners & Channels**](/partners/) for channel setup. +Partners run inside `data/partners//workspace/`. See [**Partners & Channels**](/channels/) for channel setup. ## `deeptutor config show` @@ -581,7 +581,7 @@ deeptutor book health book_abc123 deeptutor book refresh-fingerprints book_abc123 ``` -Books are the storage layer for **Guided Learning** journeys. See [**Interactive Book**](/explore/book/). +Books are the storage layer for **Guided Learning** journeys. See [**Interactive Book**](/learning-workspace/books/). ## `deeptutor workspace` — Content Workspace @@ -596,7 +596,7 @@ deeptutor workspace set /absolute/path/to/my-folder deeptutor workspace reset ``` -The content workspace is the one folder agents may read; everything they create lands in its `outputs/`. `show` prints the path, its status, and the output security level — the strength of the boundary that keeps execution out of the rest of the folder. On Docker and server deployments the path is fixed at startup and `set` is refused. See [**Chat workspace**](/explore/chat-workspace/). +The content workspace is the one folder agents may read; everything they create lands in its `outputs/`. `show` prints the path, its status, and the output security level — the strength of the boundary that keeps execution out of the rest of the folder. On Docker and server deployments the path is fixed at startup and `set` is refused. See [**Chat workspace**](/learning-workspace/chat/). ## Common output schemas @@ -640,6 +640,6 @@ class TurnRequest(BaseModel): ## See also -- [**Interactive REPL**](/cli/chat-repl/) — using `deeptutor chat` day-to-day -- [**Agent handoff**](/cli/agent-handoff/) — letting Claude Code / Codex drive the CLI -- [**Server API**](/cli/server-api/) — the HTTP / WebSocket surface from `deeptutor serve` +- [**Interactive REPL**](/developers/guides/repl/) — using `deeptutor chat` day-to-day +- [**Agent handoff**](/developers/guides/agent-handoff/) — letting Claude Code / Codex drive the CLI +- [**Server API**](/developers/reference/http-api/) — the HTTP / WebSocket surface from `deeptutor serve` diff --git a/docs/src/content/docs/developers/reference/http-api.md b/docs/src/content/docs/developers/reference/http-api.md new file mode 100644 index 000000000..92d58d091 --- /dev/null +++ b/docs/src/content/docs/developers/reference/http-api.md @@ -0,0 +1,1404 @@ +--- +title: HTTP API +description: The HTTP and WebSocket surface exposed by deeptutor serve -- for custom frontends and integrations. +quadrant: reference +--- + +`deeptutor serve` exposes a FastAPI backend at `http://localhost:8001/` unless you configured a different backend port. This page gives the high-signal map for custom frontends, mobile apps, and service-to-service integrations. Turn commands and events are specified in the [turn protocol](/developers/reference/turn-protocol/). + +For the exhaustive, always-current schema, start the server and open: + +```text +GET /openapi.json # Full OpenAPI 3.1 spec +GET /docs # Interactive Swagger UI +GET /redoc # Alternative ReDoc UI +``` + +## Starting the server + +```bash +# Backend only. Port comes from data/user/settings/system.json, default 8001. +deeptutor serve + +# Custom host/port for this process +deeptutor serve --host 127.0.0.1 --port 18001 + +# Development: hot reload on Python file changes +deeptutor serve --reload +``` + +## Authentication + +When enabled, protected routes require a Bearer JWT or `dt_token` cookie. Auth routes mix public login/bootstrap and guarded profile/admin endpoints; `GET /api/settings/ui` is public. MarginNote `/sync` and `/heartbeat` use `Authorization: MarginNote :`. + +```bash +# Login +curl -X POST http://localhost:8001/api/auth/login \ + -c cookies.txt \ + -H "Content-Type: application/json" \ + -d '{"username":"alice","password":"..."}' + +# Response contains user metadata; the JWT is set in the dt_token cookie. + +# Reuse the cookie +curl -b cookies.txt http://localhost:8001/api/sessions +``` + +If auth is disabled, auth dependencies are no-ops and local single-user requests do not need a token. + +## Turn execution WebSocket + +```text +WS /ws +``` + +This is the unified turn WebSocket used by the Web UI. It supports every capability uniformly and streams the same event family that `deeptutor run --format json` prints. + +Start a turn by sending a `type: "start_turn"` or `type: "message"` payload: + +```json +{ + "type": "start_turn", + "protocol_version": "2.0", + "content": "Find d/dx [sin(x^2)]", + "capability": "deep_solve", + "session_id": null, + "tools": ["reason"], + "knowledge_bases": ["math"], + "language": "en", + "config": {}, + "notebook_references": [], + "history_references": [], + "partner_group_references": [], + "attachments": [] +} +``` + +The example above shows the payload for one turn. Every client frame on `/ws` must also carry `"protocol_version": "2.0"` — `start_turn`, `subscribe_turn`, `cancel_turn`, `ping`, and the rest. A frame that omits it is rejected with a `protocol_error` event (`error_code: "unsupported_protocol_version"`) before the payload is validated against any command model. + +`skills` narrows the turn rather than being ignored: the selection is intersected with the workspace allowlist, so a turn that names skills gives `read_skill` only those. Omitting it, or sending an empty list, inherits the workspace's full visible set. A turn selection can never exceed what the workspace permits. + +Other client types include `subscribe_turn`, `subscribe_session`, `resume_from`, `unsubscribe`, `cancel_turn`, `submit_user_reply`, `regenerate`, and `ping`; subscriptions replay after `after_seq` and terminal turns end with `done` (`error` first on failure). + +Typical received events: + +```json +{"type":"stage_start","stage":"responding"} +{"type":"tool_call","content":"rag","metadata":{"args":{"query":"chain rule","kb_name":"math"}}} +{"type":"tool_result","content":"...","metadata":{"tool":"rag"}} +{"type":"content","content":"## Solution\n\nThe derivative..."} +{"type":"stage_end","stage":"responding"} +{"type":"done","session_id":"sess_abc123","turn_id":"turn_xyz789","metadata":{"status":"completed"}} +``` + +## WebSocket endpoints + +```text +WS /ws +WS /ws/books +WS /ws/questions/mimic +WS /ws/questions/generate +WS /ws/questions/judge +WS /ws/knowledge-bases/{kb_name}/progress +WS /ws/mastery-paths +WS /ws/partners/{partner_id} +WS /ws/partner-groups/{group_id} +``` + +The legacy `/api/v1/chat`, `/api/v1/ws`, and feature-specific API-prefixed sockets are removed. The list above is the complete canonical WebSocket namespace; `/ws` handles all turn capabilities, replay, cancellation, regeneration, and `ask_user` replies. + +## Sessions + +```text +GET /api/sessions List sessions +GET /api/sessions/{session_id} Get a session + messages +PATCH /api/sessions/{session_id} Rename (body: {"title":"..."}) +DELETE /api/sessions/{session_id} Delete +PUT /api/sessions/{session_id}/branch-selection +DELETE /api/sessions/{session_id}/messages/{message_id} +POST /api/sessions/{session_id}/quiz-results +``` + +Additional session-state endpoints: + +```text +GET /api/sessions/{session_id}/ask-hint +PATCH /api/sessions/{session_id}/organization +``` + +## Knowledge Bases + +```text +GET /api/knowledge-bases List KBs +GET /api/knowledge-bases/{kb_name} KB info +DELETE /api/knowledge-bases/{kb_name} Delete +POST /api/knowledge-bases Create a KB +POST /api/knowledge-bases/{kb_name}/upload Add documents +POST /api/knowledge-bases/{kb_name}/reindex Re-embed docs +GET /api/knowledge-bases/default Get default KB +PUT /api/knowledge-bases/default/{kb_name} Set default KB +GET /api/knowledge-bases/supported-file-types Supported uploads +GET /api/knowledge-bases/{kb_name}/files List source files +GET /api/knowledge-bases/{kb_name}/files/{filename} Serve a source file (preview / download) +GET /api/knowledge-bases/{kb_name}/file-preview-text/{filename} Extracted plain-text preview +GET /api/knowledge-bases/{kb_name}/progress Indexing progress +WS /ws/knowledge-bases/{kb_name}/progress `task_id` replays terminal; orphan → `knowledge_task_interrupted` +``` + +Ad-hoc KB search is exposed through the RAG runtime/tool path rather than a dedicated `POST /knowledge/{name}/search` route in the current API. From CLI, use `deeptutor kb search `. + +## Notebook + +```text +GET /api/notebooks +GET /api/notebooks/statistics +POST /api/notebooks +GET /api/notebooks/{notebook_id} +PUT /api/notebooks/{notebook_id} +DELETE /api/notebooks/{notebook_id} +POST /api/notebooks/actions/add-record +POST /api/notebooks/actions/add-record-with-summary +DELETE /api/notebooks/{notebook_id}/records/{record_id} +PUT /api/notebooks/{notebook_id}/records/{record_id} +POST /api/notebooks/{notebook_id}/records/{record_id}/actions/copy +POST /api/notebooks/{notebook_id}/records/{record_id}/actions/move +GET /api/notebooks/{notebook_id}/export +``` + +## Memory + +```text +GET /api/memory/overview +GET /api/memory/doc/{layer}/{key} +PUT /api/memory/doc/{layer}/{key} +POST /api/memory/doc/{layer}/{key}/reset +POST /api/memory/doc/{layer}/{key}/update +POST /api/memory/doc/{layer}/{key}/audit +POST /api/memory/doc/{layer}/{key}/dedup +POST /api/memory/runs/start +GET /api/memory/runs +GET /api/memory/runs/{run_id} +GET /api/memory/runs/{run_id}/events?since=N Absolute N = last_seen_seq + 1 +POST /api/memory/runs/{run_id}/cancel +POST /api/memory/runs/{run_id}/undo +GET /api/memory/trace/{surface} +DELETE /api/memory/trace/{surface} +GET /api/memory/settings +PUT /api/memory/settings +``` + +Layers are `L2` and `L3`; examples: `/api/memory/doc/L3/profile` and `/api/memory/doc/L2/chat`. + +## Settings, tools, visualizers, and system + +```text +GET /api/settings +GET /api/settings/catalog +PUT /api/settings/catalog +POST /api/settings/apply +POST /api/settings/model-capabilities +PUT /api/settings/enabled-tools +GET /api/tools +GET /api/system/status +GET /api/system/memory +GET /api/system/runtime +GET /api/system/update +POST /api/system/update/check +PUT /api/system/update/settings +GET /api/system/update/job +POST /api/system/update +POST /api/system/test/llm +POST /api/system/test/embeddings +POST /api/system/test/search +GET /api/visualizers/list +POST /api/visualizers/bundled/{visualizer_id}/install +POST /api/visualizers/{visualizer_id}/enable +POST /api/visualizers/{visualizer_id}/disable +DELETE /api/visualizers/{visualizer_id} +POST /api/visualizers/import +GET /api/visualizers/{visualizer_id}/assets/{asset_path} +``` + +Provider profiles are edited through the catalog endpoints; there are not separate `/settings/llm` or `/settings/embedding` routes in the current API. Capabilities run through the unified WebSocket/CLI contracts. Visualizer imports are declarative browser packages, not executable backend plugins. + +## Partners Manager + +```text +GET /api/partners +POST /api/partners +GET /api/partners/recent +GET /api/channels/schema/schema +GET /api/partners/tool-options +GET /api/partners/souls +POST /api/partners/souls +GET /api/partners/soul-sources +GET /api/partners/{partner_id} +PATCH /api/partners/{partner_id} +POST /api/partners/{partner_id}/start +POST /api/partners/{partner_id}/stop +DELETE /api/partners/{partner_id} +POST /api/partners/{partner_id}/channels/reload +GET /api/partners/{partner_id}/channels/status +POST /api/partners/{partner_id}/channel-onboarding/start +GET /api/partners/{partner_id}/channel-onboarding/{session_id} +DELETE /api/partners/{partner_id}/channel-onboarding/{session_id} +POST /api/partners/{partner_id}/channel-onboarding/{session_id}/apply +GET /api/partners/{partner_id}/soul +PUT /api/partners/{partner_id}/soul +GET /api/partners/{partner_id}/assets +POST /api/partners/{partner_id}/assets +DELETE /api/partners/{partner_id}/assets/{asset_type}/{name} +GET /api/partners/{partner_id}/history +GET /api/partners/{partner_id}/sessions +POST /api/partners/{partner_id}/sessions/archive +POST /api/partners/{partner_id}/sessions/resume +POST /api/partners/{partner_id}/sessions/delete +POST /api/partners/{partner_id}/sessions/branch +POST /api/partners/{partner_id}/chat +POST /api/partners/{partner_id}/chat/execute-stream +WS /ws/partners/{partner_id} +``` + +Authenticated users may create Partners. Resource routes enforce **use** or **manage** rights; owners/admins manage, while grants can be conversation-only. Secrets are masked unless manageable callers request `include_secrets=true`. + +## Book Engine + +```text +GET /api/books +POST /api/books +GET /api/books/block-types Available generated content types +GET /api/books/{book_id} +GET /api/books/{book_id}/spine +GET /api/books/{book_id}/pages/{page_id} +DELETE /api/books/{book_id} +POST /api/books/confirm-proposal +POST /api/books/confirm-spine +POST /api/books/compile-page +POST /api/books/pause Persist, cancel work, keep completed pages +POST /api/books/resume Queue unfinished pages only +POST /api/books/{book_id}/refresh-fingerprints +WS /ws/books Subscribe with `after_seq`; may acknowledge reset +``` + +## Immersive Reading + +```text +GET /api/reading/supported-formats Extensions, size cap, raw-view formats +GET /api/reading/materials List this account's materials +POST /api/reading/materials Upload a document (multipart) +GET /api/reading/materials/{material_id} Manifest: unit kind, unit count, outline +DELETE /api/reading/materials/{material_id} Forget a material +GET /api/reading/materials/{material_id}/units/{locator} One unit's text +GET /api/reading/materials/{material_id}/revisions Prior immutable URL snapshots +GET /api/reading/materials/{material_id}/revisions/{revision}/units/{locator} +GET /api/reading/materials/{material_id}/raw Original bytes (PDF) +GET /api/reading/materials/{material_id}/assets/{asset_name} Authenticated snapshot image +GET /api/reading/materials/{material_id}/bookmarks List bookmarks +POST /api/reading/materials/{material_id}/bookmarks Save a bookmark +DELETE /api/reading/materials/{material_id}/bookmarks/{bookmark_id} +GET /api/reading/materials/{material_id}/annotations List annotations +PUT /api/reading/materials/{material_id}/annotations Create or update one; returns AnnotationInfo +DELETE /api/reading/materials/{material_id}/annotations/{id} Delete one +GET /api/reading/materials/{material_id}/export?fmt=auto|pdf|markdown +``` + +A material is content-addressed: uploading the same bytes twice returns the same `material_id` and keeps the annotations already on it. `export?fmt=pdf` returns the original file with real PDF annotations written in, and is only available for materials that kept their raw bytes. + +URL refreshes preserve immutable prior revisions. Snapshot assets are authenticated, MIME-sniffed, and served with `nosniff` rather than exposing a live third-party page inside the reader. + +## Immersive Watching + +```text +GET /api/settings/video-learning +PUT /api/settings/video-learning +POST /api/settings/video-learning/test-invidious +POST /api/video-learning/materials/resolve +GET /api/video-learning/materials/{material_id} +PUT /api/video-learning/materials/{material_id}/progress +GET /api/video-learning/materials/{material_id}/subtitles.vtt +GET|HEAD /api/video-learning/materials/{material_id}/stream/{format_id} +``` + +These compatibility endpoints retain YouTube playback, transcript cues, and provider-independent progress. Current video sessions use Reading; legacy Watching sessions migrate when reopened. Resolve accepts a YouTube URL and optional language/provider override; VTT returns normalized cues. + +## Other routers + +Not every surface is expanded above. These exist and follow the same conventions; use `/openapi.json` for their schemas: + +```text +/api/skills Skill library and hub installs +/api/personas Persona presets +/api/plugins Managed plugin lifecycle and approvals +/api/learning-journal Workspace missions, handoffs, and confirmed records +/api/documents Co-Writer documents and edit streams +/api/mastery-paths Mastery paths, objectives, and progress +/api/subagents Connected agent configuration +/api/imports Claude Code / Codex conversation import +/api/space/mcp Per-account MCP services and the curated catalog +/api/space/cli-apps CLI app catalog, installs, and grants +/api/voice Text-to-speech and speech-to-text +/api/dashboard Recent activity, starter suggestions/refresh, and activity detail +``` + +## Outputs and attachments + +User-generated artifacts are served by an authenticated, request-scoped router: + +```text +GET /files/outputs/ +``` + +Requests resolve allowlisted files in the caller's or one visible Partner workspace; invalid/private/traversal paths fail closed. Original chat attachments are served under: + +```text +GET /files/attachments/{session_id}/{attachment_id}/{filename} +``` + +## Generate a typed client + +```bash +curl http://localhost:8001/openapi.json > deeptutor.openapi.json + +# TypeScript client +npx openapi-typescript deeptutor.openapi.json -o deeptutor.d.ts + +# Python client +pip install openapi-python-client +openapi-python-client generate --path deeptutor.openapi.json +``` + + + +## Route index + +Generated from `deeptutor/modules/manifests/*.json` and `deeptutor/api/router_index.json`. Each path is the mount prefix plus the route template. Request and response fields stay in the live `GET /openapi.json`. + +### books + +#### `book:router` — `/api` · learning + +| Method | Path | +| --- | --- | +| `GET` | `/api/books/health` | +| `GET` | `/api/books/estimate-basis` | +| `GET` | `/api/books/block-types` | +| `GET` | `/api/books` | +| `GET` | `/api/books/{book_id}/learning-captures` | +| `POST` | `/api/books/{book_id}/learning-captures` | +| `PATCH` | `/api/books/{book_id}/learning-captures/{capture_id}` | +| `GET` | `/api/books/{book_id}` | +| `GET` | `/api/books/{book_id}/spine` | +| `GET` | `/api/books/{book_id}/pages/{page_id}` | +| `DELETE` | `/api/books/{book_id}` | +| `POST` | `/api/books` | +| `POST` | `/api/books/confirm-proposal` | +| `POST` | `/api/books/confirm-spine` | +| `POST` | `/api/books/compile-page` | +| `POST` | `/api/books/regenerate-block` | +| `POST` | `/api/books/insert-block` | +| `POST` | `/api/books/delete-block` | +| `POST` | `/api/books/move-block` | +| `POST` | `/api/books/change-block-type` | +| `POST` | `/api/books/{book_id}/chapters` | +| `PATCH` | `/api/books/{book_id}/chapters/{chapter_id}` | +| `DELETE` | `/api/books/{book_id}/chapters/{chapter_id}` | +| `POST` | `/api/books/{book_id}/chapters/{chapter_id}/move` | +| `POST` | `/api/books/deep-dive` | +| `POST` | `/api/books/quiz-attempt` | +| `POST` | `/api/books/update-block` | +| `POST` | `/api/books/progress/visit` | +| `POST` | `/api/books/progress/bookmark` | +| `GET` | `/api/books/{book_id}/export` | +| `GET` | `/api/books/{book_id}/health` | +| `POST` | `/api/books/{book_id}/refresh-fingerprints` | +| `POST` | `/api/books/supplement` | +| `POST` | `/api/books/page-chat-session` | +| `POST` | `/api/books/resume` | +| `POST` | `/api/books/pause` | +| `POST` | `/api/books/rebuild` | +| `POST` | `/api/books/{book_id}/edits/preview` | +| `GET` | `/api/books/{book_id}/edits` | +| `POST` | `/api/books/{book_id}/edits/{edit_id}/apply` | +| `POST` | `/api/books/{book_id}/edits/{edit_id}/undo` | + +#### `book:ws_router` — `/ws` · public + +| Method | Path | +| --- | --- | +| `WS` | `/ws/books` | + +### calendar + +#### `calendar:router` — `/api/calendar` · learning + +| Method | Path | +| --- | --- | +| `GET` | `/api/calendar/export.ics` | +| `GET` | `/api/calendar/calendars` | +| `POST` | `/api/calendar/calendars` | +| `PATCH` | `/api/calendar/calendars/{id}` | +| `DELETE` | `/api/calendar/calendars/{id}` | +| `GET` | `/api/calendar/events` | +| `POST` | `/api/calendar/events` | +| `PATCH` | `/api/calendar/events/{id}` | +| `DELETE` | `/api/calendar/events/{id}` | +| `POST` | `/api/calendar/undo/{token}` | +| `GET` | `/api/calendar/search` | +| `GET` | `/api/calendar/layers` | +| `DELETE` | `/api/calendar/automations/{job_id}` | +| `GET` | `/api/calendar/stream` | +| `GET` | `/api/calendar/task-blocks` | + +### co-writer + +#### `co_writer:router` — `/api` · learning + +| Method | Path | +| --- | --- | +| `POST` | `/api/documents/actions/edit` | +| `POST` | `/api/documents/actions/edit-react` | +| `POST` | `/api/documents/actions/edit-react/stream` | +| `POST` | `/api/documents/actions/automark` | +| `GET` | `/api/documents/history` | +| `GET` | `/api/documents/history/{operation_id}` | +| `GET` | `/api/documents/tool-calls/{operation_id}` | +| `GET` | `/api/documents` | +| `POST` | `/api/documents` | +| `POST` | `/api/documents/import/docx` | +| `POST` | `/api/documents/export/docx` | +| `GET` | `/api/documents/flashcards/export` | +| `GET` | `/api/documents/{doc_id}` | +| `PUT` | `/api/documents/{doc_id}` | +| `DELETE` | `/api/documents/{doc_id}` | +| `GET` | `/api/documents/{doc_id}/suggestions` | +| `POST` | `/api/documents/{doc_id}/suggestions/{suggestion_id}` | +| `GET` | `/api/documents/{doc_id}/backlinks` | +| `POST` | `/api/documents/{doc_id}/assets` | +| `GET` | `/api/documents/{doc_id}/assets/{name}` | +| `POST` | `/api/documents/{doc_id}/clips` | +| `GET` | `/api/documents/review/due` | +| `GET` | `/api/documents/{doc_id}/flashcards/export` | +| `POST` | `/api/documents/{doc_id}/review` | +| `POST` | `/api/documents/{doc_id}/suggestions` | +| `GET` | `/api/documents/{doc_id}/threads` | +| `POST` | `/api/documents/{doc_id}/threads` | +| `DELETE` | `/api/documents/{doc_id}/threads/{session_id}` | + +### knowledge + +#### `knowledge:router` — `/api` · learning + +| Method | Path | +| --- | --- | +| `GET` | `/api/knowledge-bases/health` | +| `GET` | `/api/knowledge-bases/rag-providers` | +| `PUT` | `/api/knowledge-bases/rag-providers/{provider}/mode` | +| `GET` | `/api/knowledge-bases/rag-pipelines/pageindex/config` | +| `PUT` | `/api/knowledge-bases/rag-pipelines/pageindex/config` | +| `GET` | `/api/knowledge-bases/rag-pipelines/ima/config` | +| `PUT` | `/api/knowledge-bases/rag-pipelines/ima/config` | +| `GET` | `/api/knowledge-bases/rag-pipelines/llamaindex/config` | +| `PUT` | `/api/knowledge-bases/rag-pipelines/llamaindex/config` | +| `GET` | `/api/knowledge-bases/rag-pipelines/graphrag/config` | +| `PUT` | `/api/knowledge-bases/rag-pipelines/graphrag/config` | +| `GET` | `/api/knowledge-bases/rag-pipelines/lightrag/config` | +| `GET` | `/api/knowledge-bases/rag-pipelines/lightrag/model-options` | +| `PUT` | `/api/knowledge-bases/rag-pipelines/lightrag/config` | +| `GET` | `/api/knowledge-bases/rag-pipelines/lightrag-server/config` | +| `PUT` | `/api/knowledge-bases/rag-pipelines/lightrag-server/config` | +| `GET` | `/api/knowledge-bases/rag-pipelines/{provider}/preflight` | +| `GET` | `/api/knowledge-bases/rag-pipelines/model-options` | +| `GET` | `/api/knowledge-bases/embedding-usage` | +| `POST` | `/api/knowledge-bases/rag-pipelines/graphrag/model-compatibility` | +| `PUT` | `/api/knowledge-bases/rag-pipelines/active-model` | +| `GET` | `/api/knowledge-bases/supported-file-types` | +| `GET` | `/api/knowledge-bases/configs` | +| `GET` | `/api/knowledge-bases/{kb_name}/config` | +| `PUT` | `/api/knowledge-bases/{kb_name}/config` | +| `POST` | `/api/knowledge-bases/configs/sync` | +| `GET` | `/api/knowledge-bases/default` | +| `PUT` | `/api/knowledge-bases/default/{kb_name}` | +| `POST` | `/api/knowledge-bases/connect-obsidian` | +| `POST` | `/api/knowledge-bases/connect-marginnote4` | +| `POST` | `/api/knowledge-bases/probe-folder` | +| `POST` | `/api/knowledge-bases/connect-folder` | +| `POST` | `/api/knowledge-bases/probe-lightrag-server` | +| `POST` | `/api/knowledge-bases/connect-lightrag-server` | +| `POST` | `/api/knowledge-bases/probe-weknora` | +| `POST` | `/api/knowledge-bases/connect-weknora` | +| `POST` | `/api/knowledge-bases/list-ima` | +| `GET` | `/api/knowledge-bases/kiwix-catalog` | +| `POST` | `/api/knowledge-bases/probe-kiwix` | +| `POST` | `/api/knowledge-bases/connect-kiwix` | +| `GET` | `/api/knowledge-bases/kiwix-articles` | +| `POST` | `/api/knowledge-bases/probe-ima` | +| `POST` | `/api/knowledge-bases/connect-ima` | +| `GET` | `/api/knowledge-bases` | +| `GET` | `/api/knowledge-bases/list` | +| `GET` | `/api/knowledge-bases/{kb_name}` | +| `GET` | `/api/knowledge-bases/{kb_name}/files` | +| `POST` | `/api/knowledge-bases/{kb_name}/folders` | +| `POST` | `/api/knowledge-bases/{kb_name}/files/move` | +| `GET` | `/api/knowledge-bases/{kb_name}/file-preview-text/{filename:path}` | +| `GET` | `/api/knowledge-bases/{kb_name}/files/{filename:path}` | +| `GET` | `/api/knowledge-bases/{kb_name}/visual-assets/{asset_id}` | +| `GET` | `/api/knowledge-bases/{kb_name}/visual-coverage` | +| `GET` | `/api/knowledge-bases/{kb_name}/source-page` | +| `DELETE` | `/api/knowledge-bases/{kb_name}/files/{filename:path}` | +| `POST` | `/api/knowledge-bases/delete` | +| `DELETE` | `/api/knowledge-bases/{kb_name}` | +| `GET` | `/api/knowledge-bases/tasks/{task_id}/stream` | +| `POST` | `/api/knowledge-bases/{kb_name}/upload` | +| `POST` | `/api/knowledge-bases` | +| `GET` | `/api/knowledge-bases/{kb_name}/reindex-config` | +| `POST` | `/api/knowledge-bases/{kb_name}/reindex` | +| `PUT` | `/api/knowledge-bases/{kb_name}/indexing-policy` | +| `POST` | `/api/knowledge-bases/{kb_name}/retry` | +| `GET` | `/api/knowledge-bases/{kb_name}/indexing-run` | +| `POST` | `/api/knowledge-bases/{kb_name}/indexing-run/{task_id}/cancel` | +| `GET` | `/api/knowledge-bases/{kb_name}/indexing-readiness` | +| `GET` | `/api/knowledge-bases/{kb_name}/progress` | +| `POST` | `/api/knowledge-bases/{kb_name}/progress/clear` | +| `POST` | `/api/knowledge-bases/{kb_name}/link-folder` | +| `GET` | `/api/knowledge-bases/{kb_name}/linked-folders` | +| `DELETE` | `/api/knowledge-bases/{kb_name}/linked-folders/{folder_id}` | +| `POST` | `/api/knowledge-bases/{kb_name}/sync-folder/{folder_id}` | +| `POST` | `/api/knowledge-bases/{kb_name}/github-source` | +| `GET` | `/api/knowledge-bases/{kb_name}/github-sources` | +| `DELETE` | `/api/knowledge-bases/{kb_name}/github-source/{source_id}` | +| `POST` | `/api/knowledge-bases/{kb_name}/sync-github` | +| `POST` | `/api/knowledge-bases/{kb_name}/web-source` | +| `GET` | `/api/knowledge-bases/{kb_name}/web-sources` | +| `DELETE` | `/api/knowledge-bases/{kb_name}/web-source/{source_id}` | +| `GET` | `/api/knowledge-bases/{kb_name}/web-source-sync` | +| `GET` | `/api/knowledge-bases/{kb_name}/web-source/{source_id}/pairings` | +| `PUT` | `/api/knowledge-bases/{kb_name}/web-source/{source_id}/schedule` | +| `POST` | `/api/knowledge-bases/{kb_name}/web-source/{source_id}/cancel` | +| `POST` | `/api/knowledge-bases/{kb_name}/web-source/{source_id}/retry` | +| `POST` | `/api/knowledge-bases/{kb_name}/sync-web` | + +#### `marginnote4:router` — `/api/marginnote4` · public + +| Method | Path | +| --- | --- | +| `POST` | `/api/marginnote4/pair` | +| `GET` | `/api/marginnote4/devices` | +| `DELETE` | `/api/marginnote4/devices/{device_id}` | +| `GET` | `/api/marginnote4/status` | +| `POST` | `/api/marginnote4/sync` | +| `POST` | `/api/marginnote4/heartbeat` | + +#### `knowledge:ws_router` — `/ws` · public + +| Method | Path | +| --- | --- | +| `WS` | `/ws/knowledge-bases/{kb_name}/progress` | + +### mastery + +#### `mastery_path:router` — `/api/mastery-paths` · learning + +| Method | Path | +| --- | --- | +| `GET` | `/api/mastery-paths/topics` | +| `GET` | `/api/mastery-paths/topics/index` | +| `GET` | `/api/mastery-paths/reading/records` | +| `POST` | `/api/mastery-paths/topics/draft` | +| `POST` | `/api/mastery-paths/topics` | +| `GET` | `/api/mastery-paths/topics/{path_id}` | +| `GET` | `/api/mastery-paths/topics/{path_id}/review-settings` | +| `PUT` | `/api/mastery-paths/topics/{path_id}/review-settings` | +| `GET` | `/api/mastery-paths/review-strategies` | +| `POST` | `/api/mastery-paths/review-strategies` | +| `GET` | `/api/mastery-paths/review-strategies/{template_id}` | +| `PUT` | `/api/mastery-paths/review-strategies/{template_id}` | +| `POST` | `/api/mastery-paths/review-strategies/{template_id}/duplicate` | +| `DELETE` | `/api/mastery-paths/review-strategies/{template_id}` | +| `PUT` | `/api/mastery-paths/topics/{path_id}/review-strategy` | +| `PUT` | `/api/mastery-paths/topics/{path_id}/map` | +| `POST` | `/api/mastery-paths/topics/{path_id}/objectives/{kp_id}/override` | +| `GET` | `/api/mastery-paths/topics/{path_id}/sessions` | +| `PUT` | `/api/mastery-paths/topics/{path_id}/sessions/{session_id}/mode` | +| `GET` | `/api/mastery-paths/topics/{path_id}/ask-hint` | +| `GET` | `/api/mastery-paths/progress` | +| `GET` | `/api/mastery-paths/progress/{book_id}` | +| `GET` | `/api/mastery-paths/progress/{book_id}/map` | +| `GET` | `/api/mastery-paths/progress/{book_id}/board` | +| `GET` | `/api/mastery-paths/progress/{book_id}/objectives/{kp_id}` | +| `GET` | `/api/mastery-paths/progress/{book_id}/events` | +| `GET` | `/api/mastery-paths/progress/{book_id}/sessions` | +| `POST` | `/api/mastery-paths/progress/{book_id}/init-modules` | +| `POST` | `/api/mastery-paths/progress/{book_id}/import-from-book` | +| `PATCH` | `/api/mastery-paths/progress/{book_id}` | +| `DELETE` | `/api/mastery-paths/progress/{book_id}` | +| `POST` | `/api/mastery-paths/progress/{book_id}/skip-question` | +| `POST` | `/api/mastery-paths/progress/{book_id}/redo` | +| `POST` | `/api/mastery-paths/progress/{book_id}/generate-from-notebook` | +| `POST` | `/api/mastery-paths/progress/{book_id}/generate-from-reading` | + +#### `mastery_path:ws_router` — `/ws` · public + +| Method | Path | +| --- | --- | +| `WS` | `/ws/mastery-paths` | + +### memory + +#### `memory:router` — `/api/memory` · learning + +| Method | Path | +| --- | --- | +| `GET` | `/api/memory/overview` | +| `GET` | `/api/memory/resolve_entry/{entry_id}` | +| `GET` | `/api/memory/backup` | +| `GET` | `/api/memory/doc/{layer}/{key}` | +| `PUT` | `/api/memory/doc/{layer}/{key}` | +| `DELETE` | `/api/memory/doc/{layer}/{key}/entry/{entry_id}` | +| `POST` | `/api/memory/doc/{layer}/{key}/reset` | +| `POST` | `/api/memory/runs/start` | +| `GET` | `/api/memory/runs/{run_id}` | +| `POST` | `/api/memory/runs/{run_id}/cancel` | +| `POST` | `/api/memory/runs/{run_id}/undo` | +| `GET` | `/api/memory/runs` | +| `GET` | `/api/memory/runs/{run_id}/events` | +| `POST` | `/api/memory/doc/{layer}/{key}/update` | +| `POST` | `/api/memory/doc/{layer}/{key}/audit` | +| `POST` | `/api/memory/doc/{layer}/{key}/dedup` | +| `GET` | `/api/memory/doc/{layer}/{key}/lines` | +| `GET` | `/api/memory/settings` | +| `PUT` | `/api/memory/settings` | +| `POST` | `/api/memory/doc/{layer}/{key}/apply` | +| `GET` | `/api/memory/trace/{surface}` | +| `DELETE` | `/api/memory/trace/{surface}` | +| `DELETE` | `/api/memory/trace/{surface}/day/{day}` | +| `GET` | `/api/memory/snapshot/{surface}` | +| `POST` | `/api/memory/snapshot/{surface}/refresh` | +| `GET` | `/api/memory/snapshot/{surface}/changes` | +| `DELETE` | `/api/memory/snapshot/{surface}/changes` | + +### notebook + +#### `notebook:router` — `/api` · learning + +| Method | Path | +| --- | --- | +| `GET` | `/api/notebooks/health` | +| `GET` | `/api/notebooks` | +| `GET` | `/api/notebooks/statistics` | +| `POST` | `/api/notebooks` | +| `GET` | `/api/notebooks/{notebook_id}` | +| `PUT` | `/api/notebooks/{notebook_id}` | +| `DELETE` | `/api/notebooks/{notebook_id}` | +| `POST` | `/api/notebooks/actions/add-record` | +| `POST` | `/api/notebooks/actions/add-record-with-summary` | +| `DELETE` | `/api/notebooks/{notebook_id}/records/{record_id}` | +| `GET` | `/api/notebooks/records/{record_id}/location` | +| `PUT` | `/api/notebooks/{notebook_id}/records/{record_id}` | +| `POST` | `/api/notebooks/{notebook_id}/records/{record_id}/actions/copy` | +| `POST` | `/api/notebooks/{notebook_id}/records/{record_id}/actions/move` | +| `GET` | `/api/notebooks/{notebook_id}/export` | + +### partners + +#### `partner_groups:router` — `/api/partner-groups` · learning + +| Method | Path | +| --- | --- | +| `GET` | `/api/partner-groups` | +| `GET` | `/api/partner-groups/discussion-modes` | +| `GET` | `/api/partner-groups/shared-memory-types` | +| `POST` | `/api/partner-groups` | +| `GET` | `/api/partner-groups/{group_id}` | +| `PATCH` | `/api/partner-groups/{group_id}` | +| `DELETE` | `/api/partner-groups/{group_id}` | +| `GET` | `/api/partner-groups/{group_id}/history` | +| `GET` | `/api/partner-groups/{group_id}/sessions` | +| `POST` | `/api/partner-groups/{group_id}/sessions` | +| `DELETE` | `/api/partner-groups/{group_id}/sessions/{session_key}` | +| `GET` | `/api/partner-groups/{group_id}/whiteboard` | +| `POST` | `/api/partner-groups/{group_id}/whiteboard/pins` | +| `DELETE` | `/api/partner-groups/{group_id}/whiteboard/pins/{event_id}` | +| `GET` | `/api/partner-groups/{group_id}/invocations` | +| `POST` | `/api/partner-groups/{group_id}/invocations` | +| `POST` | `/api/partner-groups/{group_id}/messages` | +| `POST` | `/api/partner-groups/{group_id}/turns/{turn_id}/partners/{partner_id}/retry` | +| `POST` | `/api/partner-groups/{group_id}/rounds/{turn_id}/summary` | +| `POST` | `/api/partner-groups/{group_id}/invocations/{invocation_id}/approve` | +| `POST` | `/api/partner-groups/{group_id}/invocations/{invocation_id}/reject` | + +#### `partners:router` — `/api/partners` · learning + +| Method | Path | +| --- | --- | +| `GET` | `/api/partners/souls` | +| `POST` | `/api/partners/souls` | +| `GET` | `/api/partners/souls/{soul_id}` | +| `PUT` | `/api/partners/souls/{soul_id}` | +| `DELETE` | `/api/partners/souls/{soul_id}` | +| `GET` | `/api/partners/soul-sources` | +| `GET` | `/api/partners` | +| `GET` | `/api/partners/navigation` | +| `GET` | `/api/partners/consultation-session` | +| `GET` | `/api/partners/recent` | +| `GET` | `/api/partners/channels/schema` | +| `POST` | `/api/partners/{partner_id}/channels/weixin/qr` | +| `GET` | `/api/partners/{partner_id}/channels/weixin/qr/{session_id}` | +| `GET` | `/api/partners/tool-options` | +| `POST` | `/api/partners` | +| `GET` | `/api/partners/drafts/{draft_id}` | +| `POST` | `/api/partners/drafts/{draft_id}/confirm` | +| `GET` | `/api/partners/{partner_id}` | +| `PATCH` | `/api/partners/{partner_id}` | +| `POST` | `/api/partners/{partner_id}/start` | +| `POST` | `/api/partners/{partner_id}/stop` | +| `DELETE` | `/api/partners/{partner_id}` | +| `POST` | `/api/partners/{partner_id}/channels/reload` | +| `GET` | `/api/partners/{partner_id}/channels/status` | +| `POST` | `/api/partners/{partner_id}/channel-onboarding/start` | +| `GET` | `/api/partners/{partner_id}/channel-onboarding/{session_id}` | +| `DELETE` | `/api/partners/{partner_id}/channel-onboarding/{session_id}` | +| `POST` | `/api/partners/{partner_id}/channel-onboarding/{session_id}/apply` | +| `GET` | `/api/partners/{partner_id}/soul` | +| `PUT` | `/api/partners/{partner_id}/soul` | +| `GET` | `/api/partners/{partner_id}/workspaces` | +| `GET` | `/api/partners/{partner_id}/assets` | +| `POST` | `/api/partners/{partner_id}/assets` | +| `DELETE` | `/api/partners/{partner_id}/assets/{asset_type}/{name}` | +| `POST` | `/api/partners/{partner_id}/links/code` | +| `GET` | `/api/partners/{partner_id}/links` | +| `DELETE` | `/api/partners/{partner_id}/links/{key:path}` | +| `GET` | `/api/partners/{partner_id}/history` | +| `GET` | `/api/partners/{partner_id}/history/page` | +| `GET` | `/api/partners/{partner_id}/web-continuity` | +| `PUT` | `/api/partners/{partner_id}/web-continuity` | +| `GET` | `/api/partners/{partner_id}/sessions` | +| `POST` | `/api/partners/{partner_id}/sessions/archive` | +| `POST` | `/api/partners/{partner_id}/sessions/resume` | +| `POST` | `/api/partners/{partner_id}/sessions/delete` | +| `POST` | `/api/partners/{partner_id}/sessions/branch` | +| `GET` | `/api/partners/commands/palette` | +| `POST` | `/api/partners/{partner_id}/chat` | +| `POST` | `/api/partners/{partner_id}/chat/execute-stream` | + +#### `partner_groups:ws_router` — `/ws/partner-groups` · public + +| Method | Path | +| --- | --- | +| `WS` | `/ws/partner-groups/{group_id}` | + +#### `partners:ws_router` — `/ws/partners` · public + +| Method | Path | +| --- | --- | +| `WS` | `/ws/partners/{partner_id}` | + +### questions + +#### `question:router` — `/api/question` · learning + +| Method | Path | +| --- | --- | + +#### `question_notebook:router` — `/api/question-notebook` · learning + +| Method | Path | +| --- | --- | +| `POST` | `/api/question-notebook/entries/upsert` | +| `GET` | `/api/question-notebook/entries` | +| `GET` | `/api/question-notebook/entries/lookup/by-question` | +| `GET` | `/api/question-notebook/entries/{entry_id}` | +| `PATCH` | `/api/question-notebook/entries/{entry_id}` | +| `DELETE` | `/api/question-notebook/entries/{entry_id}` | +| `POST` | `/api/question-notebook/entries/categories/bulk` | +| `POST` | `/api/question-notebook/entries/{entry_id}/categories` | +| `DELETE` | `/api/question-notebook/entries/{entry_id}/categories/{category_id}` | +| `GET` | `/api/question-notebook/stats` | +| `GET` | `/api/question-notebook/materials` | +| `GET` | `/api/question-notebook/categories` | +| `POST` | `/api/question-notebook/categories` | +| `PATCH` | `/api/question-notebook/categories/{category_id}` | +| `DELETE` | `/api/question-notebook/categories/{category_id}` | + +#### `practice:router` — `/api/question-notebook/practice` · learning + +| Method | Path | +| --- | --- | +| `GET` | `/api/question-notebook/practice/summary` | +| `GET` | `/api/question-notebook/practice/queue` | +| `GET` | `/api/question-notebook/practice/analytics` | +| `GET` | `/api/question-notebook/practice/questions/{entry_id}` | +| `POST` | `/api/question-notebook/practice/questions/{entry_id}/check` | +| `POST` | `/api/question-notebook/practice/questions/{entry_id}/review` | +| `GET` | `/api/question-notebook/practice/import/template` | +| `POST` | `/api/question-notebook/practice/import/preview` | +| `POST` | `/api/question-notebook/practice/import/commit` | + +#### `question:ws_router` — `/ws/questions` · public + +| Method | Path | +| --- | --- | +| `WS` | `/ws/questions/mimic` | +| `WS` | `/ws/questions/generate` | + +### reading + +#### `reading:router` — `/api/reading` · learning + +| Method | Path | +| --- | --- | +| `GET` | `/api/reading/library/materials` | +| `POST` | `/api/reading/library/duplicate-check` | +| `POST` | `/api/reading/library/import-urls` | +| `POST` | `/api/reading/library/import-zim-article` | +| `POST` | `/api/reading/materials/{material_id}/retry` | +| `GET` | `/api/reading/workspaces` | +| `GET` | `/api/reading/workspaces/index` | +| `POST` | `/api/reading/workspaces` | +| `GET` | `/api/reading/workspaces/{workspace_id}` | +| `GET` | `/api/reading/workspaces/{workspace_id}/ask-hint` | +| `PATCH` | `/api/reading/workspaces/{workspace_id}` | +| `DELETE` | `/api/reading/workspaces/{workspace_id}` | +| `POST` | `/api/reading/workspaces/{workspace_id}/materials` | +| `PUT` | `/api/reading/workspaces/{workspace_id}/materials/order` | +| `PUT` | `/api/reading/workspaces/{workspace_id}/materials/{material_id}/active` | +| `DELETE` | `/api/reading/workspaces/{workspace_id}/materials/{material_id}` | +| `GET` | `/api/reading/workspaces/{workspace_id}/sessions` | +| `POST` | `/api/reading/workspaces/{workspace_id}/sessions` | +| `PATCH` | `/api/reading/workspaces/{workspace_id}/sessions/{session_id}` | +| `DELETE` | `/api/reading/workspaces/{workspace_id}/sessions/{session_id}` | +| `POST` | `/api/reading/workspaces/{workspace_id}/sessions/{session_id}/links` | +| `DELETE` | `/api/reading/workspaces/{workspace_id}/sessions/{session_id}/links/{target_session_id}` | +| `POST` | `/api/reading/workspaces/{workspace_id}/notes/organize` | +| `POST` | `/api/reading/workspaces/{workspace_id}/notebook` | +| `GET` | `/api/reading/supported-formats` | +| `GET` | `/api/reading/materials` | +| `POST` | `/api/reading/materials` | +| `GET` | `/api/reading/materials/{material_id}` | +| `GET` | `/api/reading/materials/{material_id}/epub-pairing-candidates` | +| `GET` | `/api/reading/epub-pairings` | +| `POST` | `/api/reading/epub-pairings` | +| `DELETE` | `/api/reading/epub-pairings/{pairing_id}` | +| `DELETE` | `/api/reading/materials/{material_id}` | +| `GET` | `/api/reading/materials/{material_id}/transcript` | +| `GET` | `/api/reading/materials/{material_id}/units/{locator}` | +| `GET` | `/api/reading/materials/{material_id}/revisions` | +| `GET` | `/api/reading/materials/{material_id}/revisions/{revision}/units/{locator}` | +| `GET` | `/api/reading/materials/{material_id}/raw` | +| `GET` | `/api/reading/materials/{material_id}/render` | +| `GET` | `/api/reading/materials/{material_id}/assets/{asset_name}` | +| `GET` | `/api/reading/materials/{material_id}/media` | +| `GET` | `/api/reading/materials/{material_id}/media/{name}` | +| `GET` | `/api/reading/materials/{material_id}/annotations` | +| `GET` | `/api/reading/materials/{material_id}/position` | +| `PUT` | `/api/reading/materials/{material_id}/position` | +| `GET` | `/api/reading/materials/{material_id}/bookmarks` | +| `POST` | `/api/reading/materials/{material_id}/bookmarks` | +| `DELETE` | `/api/reading/materials/{material_id}/bookmarks/{bookmark_id}` | +| `PUT` | `/api/reading/materials/{material_id}/annotations` | +| `DELETE` | `/api/reading/materials/{material_id}/annotations/{annotation_id}` | +| `GET` | `/api/reading/materials/{material_id}/export` | + +#### `reading_extensions:router` — `/api/reading` · learning + +| Method | Path | +| --- | --- | +| `GET` | `/api/reading/extensions` | +| `POST` | `/api/reading/materials/{material_id}/read-aloud` | +| `POST` | `/api/reading/materials/{material_id}/extensions/{extension_id}/actions/{action}` | +| `POST` | `/api/reading/materials/{material_id}/extensions/quiz/answers` | +| `GET` | `/api/reading/materials/{material_id}/quiz/rewards` | + +#### `video_learning:settings_router` — `/api/settings/video-learning` · admin + +| Method | Path | +| --- | --- | +| `GET` | `/api/settings/video-learning` | +| `PUT` | `/api/settings/video-learning` | +| `POST` | `/api/settings/video-learning/test-invidious` | + +#### `video_learning:router` — `/api/video-learning` · learning + +| Method | Path | +| --- | --- | +| `POST` | `/api/video-learning/invidious/account/authorize` | +| `GET` | `/api/video-learning/invidious/account/callback` | +| `GET` | `/api/video-learning/invidious/browse/{kind}` | +| `GET` | `/api/video-learning/invidious/account/status` | +| `POST` | `/api/video-learning/invidious/account/disconnect` | +| `POST` | `/api/video-learning/materials/resolve` | +| `GET` | `/api/video-learning/materials/{material_id}` | +| `POST` | `/api/video-learning/materials/{material_id}/transcript/refresh` | +| `PUT` | `/api/video-learning/materials/{material_id}/progress` | +| `GET` | `/api/video-learning/materials/{material_id}/notes` | +| `GET` | `/api/video-learning/materials/{material_id}/notes.md` | +| `POST` | `/api/video-learning/materials/{material_id}/notes` | +| `PUT` | `/api/video-learning/materials/{material_id}/notes/{note_id}` | +| `DELETE` | `/api/video-learning/materials/{material_id}/notes/{note_id}` | +| `GET` | `/api/video-learning/materials/{material_id}/marks` | +| `GET` | `/api/video-learning/materials/{material_id}/marks/{mark_id}` | +| `POST` | `/api/video-learning/materials/{material_id}/marks` | +| `PATCH` | `/api/video-learning/materials/{material_id}/marks/{mark_id}` | +| `DELETE` | `/api/video-learning/materials/{material_id}/marks/{mark_id}` | +| `POST` | `/api/video-learning/materials/{material_id}/mark-suggestions` | +| `GET` | `/api/video-learning/materials/{material_id}/subtitles.vtt` | +| `HEAD` | `/api/video-learning/materials/{material_id}/stream/{format_id}` | +| `GET` | `/api/video-learning/materials/{material_id}/stream/{format_id}` | + +#### `voice:router` — `/api/voice` · learning + +| Method | Path | +| --- | --- | +| `POST` | `/api/voice/tts` | +| `POST` | `/api/voice/stt` | + +### server + +#### `unified_ws:router` — `/` · public + +| Method | Path | +| --- | --- | +| `WS` | `/ws` | + +#### `personas:router` — `/api` · learning + +| Method | Path | +| --- | --- | +| `GET` | `/api/personas` | +| `GET` | `/api/personas/{name}` | +| `POST` | `/api/personas` | +| `PUT` | `/api/personas/{name}` | +| `DELETE` | `/api/personas/{name}` | + +#### `agent_config:router` — `/api/agent-config` · learning + +| Method | Path | +| --- | --- | +| `GET` | `/api/agent-config/agents` | +| `GET` | `/api/agent-config/agents/{agent_type}` | + +#### `auth:router` — `/api/auth` · public + +| Method | Path | +| --- | --- | +| `GET` | `/api/auth/openai-codex/callback` | +| `GET` | `/api/auth/status` | +| `POST` | `/api/auth/login` | +| `POST` | `/api/auth/device-login` | +| `POST` | `/api/auth/session-handoff` | +| `POST` | `/api/auth/session-handoff/exchange` | +| `POST` | `/api/auth/session-handoff/complete` | +| `POST` | `/api/auth/device/heartbeat` | +| `POST` | `/api/auth/logout` | +| `POST` | `/api/auth/register` | +| `GET` | `/api/auth/is_first_user` | +| `GET` | `/api/auth/profile` | +| `PUT` | `/api/auth/profile` | +| `PUT` | `/api/auth/profile/avatar` | +| `DELETE` | `/api/auth/profile/avatar` | +| `GET` | `/api/auth/avatar/{user_id}` | +| `PUT` | `/api/auth/profile/password` | +| `GET` | `/api/auth/devices` | +| `POST` | `/api/auth/devices` | +| `DELETE` | `/api/auth/devices/{device_credential_id}` | +| `GET` | `/api/auth/users` | +| `GET` | `/api/auth/profile/learner-profile` | +| `PUT` | `/api/auth/profile/learner-profile` | +| `GET` | `/api/auth/users/{username}/learner-profile` | +| `PUT` | `/api/auth/users/{username}/learner-profile` | +| `POST` | `/api/auth/users` | +| `POST` | `/api/auth/users/import` | +| `DELETE` | `/api/auth/users/{username}` | +| `POST` | `/api/auth/users/batch-delete` | +| `PUT` | `/api/auth/users/{username}/role` | +| `PUT` | `/api/auth/users/{username}/password` | + +#### `capabilities:router` — `/api/capabilities` · learning + +| Method | Path | +| --- | --- | +| `GET` | `/api/capabilities/registered` | + +#### `capabilities_settings:router` — `/api/capabilities` · learning + +| Method | Path | +| --- | --- | +| `GET` | `/api/capabilities/settings` | +| `PUT` | `/api/capabilities/settings` | + +#### `creations:router` — `/api/creations` · learning + +| Method | Path | +| --- | --- | +| `GET` | `/api/creations/drafts/{draft_id}` | +| `POST` | `/api/creations/drafts/{draft_id}/approve` | + +#### `dashboard:router` — `/api/dashboard` · learning + +| Method | Path | +| --- | --- | +| `GET` | `/api/dashboard/recent` | +| `GET` | `/api/dashboard/suggestions` | +| `POST` | `/api/dashboard/suggestions/refresh` | +| `GET` | `/api/dashboard/learning-index` | +| `GET` | `/api/dashboard/source-library/{kind}` | +| `GET` | `/api/dashboard/learning-library/{kind}` | +| `GET` | `/api/dashboard/{entry_id}` | + +#### `file_preview:router` — `/api/file-preview` · authenticated + +| Method | Path | +| --- | --- | +| `GET` | `/api/file-preview/pdf` | +| `POST` | `/api/file-preview/pdf` | + +#### `imports:router` — `/api/imports` · learning + +| Method | Path | +| --- | --- | +| `POST` | `/api/imports/chat-history` | +| `GET` | `/api/imports/chat-history` | + +#### `learning_journal:router` — `/api/learning-journal` · learning + +| Method | Path | +| --- | --- | +| `GET` | `/api/learning-journal` | + +#### `modules:router` — `/api/modules` · authenticated + +| Method | Path | +| --- | --- | +| `GET` | `/api/modules` | + +#### `multi_user:router` — `/api/multi-user` · learning + +| Method | Path | +| --- | --- | +| `GET` | `/api/multi-user/admin/resources` | +| `GET` | `/api/multi-user/admin/books` | +| `GET` | `/api/multi-user/guardians` | +| `POST` | `/api/multi-user/guardians` | +| `DELETE` | `/api/multi-user/guardians/{relationship_id}` | +| `GET` | `/api/multi-user/me/guardianships` | +| `DELETE` | `/api/multi-user/me/guardianships/{relationship_id}` | +| `GET` | `/api/multi-user/learners/{learner_user_id}/guardian-report` | +| `GET` | `/api/multi-user/learners/{learner_user_id}/materials` | +| `PUT` | `/api/multi-user/learners/{learner_user_id}/materials` | +| `GET` | `/api/multi-user/learners/{learner_user_id}/restrictions` | +| `PUT` | `/api/multi-user/learners/{learner_user_id}/restrictions` | +| `POST` | `/api/multi-user/learners/{learner_user_id}/credentials/reset` | +| `GET` | `/api/multi-user/users/{user_id}/grants` | +| `PUT` | `/api/multi-user/users/{user_id}/grants` | +| `GET` | `/api/multi-user/users/{user_id}/book-permission` | +| `PUT` | `/api/multi-user/users/{user_id}/book-permission` | +| `POST` | `/api/multi-user/admin/skills/install` | +| `GET` | `/api/multi-user/users` | + +#### `plugins:router` — `/api/plugins` · public + +| Method | Path | +| --- | --- | +| `GET` | `/api/plugins/extensions` | +| `GET` | `/api/plugins/{plugin_id}/pages/{extension_id}` | +| `GET` | `/api/plugins/{plugin_id}/pages/{extension_id}/` | +| `GET` | `/api/plugins/{plugin_id}/pages/{extension_id}/assets/{asset_path:path}` | +| `GET` | `/api/plugins/catalog` | +| `GET` | `/api/plugins/state` | +| `GET` | `/api/plugins/{plugin_id}/info` | +| `POST` | `/api/plugins/{plugin_id}/approve` | +| `POST` | `/api/plugins/{plugin_id}/enable` | +| `POST` | `/api/plugins/{plugin_id}/disable` | +| `POST` | `/api/plugins/{plugin_id}/install` | +| `POST` | `/api/plugins/{plugin_id}/rollback` | +| `DELETE` | `/api/plugins/{plugin_id}/installation` | +| `GET` | `/api/plugins/{plugin_id}/{plugin_path:path}` | +| `POST` | `/api/plugins/{plugin_id}/{plugin_path:path}` | +| `PUT` | `/api/plugins/{plugin_id}/{plugin_path:path}` | +| `PATCH` | `/api/plugins/{plugin_id}/{plugin_path:path}` | +| `DELETE` | `/api/plugins/{plugin_id}/{plugin_path:path}` | + +#### `sessions:router` — `/api/sessions` · learning + +| Method | Path | +| --- | --- | +| `GET` | `/api/sessions/capabilities` | +| `POST` | `/api/sessions/submission-replacement` | +| `GET` | `/api/sessions` | +| `GET` | `/api/sessions/search` | +| `GET` | `/api/sessions/recycle-bin` | +| `POST` | `/api/sessions/{session_id}/migrate-watching` | +| `GET` | `/api/sessions/{session_id}` | +| `GET` | `/api/sessions/{session_id}/organization` | +| `GET` | `/api/sessions/{session_id}/threads` | +| `GET` | `/api/sessions/{session_id}/messages/{message_id}/events` | +| `GET` | `/api/sessions/{session_id}/ask-hint` | +| `PATCH` | `/api/sessions/{session_id}` | +| `PATCH` | `/api/sessions/{session_id}/reply-language` | +| `PATCH` | `/api/sessions/{session_id}/organization` | +| `DELETE` | `/api/sessions/{session_id}` | +| `POST` | `/api/sessions/{session_id}/restore` | +| `DELETE` | `/api/sessions/{session_id}/purge` | +| `PUT` | `/api/sessions/{session_id}/branch-selection` | +| `DELETE` | `/api/sessions/{session_id}/messages/{message_id}` | +| `POST` | `/api/sessions/{session_id}/quiz-results` | + +#### `settings:public_router` — `/api/settings` · public + +| Method | Path | +| --- | --- | +| `GET` | `/api/settings/ui` | + +#### `settings:router` — `/api/settings` · learning + +| Method | Path | +| --- | --- | +| `GET` | `/api/settings` | +| `POST` | `/api/settings/providers/openai-codex/oauth/start` | +| `GET` | `/api/settings/providers/openai-codex/oauth/status` | +| `POST` | `/api/settings/providers/openai-codex/oauth/complete` | +| `POST` | `/api/settings/providers/openai-codex/oauth/cancel` | +| `POST` | `/api/settings/providers/openai-codex/oauth/logout` | +| `POST` | `/api/settings/providers/openai-codex/models/refresh` | +| `GET` | `/api/settings/providers/codebuddy/auth/status` | +| `POST` | `/api/settings/providers/codebuddy/auth/start` | +| `POST` | `/api/settings/providers/codebuddy/auth/cancel` | +| `POST` | `/api/settings/providers/codebuddy/auth/logout` | +| `POST` | `/api/settings/providers/openai-codex/models/reasoning-effort` | +| `GET` | `/api/settings/catalog` | +| `GET` | `/api/settings/network` | +| `PUT` | `/api/settings/network` | +| `GET` | `/api/settings/web-fetch` | +| `PUT` | `/api/settings/web-fetch` | +| `GET` | `/api/settings/chat-attachments` | +| `GET` | `/api/settings/chat-starters` | +| `PUT` | `/api/settings/chat-starters` | +| `PUT` | `/api/settings/chat-attachments` | +| `GET` | `/api/settings/mineru` | +| `PUT` | `/api/settings/mineru` | +| `GET` | `/api/settings/document-parsing` | +| `GET` | `/api/settings/readiness` | +| `GET` | `/api/settings/profile` | +| `POST` | `/api/settings/profile/diff` | +| `GET` | `/api/settings/presets` | +| `POST` | `/api/settings/presets/{preset_id}/draft` | +| `PUT` | `/api/settings/document-parsing` | +| `POST` | `/api/settings/document-parsing/test` | +| `POST` | `/api/settings/document-parsing/docling/test` | +| `POST` | `/api/settings/document-parsing/tika/test` | +| `POST` | `/api/settings/document-parsing/install` | +| `POST` | `/api/settings/document-parsing/models/download` | +| `GET` | `/api/settings/document-parsing/job/status` | +| `POST` | `/api/settings/document-parsing/job/cancel` | +| `POST` | `/api/settings/mineru/models/download` | +| `GET` | `/api/settings/mineru/models/download/status` | +| `POST` | `/api/settings/mineru/models/download/cancel` | +| `POST` | `/api/settings/mineru/test` | +| `GET` | `/api/settings/llm-options` | +| `PUT` | `/api/settings/catalog` | +| `POST` | `/api/settings/apply/registry` | +| `POST` | `/api/settings/apply/provider` | +| `POST` | `/api/settings/apply/service` | +| `GET` | `/api/settings/draft` | +| `PUT` | `/api/settings/draft` | +| `DELETE` | `/api/settings/draft` | +| `POST` | `/api/settings/apply` | +| `POST` | `/api/settings/test-provider` | +| `POST` | `/api/settings/fetch-models` | +| `POST` | `/api/settings/model-capabilities` | +| `PUT` | `/api/settings/theme` | +| `PUT` | `/api/settings/language` | +| `PUT` | `/api/settings/voice-autoplay` | +| `PUT` | `/api/settings/voice-math-speak` | +| `PUT` | `/api/settings/chat-response-timeout` | +| `GET` | `/api/settings/page-customization` | +| `PUT` | `/api/settings/page-customization/chat` | +| `PUT` | `/api/settings/page-customization/learning` | +| `GET` | `/api/settings/display` | +| `PUT` | `/api/settings/ui` | +| `POST` | `/api/settings/reset` | +| `GET` | `/api/settings/themes` | +| `GET` | `/api/settings/sidebar` | +| `PUT` | `/api/settings/sidebar/description` | +| `PUT` | `/api/settings/sidebar/nav-order` | +| `PUT` | `/api/settings/enabled-tools` | +| `POST` | `/api/settings/voice/voices` | +| `POST` | `/api/settings/voice/preview` | +| `POST` | `/api/settings/services/{service}/preview` | +| `POST` | `/api/settings/tests/{service}/start` | +| `GET` | `/api/settings/tests/{service}/{run_id}/events` | +| `POST` | `/api/settings/tests/{service}/{run_id}/cancel` | +| `GET` | `/api/settings/tour/status` | +| `POST` | `/api/settings/tour/complete` | +| `POST` | `/api/settings/tour/reopen` | +| `GET` | `/api/settings/usage` | + +#### `mcp_settings:router` — `/api/settings/mcp` · learning + +| Method | Path | +| --- | --- | +| `GET` | `/api/settings/mcp` | +| `PUT` | `/api/settings/mcp` | +| `PUT` | `/api/settings/mcp/servers/{name}` | +| `DELETE` | `/api/settings/mcp/servers/{name}` | +| `POST` | `/api/settings/mcp/test` | + +#### `workspace:settings_router` — `/api/settings/workspace` · learning + +| Method | Path | +| --- | --- | +| `GET` | `/api/settings/workspace/folders` | +| `POST` | `/api/settings/workspace/knowledge-bases/preview-move` | +| `POST` | `/api/settings/workspace/knowledge-bases/move` | +| `GET` | `/api/settings/workspace/data/discover` | +| `POST` | `/api/settings/workspace/data/preview` | +| `POST` | `/api/settings/workspace/data/migrate` | +| `POST` | `/api/settings/workspace/data/export` | +| `GET` | `/api/settings/workspace/data/operations` | +| `POST` | `/api/settings/workspace/data/operations/{operation_id}/recover` | +| `GET` | `/api/settings/workspace/data/exports/{operation_id}` | +| `GET` | `/api/settings/workspace/registrations` | +| `POST` | `/api/settings/workspace/registrations/migrate-root` | +| `POST` | `/api/settings/workspace/registrations/{workspace_id}/migrate` | +| `POST` | `/api/settings/workspace/registrations/system-snapshot` | +| `GET` | `/api/settings/workspace/registrations/system-snapshot` | +| `GET` | `/api/settings/workspace/resource-usage` | +| `GET` | `/api/settings/workspace/resources` | +| `POST` | `/api/settings/workspace/registrations` | +| `PATCH` | `/api/settings/workspace/registrations/{workspace_id}` | +| `GET` | `/api/settings/workspace` | +| `POST` | `/api/settings/workspace/validate` | +| `PUT` | `/api/settings/workspace` | + +#### `skills:router` — `/api/skills` · learning + +| Method | Path | +| --- | --- | +| `GET` | `/api/skills/tags/list` | +| `POST` | `/api/skills/tags/create` | +| `PUT` | `/api/skills/tags/{tag}` | +| `DELETE` | `/api/skills/tags/{tag}` | +| `GET` | `/api/skills/list` | +| `GET` | `/api/skills/hub/catalog` | +| `GET` | `/api/skills/hub/detail` | +| `GET` | `/api/skills/{name}` | +| `POST` | `/api/skills/create` | +| `POST` | `/api/skills/install` | +| `PUT` | `/api/skills/{name}` | +| `DELETE` | `/api/skills/{name}` | + +#### `space_cli_apps:router` — `/api/space/cli-apps` · learning + +| Method | Path | +| --- | --- | +| `GET` | `/api/space/cli-apps/apps` | +| `PUT` | `/api/space/cli-apps/apps/{app_id}/enabled` | +| `GET` | `/api/space/cli-apps/catalog` | +| `POST` | `/api/space/cli-apps/catalog/{app_id}/install` | +| `DELETE` | `/api/space/cli-apps/apps/{app_id}` | + +#### `space_mcp:router` — `/api/space/mcp` · learning + +| Method | Path | +| --- | --- | +| `GET` | `/api/space/mcp/servers` | +| `PUT` | `/api/space/mcp/servers/{name}` | +| `DELETE` | `/api/space/mcp/servers/{name}` | +| `POST` | `/api/space/mcp/servers/{name}/authorize` | +| `GET` | `/api/space/mcp/oauth/callback` | +| `POST` | `/api/space/mcp/servers/{name}/test` | +| `GET` | `/api/space/mcp/catalog` | +| `POST` | `/api/space/mcp/catalog/{entry_id}/install` | + +#### `subagents:router` — `/api/subagents` · learning + +| Method | Path | +| --- | --- | +| `GET` | `/api/subagents/detect` | +| `GET` | `/api/subagents/backends/options` | +| `POST` | `/api/subagents/backends/{kind}/sync` | +| `GET` | `/api/subagents/connections` | +| `POST` | `/api/subagents/connections` | +| `DELETE` | `/api/subagents/connections/{name}` | +| `POST` | `/api/subagents/connections/{name}/message` | +| `GET` | `/api/subagents/settings` | +| `PUT` | `/api/subagents/settings` | + +#### `system:router` — `/api/system` · learning + +| Method | Path | +| --- | --- | +| `GET` | `/api/system/runtime` | +| `GET` | `/api/system/update` | +| `POST` | `/api/system/update/check` | +| `PUT` | `/api/system/update/settings` | +| `GET` | `/api/system/update/job` | +| `POST` | `/api/system/update` | +| `GET` | `/api/system/status` | +| `GET` | `/api/system/memory` | +| `POST` | `/api/system/test/llm` | +| `POST` | `/api/system/test/embeddings` | +| `POST` | `/api/system/test/search` | + +#### `task_board:router` — `/api/task-board` · learning + +| Method | Path | +| --- | --- | +| `GET` | `/api/task-board` | +| `GET` | `/api/task-board/events` | +| `POST` | `/api/task-board/cards` | +| `PATCH` | `/api/task-board/cards/{card_id}` | +| `PUT` | `/api/task-board/colors` | +| `PUT` | `/api/task-board/sessions/{session_id}` | +| `PATCH` | `/api/task-board/sessions/{session_id}/status` | + +#### `tools:router` — `/api/tools` · learning + +| Method | Path | +| --- | --- | +| `GET` | `/api/tools` | + +#### `attachments:router` — `/files/attachments` · learning + +| Method | Path | +| --- | --- | +| `GET` | `/files/attachments/{session_id}/{attachment_id}/{filename:path}` | + +#### `file_library:router` — `/files/library` · learning + +| Method | Path | +| --- | --- | +| `GET` | `/files/library/` | +| `POST` | `/files/library/` | +| `GET` | `/files/library/search` | +| `GET` | `/files/library/{file_id}` | +| `GET` | `/files/library/{file_id}/download` | +| `HEAD` | `/files/library/{file_id}/download` | +| `DELETE` | `/files/library/{file_id}` | +| `POST` | `/files/library/{file_id}/restore` | + +#### `outputs:router` — `/files/outputs` · public + +| Method | Path | +| --- | --- | +| `HEAD` | `/files/outputs/{output_path:path}` | +| `GET` | `/files/outputs/{output_path:path}` | + +#### `quiz_judge:router` — `/ws` · public + +| Method | Path | +| --- | --- | +| `WS` | `/ws/questions/judge` | + +### visualize + +#### `visualizers:router` — `/api/visualizers` · learning + +| Method | Path | +| --- | --- | +| `GET` | `/api/visualizers/list` | +| `POST` | `/api/visualizers/bundled/{visualizer_id}/install` | +| `POST` | `/api/visualizers/{visualizer_id}/enable` | +| `POST` | `/api/visualizers/{visualizer_id}/disable` | +| `DELETE` | `/api/visualizers/{visualizer_id}` | +| `POST` | `/api/visualizers/import` | +| `GET` | `/api/visualizers/{visualizer_id}/assets/{asset_path:path}` | diff --git a/docs/src/content/docs/developers/reference/turn-protocol.md b/docs/src/content/docs/developers/reference/turn-protocol.md new file mode 100644 index 000000000..77ff5e8f9 --- /dev/null +++ b/docs/src/content/docs/developers/reference/turn-protocol.md @@ -0,0 +1,35 @@ +--- +title: Turn protocol +description: Client commands and server events on the unified turn WebSocket. +quadrant: reference +--- + +The web UI and `deeptutor run --format json` share one socket: + +```text +WS /ws +``` + +Commands and events are the models in `deeptutor/api/contracts/turn_protocol.py`. Extra fields are rejected. Current commands set `protocol_version` to `"2.0"`. How to open the socket and authenticate is on the [HTTP API](/developers/reference/http-api/) page. + +## Commands + +| `type` | Required fields | +| --- | --- | +| `start_turn` or `message` | The turn request: `content`, and optional `capability`, `session_id`, `tools`, `knowledge_bases`, `language`, `config`, `skills`, references, and `attachments`. `skills` narrows `read_skill` to its intersection with the workspace allowlist (omitting or sending `[]` inherits the workspace's visible set). | +| `subscribe_turn` | `turn_id`, optional `after_seq` | +| `subscribe_session` | `session_id`, optional `after_seq` | +| `resume_from` | `turn_id`, optional `seq` | +| `unsubscribe` | `turn_id` or `session_id` | +| `cancel_turn` | `turn_id`, `command_id` | +| `regenerate` | `session_id`, optional `overrides` | +| `submit_user_reply` | The reply payload defined on `SubmitUserReplyCommand` | +| `ping` | none | + +Subscriptions replay events after `after_seq`. A terminal turn ends with `done`. A failed turn emits `error` first. + +## Events + +`stage_start`, `stage_end`, `thinking`, `observation`, `content`, `tool_call`, `tool_result`, `progress`, `sources`, `result`, `error`, `session`, `session_meta`, `wait_for_input`, `done`. + +Control messages on the same socket also include `pong`, a command acknowledgement, and a protocol error. Their fields are the corresponding models in `turn_protocol.py`. diff --git a/docs/src/content/docs/ecosystem/index.md b/docs/src/content/docs/ecosystem/index.md deleted file mode 100644 index 35beace45..000000000 --- a/docs/src/content/docs/ecosystem/index.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -title: DeepTutor Ecosystem -description: Extend DeepTutor through RAG integrations, reusable Skills, remote MCP services, sandboxed CLI Apps, and EduHub. -quadrant: explanation ---- - -DeepTutor's built-in learning surfaces cover the everyday product. The **ecosystem** is how you add behavior and tools without changing that core: connect a retrieval engine, teach the model a workflow, connect an external service, install a command-line application, or discover community Skills. - -![Personalization and reusable account resources](/screenshots/dev/personalization.png) - -## Five extension paths - -| Extension | What it adds | Ownership | -|---|---|---| -| [**Skills**](/ecosystem/skills/) | `SKILL.md` playbooks the model reads when a workflow calls for them | Built-in, local, ClawHub, or EduHub | -| [**MCP Services**](/ecosystem/mcp/) | Tools exposed by hosted or deployment-managed MCP servers | Per account for remote services; admin for deployment registry | -| [**CLI Apps**](/ecosystem/cli-apps/) | Installed command-line programs exposed to turns as sandboxed tools | Admin installs and grants; permitted accounts run | -| [**RAG Integration**](/ecosystem/rag-integration/) | Local, agentic, remote, or live-library retrieval behind a Knowledge Base | Deployment configuration plus per-KB choice | -| [**EduHub**](/ecosystem/eduhub/) | Community discovery, versioning, import, and publishing for Skills | Community authors publish; users review and import | - -The trust boundary is different for each path. RAG integrations own retrieval, a Skill is instructions, an MCP service is a remote tool boundary, and a CLI App is code installed on the host. EduHub distributes Skills without becoming their runtime. DeepTutor therefore gives each path a different configuration, installation, credential, sandbox, and grant model. - -## Where they appear in the product - -Knowledge engines are selected through the **Knowledge Center**. Skills, MCP Services, and CLI Apps are managed from **Personalization**, with EduHub embedded in the Skills importer. Once enabled, tools appear to the Home agent through the same discovery flow as built-ins. - -## Start with a workspace task - -Keep course or project files in that workspace's **Resources**, study them through **Learning**, and use **Home** to ask for an explanation or create an output. [Personalization](/explore/personalization/) is the account shelf from which you supply personas, skills, agents, and connections. The same shelf remains available across workspace switches. - -For skills and MCP services, configure the workspace's **Assigned resources** in Settings, then narrow the current conversation if needed. Workspace assignments reference the account catalog; they do not copy credentials or bypass user grants. CLI Apps have their own administrator installation and grant controls. RAG remains associated with a Knowledge Base and the materials it retrieves. - -## Next - -Start with [RAG Integration](/ecosystem/rag-integration/) when retrieval is the extension point. Use [Skills](/ecosystem/skills/) for repeatable workflows, [MCP Services](/ecosystem/mcp/) for account-connected online services, and [CLI Apps](/ecosystem/cli-apps/) when the job needs a real command-line program. Visit [EduHub](/ecosystem/eduhub/) to discover or publish community Skills. diff --git a/docs/src/content/docs/explore/chat-workspace.md b/docs/src/content/docs/explore/chat-workspace.md deleted file mode 100644 index b9ca31bfb..000000000 --- a/docs/src/content/docs/explore/chat-workspace.md +++ /dev/null @@ -1,205 +0,0 @@ ---- -title: Chat -description: "The default DeepTutor agent loop — capabilities, session context, reusable references, tools, the Activity panel, and the models behind it all." -quadrant: how-to ---- - -Home is the heart of DeepTutor. It is not a plain message box: it is the **default agent loop** that can call tools, read your sources, search knowledge bases, write notes, generate images, consult other agents, ask you clarifying questions, and switch into deeper capabilities — all inside one thread. - -## Where it is - -Select your [workspace](/explore/workspaces/), then open **Home → Chat** (`/chat`). Home also contains the [Task Board](/explore/task-board/), [Learning notebook](/explore/co-writer/) and [Calendar](/explore/calendar/). Chat, tasks and notebook pages follow the workspace; Calendar events are account level, with workspace study layers. - -![Home and the conversation composer](/screenshots/dev/overview.png) - -The window has three regions: - -| Region | What it does | -| --- | --- | -| **Left sidebar** | The workspace menu sits above **Home**, **Learning** and **Resources**. **Partners** and **Personalization** are account-level areas. Conversations reopen with their learning context; Settings and workspace management are available from the workspace menu. Classic layout uses a different navigation arrangement. | -| **Composer** | The message box. Its **bottom-left** sets *what kind of turn* this is (capability) and adds references (`+`); its **bottom-right** exposes connected-agent, knowledge, persona, and model selectors. The microphone only transcribes the current message. | -| **Activity panel** (top-right toggle) | Tool calls, references, generated files, attachments, and previews for the current session, plus a quick way to open a URL or local file. | - -With authentication enabled, signed-in users also see **My profile** in the sidebar. It shows the username (not editable here), role, and join date; use it to upload an avatar image or choose an icon and color, and to sign out. - -The top-right icons above the thread let you **save useful content to Favorites**, **export the session as Markdown**, and **toggle the Activity panel**. - -## Your first useful conversation - -1. Select the workspace for your project and open a new Chat. -2. Add a PDF or a specific saved reference with the resource control; attach a knowledge base when you need retrieval across its library. -3. State the outcome and constraints: “Explain the sampling theorem using this lecture, then give me two questions. Let me try before showing answers.” -4. Follow tool progress in Activity and open cited sources or generated files when you need to inspect the evidence. -5. Save a useful result to [Favorites](/explore/favorites/), or develop your own explanation in the [Learning notebook](/explore/co-writer/). Reopen the conversation from Resources → Chat History. - -Selecting a connected agent is by default a persistent choice for the session; importing an old agent transcript is a reference. Likewise, an attached file supplies this turn's material by default, while workspace instructions and session preferences shape later turns. Check the visible chips before sending if a reply seems to be using the wrong sources or persona. - -## Starting points - -Under the empty composer, Explain, Solve, Practice, Plan, and Research offer editable starting prompts. A separate personalized suggestion draws on your memory and recent activities; **Suggest something else** replaces it. Choose either to fill the composer, then review before sending. **Customize page → Starting prompts** edits the reusable titles and requests. - -**Settings → Conversation** sets how much history feeds them: raise the activity count for suggestions that range wider, lower it to keep them close to what you were just doing. - - -## The agent loop (how it thinks) - -DeepTutor Chat runs a single agent loop, so one message can take several internal rounds before you see an answer: - -1. The model reads your message and the mounted context, then either answers directly or plans a tool call. -2. If tools are needed, DeepTutor dispatches them and appends the observations (you can watch this in the Activity panel). -3. The model continues with better evidence — reading a source, querying a KB, running code, fetching a URL. -4. A final, tool-free message ends the turn. - -`ask_user` is special: instead of guessing, the agent can **pause the turn**, ask you a structured clarifying question, and resume once you answer. - -## Choosing a capability - -The selector at the bottom-left of the composer (the Modern layout labels the default **Auto**; Classic calls it **Chat**) decides which capability handles the turn. Capabilities share orchestration and session context; some reuse Chat's loop, while others run a purpose-built pipeline. - -The capability menu offers dedicated modes including **Ask Questions**, **Quiz**, **Visualize**, and **Video Lesson**; **Research** and **Solve** sit behind the *More Capabilities* flyout. **Mastery Path** and **Immersive Reading** are learning activities under **Learning**, alongside Books and Practice. The grouping is presentation only, not a statement about how any mode runs internally. - -| Capability | Use it for | -| --- | --- | -| **Chat** | Flexible conversation with any tool — open-ended Q&A, lightweight tool use, the everyday default. | -| **Ask Questions** | Start with a context-aware clarification card, then complete the original request using your answers. | -| **Quiz** | Auto-validated question generation: practice sets, mimic-an-exam workflows, quizzes from your sources. | -| **Visualize** | Charts, diagrams, interactive HTML, SVG, Mermaid, and Manim — selected from an extensible visualizer catalog. | -| **Video Lesson** | Generate a browser-played lesson with captions and optional narration from the configured Text-to-Speech provider or Edge; the backend needs Node.js 22+ and npm. | -| **Immersive Reading** (learning activity) | Documents, audio, and video with source-grounded tutoring; media transcripts use timestamps. | -| **Research** (under *More Capabilities*) | Comprehensive multi-agent research: subtopic decomposition, RAG / web / arXiv retrieval, cited reports. | -| **Solve** (under *More Capabilities*) | Multi-step reasoning and problem solving with verification and worked solutions. | - - -Video learning now opens in **Immersive Reading** collections, alongside documents and audio. YouTube playback uses the native player; Settings selects caption sources and configures optional Invidious browsing. The companion cites transcript timestamps and cannot see video frames. Without a transcript, playback remains available. Reopening a legacy Watching session migrates retained material and notes into Reading; if material is missing, the conversation remains available as Chat. - - -Visualize now reads its render modes from a catalog. SVG, Mermaid, Mermaid mind maps, Chart.js, interactive HTML, Manim animation, and Manim storyboard are core types; GeoGebra is a bundled optional install. You can also import a visualizer ZIP containing `visualizer.json` and browser assets. Imported renderers run in a sandboxed iframe, contain no backend Python, and can be enabled, disabled, or removed per user. - - -### Little Tutor — follow up on a selection - -Select text in a conversation and open **Little Tutor** to start an independent, source-grounded sidebar thread. It stays nested under the source conversation and keeps its own focused context without global memory or general-purpose tools, so a close reading does not derail the main thread. - -## Sticky context vs. one-time references - -DeepTutor splits context into two kinds, and the composer keeps them in two different places — this is the single most important idea to learn here. - -**Sticky session context** persists across turns until you change it: capability, workspace or course binding, tools, **knowledge bases**, **persona**, **model**, and Reading / Mastery state. The right side exposes the relevant selectors; an agent selected with the Agent chip or `@` stays attached by default, while the microphone only fills the current draft. - -**References** live behind the **`+` button** on the left. They default to *this* turn only; use the reuse control to reuse a supported reference on every turn. - - -| `+` reference | What it pulls in | -| --- | --- | -| **Attach files** | A PDF, image, Office doc, Markdown, or data file for the agent to read. | -| **Chat History** | A past session as grounding context. | -| **My Agents** | An imported Claude Code / Codex / ChatGPT transcript to explore — see [My Agents](/explore/subagents/). | -| **Books / Reading / Notebooks / Question Bank** | A compiled book, a reading section, a saved notebook, or practice questions from your [Resources](/explore/space/). Filter questions by material or category; **Select all** keeps earlier selections. | -| **Memory** | A specific memory document, when you want the agent to work from a fact you can point at rather than whatever recall surfaces. | - -Typing **`@`** in the main Chat composer filters the same connected-agent list as the Agent chip and keeps the selection attached by default. Follow-up surfaces without live-agent selection use `@` for their Space reference menu instead. - -### Knowledge — ground answers in your library - -The **database icon** opens the knowledge picker. Untouched conversations inherit ready workspace assignments or the default KB; explicit selections, including none, persist until changed. The agent retrieves from these bases when grounding is needed. - -How it retrieves depends on the base's engine, and the difference is worth knowing when an answer surprises you. Most bases — LlamaIndex, GraphRAG, LightRAG, a linked index, a remote LightRAG Server, a Tencent IMA library — are served by the `rag` tool. **PageIndex OSS** and **PageIndex Cloud** are not: their retrieval is agentic, so a reading loop walks the local or hosted document tree instead, and those bases are deliberately absent from `rag`'s list. An **Obsidian** vault has no index at all and is routed to the Obsidian capability, which navigates the live files; a **MarginNote 4** library is the same shape, walked by its own tools. - - -### Persona — set the voice and stance - -The **person icon** chooses a persona. `Default` is the plain assistant; built-ins like **peer**, **research-assistant**, and **teacher** change tone and pedagogy. Personas are managed under **Personalization → Personas** and can be reused by Partners. - - -### Model — switch per turn - -The **model chip** picks which model runs this turn. Every model you configured in Settings appears here with its provider and context window, and the default is marked. Switch to a long-context model for big documents, or a cheaper/faster one for quick exchanges — mid-session, without losing your place. - - -## The Activity panel - -The panel toggle (top-right) opens **Activity** — a live record of the tools, references, and files the current session has used — generated files listed above your uploads — plus an **Open** box to pull a URL or a local file into the in-app viewer. - -![Conversation and its activity controls](/screenshots/dev/chat.png) - -As a turn runs, each tool call collapses into a compact header (for example, `Done · 21s`) that you can expand to inspect inputs and outputs — so the thread stays readable while the full trace stays auditable. - -## Knowing how full the window is - -A chip in the composer reports how much of the model's context window this turn actually used and what is filling it — prompt blocks, tool schemas, the message list. It is measured from the assembled prompt rather than re-derived afterwards, so the readout cannot drift from what was sent. Open it to see the breakdown before deciding whether to switch to a longer-context model or start a fresh session. - -Long conversations also grow a rail of ticks in the transcript's left gutter, one per question you asked, for jumping back without scrolling. - -## Tools — including generation - -Tools come in three kinds, and the split is about who decides. - -**You decide** for the experience-enhancement tools in **Settings → Tools**: `brainstorm`, `web_search`, `paper_search`, `zotero_search`, `reason`, and `geogebra_analysis` — plus `imagegen` and `videogen` once you configure the matching generation model. - -**Context decides** for the rest, which mount automatically when they are useful and are locked on from the composer's point of view: `rag`, `kb_files`, `knowledge_frontier`, `read_source`, `read_memory`, `write_memory`, `read_skill`, `list_favorites`, `save_favorite`, `question_bank`, `web_fetch`, `github`, `preprint`, `research_audit`, `research_lit`, `learning_status`, `learning_update`, `ask_user`, `load_tools`, `cron`, `mastery_topics`, `mastery_sessions`, `mastery_open_session`, `mastery_new_session`, and the single code path `exec` (python, c, cpp, or shell). A capability adds its own on top: the eight reading tools, the mastery tutoring tools, `consult_subagent`, and so on. A third group answers to neither: the workspace baseline includes file tools plus `write_note` and `search_notes`, while `workspace_export` needs your approval to move a file out of `outputs/`. (Partners are the exception: a companion can be denied context-gated tools individually — see [Partners](/explore/partners/).) - -### Scheduling something for later - -`cron` lets a turn schedule work instead of doing it now: **at** a time, **every** N seconds, or on a **cron expression** with a timezone. When the job is due, its message runs as a new instruction **in this same conversation** and the reply lands here — so "quiz me on this chapter every weekday at 9" is a sentence, not a setup screen. The same tool lists this conversation's jobs and cancels one. For a Partner, a due job rides back out through the IM channel the partner is connected to. - -Configure an **Image Generation** (or Video Generation) model in Settings and it becomes a chat tool too — ask in plain language and the agent calls it, then previews the result inline with a downloadable file. - -## The content workspace - -The **content workspace** is the folder bound to a conversation. Unbound sessions use the General workspace; you can create custom workspaces for separate projects. The System workspace holds shared skills and sanitized configuration snapshots; private runtime settings, API keys, databases, and memory stay outside conversational file access. - -Manage roots, workspaces, and **Workspace instructions** in **Settings → Workspace**. Instructions apply from the next turn for supported capabilities, excluding Deep Research, Quiz, and Manim; capability rules and permissions still apply. Built-in and managed custom folders live under `/data/user/workspaces` by default. The CLI also manages the legacy content-folder binding: - -```bash -deeptutor workspace show -deeptutor workspace set /absolute/path/to/my-folder -deeptutor workspace reset -``` - -Reading is free; writing is not. Everything a turn creates — downloads, generated files, code output, rendered assets — lands under a turn-scoped `outputs////` directory. Execution is read-only everywhere else in the folder, and copying a generated file out of `outputs/` into the rest of your material takes an explicit **Allow once** confirmation naming that exact source and destination. - -The model never sees an absolute path — only relative ones such as `outputs/report.docx`. When it calls `workspace_present`, the UI renders an authenticated, openable snapshot; the same relative path also works in an ordinary Markdown link or image. Changing the source file later does not change a snapshot already presented. - -On Docker and server deployments the deployment folder constrains managed workspace storage — see [Docker](/get-started/docker/). - -## Configure what Chat can use - -Everything in the composer toolbar resolves to configuration in **Settings**. - -**Settings → Models & services** is where the models live: LLM, Task Models, Embedding, Search, Text-to-Speech, Speech-to-Text, Image Generation, and Video Generation. **Task Models** handles titles, suggestions, and reading helpers, with overrides per task; TTS powers read-aloud, STT powers the microphone, and image/video models become chat tools. - -![Provider connections in Settings](/screenshots/dev/providers.png) - -Separate **Settings** pages provide five controls: **Video Learning** (caption sources and optional Invidious browsing settings), **Tools**, **Capabilities** (per-capability LLM parameters and runtime knobs), **Starting points**, and **Attachments** (upload caps and extraction budgets). MCP services and CLI Apps live in account-level Personalization; see [DeepTutor Ecosystem](/ecosystem/). - - -See [Settings](/explore/settings/) for the full control plane. - -## On a phone - -Below tablet width the workspace collapses to a single column with a slide-over sidebar, so the same thread is usable on a phone rather than rendering a three-pane desktop layout off the edge of the viewport. - -## Practical examples - -```text -Attach a KB + ask: "Explain chapter 4 and quiz me on the weak spots." -``` - -```text -Attach a PDF + ask: "Extract the assumptions and save the final summary to my notebook." -``` - -```bash -deeptutor run chat "Explain the Fourier transform" --kb signals -deeptutor chat --capability deep_research --kb papers -``` - -## See also - -- [Immersive Reading](/explore/reading/) — the same loop, with documents or media open beside it -- [DeepTutor Ecosystem](/ecosystem/) — Skills, MCP Services, and CLI Apps the agent can call -- [Partners](/explore/partners/) — the same loop, running inside IM companions -- [My Agents](/explore/subagents/) — consult Claude Code, Codex, or a Partner from a chat turn -- [Knowledge Center](/explore/knowledge/) — build the RAG libraries you attach here -- [Memory](/explore/memory/) — the personalization the loop reads and writes -- [Settings](/explore/settings/) — models, tools, capabilities, and runtime control diff --git a/docs/src/content/docs/explore/index.md b/docs/src/content/docs/explore/index.md deleted file mode 100644 index 7622877a2..000000000 --- a/docs/src/content/docs/explore/index.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -title: A connected learning workflow -description: Follow one project through workspace-scoped Home, Learning, and Resources, with account-level Partners and Personalization. -quadrant: tutorial ---- - -The sidebar is a map of **where your work belongs**. Choose a workspace first, then move between its conversations, learning activities, and reusable sources. Your account supplies the companions and preferences you can bring into that work. - -## Two scopes, five shelves - -| Shelf | Scope | What you use it for | -| --- | --- | --- | -| [Chat](/explore/chat-workspace/) | Workspace | Conversations, a task board, and your Learning notebook | -| [Learning](/explore/learning/) | Workspace | Books, Mastery Paths, Reading collections, and Practice | -| [Resources](/explore/space/) | Workspace | Chat history, Favorites, question bank, learning journal, and knowledge bases | -| [Partners](/explore/partners/) | Account | Persistent companions, their instructions, resource access, and channels | -| [Personalization](/explore/personalization/) | Account | Personas, skills, connected agents, MCP, CLI apps, and memory controls | - -**Calendar is an exception within Home:** it offers an account-wide view across workspaces. [Calendar](/explore/calendar/) explains how to read the source workspace of an event. A Partner also has an explicit working context: its account-level identity does not mean every conversation can read every workspace. - -## 1. Give a project its own workspace - -Create or select a workspace for “Signals and sampling.” Keep its lecture notes and exercises separate from another project such as “Academic writing.” Before adding material or starting a learning activity, check the active workspace. Switching changes the first three shelves’ contents, while your Partner and Personalization libraries remain available. See [scope and switching](/explore/workspaces/). - -## 2. Bring in sources, then ask a focused question - -Add reusable material to [Knowledge Center](/explore/knowledge/), or open a specific document in [Reading](/explore/reading/) when you want to work beside the source. In Home, attach the relevant context and ask something concrete: “Explain why low sampling rates can make two different signals look identical; cite this primer.” - -A stored asset is not automatically included in every model request. Attach sources or select the supported learning context explicitly. Check cited passages before building on an answer. - -## 3. Separate evidence from your own understanding - -Save useful original passages to [Favorites](/explore/favorites/). Then write your interpretation in a [Learning notebook](/explore/co-writer/), inserting references where useful. The notebook is where you develop an explanation; Favorites preserves the material you may want to reuse. Reopen the source when a claim needs checking, and use Dito beside a paragraph when you need help improving it. - -## 4. Choose the learning activity that fits - -- Use [Books](/explore/book/) for a structured sequence of pages and interactive blocks. -- Use [Mastery Path](/explore/mastery-path/) for a goal broken into topics and guided study. -- Use [Reading](/explore/reading/) for questions tied to a document or media timestamp. -- Use [Practice](/explore/practice/) to answer, inspect feedback, and revisit weak areas. - -These are different ways to work with a topic, not steps you must complete in order. Start with one and use the supported capture or attachment controls to connect it to the next. - -## 5. Reuse assistance without mixing projects - -Choose a persona that asks you to explain your reasoning. Add a relevant skill when you need a repeatable method. Connect an external agent for consultation, or configure a Partner with a particular role and resource scope. Those account assets remain available in another workspace, while each workspace keeps its own learning records and materials. - -## Return to the work - -Use Home’s [Task Board](/explore/task-board/) for next actions, [Resources](/explore/space/) for saved evidence and history, and the Learning list to reopen an activity. You do not need to repeat setup or recreate a Partner whenever you switch subjects. diff --git a/docs/src/content/docs/explore/learning.md b/docs/src/content/docs/explore/learning.md deleted file mode 100644 index 1f9f2c915..000000000 --- a/docs/src/content/docs/explore/learning.md +++ /dev/null @@ -1,39 +0,0 @@ ---- -title: Learning -description: Choose a learning activity, resume your records, and connect reading, structured study and daily practice. -quadrant: explanation ---- - -**Learning** is the current workspace's study area. Open it from the sidebar to create an activity, search existing records, or continue where you stopped. In the Classic layout this area is called **Personalized Learning**. - -![Learning activities in one workspace](/screenshots/dev/learning.png) - -## Choose a way to learn - -| Activity | Start with | What you keep | -| --- | --- | --- | -| [Books](/explore/book/) | A subject and optional source material | An editable chapter plan, generated pages, reading position and page conversations | -| [Mastery Path](/explore/mastery-path/) | A goal describing what you want to be able to do | A knowledge-point map, topic conversations and mastery evidence | -| [Practice](/explore/practice/) | Collected or imported questions | Answers, mistakes, recall ratings and next review dates | -| [Immersive Reading](/explore/reading/) | A document, web page, video or audio source | A material collection, source-linked conversations, highlights and notes | - -Books build a resource to read; Mastery Path tracks abilities; Practice exercises recall; Immersive Reading stays close to an existing source. Pick the one that fits the task, then move between them as needed. - -## Start and resume - -1. Check the selected [workspace](/explore/workspaces/). -2. Use the create control in Learning or the sidebar's new-learning entry. Choose an activity and provide its topic, goal or materials. -3. Reopen the resulting record from **All learning** or the feature's own library. -4. Filter by activity type or search by title when the list grows. **Show more** reveals older records. - -The overview orders activity by recent updates. Books show reading progress; paths show mastered knowledge points. **What needs your attention** highlights due path reviews and books still compiling or paused. A paused book needs inspection before you treat it as complete. If one source fails to load, retry that source; an incomplete overview does not mean your records were deleted. - -## Turn a chapter into lasting knowledge - -For a probability exam, import your lecture PDF into Reading and ask about a difficult proof. Use the clarified objective to create a Mastery Path. Save a concise explanation to Favorites and insert it into your Learning notebook beside your own worked example. Review collected questions in Practice the next day. You can also generate a Book when you need a coherent account of the whole subject. - -[Resources](/explore/space/) holds the reusable inputs and saved results. **Learning journal** records the current mission, session handoff and confirmed learning records; it complements individual activity progress. - -## Access and scope - -Activities depend on the modules, models and account permissions available in your deployment. A locked or missing feature may require administrator access or module setup. Learning records belong to the active workspace; switching workspace changes the library. Partners and Personalization remain available across workspaces. In shared deployments, administrators manage the model catalog and user grants govern model access. diff --git a/docs/src/content/docs/explore/partners.md b/docs/src/content/docs/explore/partners.md deleted file mode 100644 index a7975ccc9..000000000 --- a/docs/src/content/docs/explore/partners.md +++ /dev/null @@ -1,103 +0,0 @@ ---- -title: Partners -description: Persistent IM-connected companions that run on the same chat agent loop as DeepTutor Chat — with their own soul, library, memory, and channels. -quadrant: how-to ---- - -Partners are persistent companions with their own identity, soul, model policy, library, memory, and channel configuration. They are not a separate bot engine: every inbound message — from the web or from an IM app — is routed through the **same** `ChatOrchestrator → AgenticChatPipeline` loop that powers [Home](/explore/chat-workspace/). A Partner is "a chat that has a personality and a phone number." - -## Where it is - -Open the account-level **Partners** entry in the left sidebar. The page lists the companions you own and any that an admin assigned to you, with their avatar, status, description, and connected channels. It also shows your Partner Groups and a **New partner** button. - -![Partners library](/screenshots/dev/partners.png) - -## Account companions and workspace resources - -**Partners belongs to your account.** The same companions and Partner Groups appear as you switch workspaces. A Partner's identity, channels, and relationship history therefore do not disappear when you move from a course to a research project. - -For resources, choose one of two arrangements in **Configure → Workspace**: - -| Arrangement | What the Partner uses | When to choose it | -| --- | --- | --- | -| **Partner private workspace** | Its own library; assign knowledge bases, skills, and Favorites collections as copies | A stable specialist companion whose materials should evolve separately | -| **An existing workspace** | That workspace's current files, knowledge bases, skills, and Favorites collections; generated files go to its outputs folder | A project or course companion that should stay synchronized with your work | - -The workspace picker lists workspaces belonging to the Partner's owner. Binding one does not transfer ownership or grant access to another user's resources. Resource choices and the owner's model/tool grants still constrain the turn. Changing the binding applies from the next message; it does not move previous conversations into Home. - -In private mode, ordinary KBs, skills, and Favorites collections are copied when assigned. Editing the original later does not update the copy. Connected knowledge bases have no folder to copy, so supported connections retain a live source pointer instead. In bound mode, manage shared materials in that workspace's **Resources** and use **Learning** to study the same source collection; you do not also copy a private Library onto the Partner. - -The Partner retains its own soul and relationship state in both modes. Channel runtime state lives under `data/partners//channels//`. For an authenticated non-admin user, conversation history and relationship memory are private per user under `users//`; the Partner can also read that user's own shared memory. Admin and unattributed channel turns use the Partner's top-level history and memory as a fallback. Sharing materials does not merge these private relationships. - -## Ownership and shared access - -Partners are no longer admin-only resources. Any authenticated user can create one and becomes its owner; the owner and admins can configure its soul, library, channels, tools, models, and lifecycle. An admin can assign a Partner to other users, who may chat with it without seeing or changing its wiring. - -That split matters when a Partner is shared: identity and knowledge assets stay consistent, while each human keeps private sessions and relationship memory. An external IM account can join the same private scope after the user links it with `/link ` in a direct message. - -## Create a partner - -Press **New partner** and complete the wizard: - -1. **Identity** — name, avatar, description, and default reply language. -2. **Soul** — the partner's role and communication style. This becomes its `SOUL.md`. -3. **Mind** — model selection, enabled system tools, MCP tools, and delivery preferences. -4. **Library** — choose a private workspace and copy permitted assets, or bind an existing workspace for live shared resources. Private copying excludes Obsidian, MarginNote, and subagent bases. -5. **Review** — check identity, model, workspace, and selected assets, then create the Partner. Add channels afterwards; they are optional. - -Everything chosen here stays editable afterwards from the partner detail page. - -## Talk to a partner - -Open a partner to land on its **Chat** tab — a full conversation view that behaves like the main workspace, but as that companion. The tabs across the top are **Chat**, **Configure**, **Channels**, and **Archive**. - - -Because a partner has memory, it builds up a picture of you over time. Ask it "what do you know about me?" and you'll see a `Recalling memory` step — the partner reads its own memory layers before answering in its soul. The **Configure** tab covers identity, soul, mind, and library. **Archive** is soft: Resume reopens the exact session key, Branch copies its full history and archives the source, and only Delete removes a conversation permanently. - -## Partner Groups - -A **Partner Group** brings two or more Partners into one shared conversation. Choose the member roster, discussion mode, and shared-memory mode, then address everyone or @mention selected members. Each Partner answers in its own seat, so their views remain distinct even when they reason over the same public discussion. - -Groups have their own conversation sessions and durable history. If one seat fails, that member can be retried independently without rerunning completed answers. Groups appear below the individual Partner cards on the Partners page; create at least two accessible Partners before forming one. - -## Channels - -Channels are delivery adapters around the same partner brain. The **Channels** tab lists every supported app down the left; pick one to configure its credentials and behavior on the right, then **Save** and enable it. The page polls the running Partner and reports whether each adapter is connected, connecting, listening, waiting for a scan, missing configuration, unavailable, failed, or simply stopped. - -![A Partner’s channel configuration](/screenshots/dev/partners-channels.png) - -Most channel cards share a few switches: - -| Field | Meaning | -| --- | --- | -| **Enabled** | Start this channel for the partner. Leave off while you collect credentials. | -| **Send Progress** | Deliver narration/progress for long-running turns. Useful where a silent 60-second wait feels broken. | -| **Send Tool Hints** | Deliver one-line tool-call hints such as `rag(query=…)`. Turn off for quieter production channels. | -| **Allow From** | Allowlist of user ids, group ids, emails, or `*` (one per line). Empty usually denies all; `*` opens the channel. | - -The rest of each card is channel-specific (base URLs, tokens, polling). For the full list of apps and per-channel setup steps, see the [**Channel Matrix**](/partners/channels/) — start with [**WeChat**](/partners/weixin/), [**WeCom**](/partners/wecom/), or [**QQ / NapCat**](/partners/qq/). - -For QR-backed channels, setup stays in the browser. WeChat/WeCom onboarding and a WhatsApp bridge can publish a server-generated code into the card; scan or refresh it there, then watch the same panel move from **Waiting for scan** to a connected state. Use logs only when the status detail does not already explain the failure. - - -## Partners as consultable agents - -A partner can also be **connected as an agent** and consulted from a normal chat turn — DeepTutor sends your question into the partner's own session and folds its answer back. See [My Agents](/explore/subagents/). - -## CLI mirror - -```bash -deeptutor partner list -deeptutor partner create math-tutor --soul "Socratic math tutor" -deeptutor partner start math-tutor -deeptutor partner stop math-tutor -``` - -The CLI is handy for smoke tests, but the web UI is the recommended place to configure channels — it masks secrets, shows each channel's schema inline, and exposes live setup/runtime state. - -## See also - -- [Home](/explore/chat-workspace/) — the same loop, without a personality or channels -- [My Agents](/explore/subagents/) — consult a partner from chat -- [Partners & Channels](/partners/) — the full channel setup guides -- [Memory](/explore/memory/) — how a partner's memory relates to yours diff --git a/docs/src/content/docs/explore/personalization.md b/docs/src/content/docs/explore/personalization.md deleted file mode 100644 index b030ff527..000000000 --- a/docs/src/content/docs/explore/personalization.md +++ /dev/null @@ -1,56 +0,0 @@ ---- -title: Personalization -description: Manage the agents, personas, skills, connected services, CLI apps, and memory that accompany your account across workspaces. -quadrant: how-to ---- - -**Personalization** is your account's shelf of reusable behavior and connections. Open it from the sidebar to reach **My Agents**, **Personas**, **Skills**, **MCP Services**, **CLI Apps**, and **Memory**. Switching from a course workspace to a research workspace keeps this shelf available; each workspace decides which resources its turns may use. - -![Personalization](/screenshots/dev/personalization.png) - -## Account shelf and workspace context - -A workspace groups the work itself: **Home** for conversations, **Learning** for study and practice, and **Resources** for materials. Personalization supplies ways of working with those materials. For example, a patient teaching persona can serve both a calculus course and a language course, while each course keeps its own files, reading progress, and learning topics. - -| Keep here | Use it for | Scope to remember | -| --- | --- | --- | -| **My Agents** | Consult a connected harness or Partner; import earlier agent conversations | The connection belongs to the account; a local harness uses its configured working directory | -| **Personas** | Reuse a voice, teaching style, or response policy | Account behavior preset selected for a turn | -| **Skills** | Reuse a workflow and its supporting instructions | Account shared library or an explicitly selected workspace library | -| **MCP Services** | Authorize an external service and discover its tools | Account connection, plus any administrator-managed services you may use | -| **CLI Apps** | Run an installed command-line application through tools | Administrator installs; account grants govern use | -| **Memory** | Review retained preferences and learning experiences | Personal memory accompanies the learner; Partner relationship memory is separate | - -A library entry is not automatic permission to use it everywhere. In **Settings → Workspace**, configure the workspace's allowed skills, MCP services, and knowledge bases. A conversation may narrow skills and MCP services further in its composer. These selections intersect with the signed-in user's grants; they never grant access to another account's resources. An unselected composer inherits its workspace selection. See [Settings](/explore/settings/) for configuration and [Resources](/explore/space/) for materials. - -## Create and use a persona - -Open **Personalization → Personas**, create a preset, and give it a name, a short description, and Markdown instructions. Describe behavior concretely: “ask for the learner's next step before revealing a solution” is more useful than “be helpful.” Save it, select it in the chat composer's persona control, and test it on a short question. - -Personas change how DeepTutor responds; the selected capability still determines the task and stages. A teacher persona can guide an explanation, and a research-assistant persona can guide a literature discussion, without replacing those workflows. Edit your own preset when its style needs adjustment; delete it when it is no longer useful. Deployment presets are read-only to ordinary users. Your own persona with the same name takes precedence over the deployment preset. - -A persona is also a starting point for a Partner's soul: the creation wizard can clone its content. That produces the Partner's own identity; later edits to the original persona do not silently rewrite the Partner. Use [Partners](/explore/partners/) for a persistent companion with channels and relationship memory. - -## Build a reusable skill library - -Open **Personalization → Skills** and check **Skill library** before creating or importing anything. **Account shared skills** can be assigned to several workspaces. Selecting a workspace creates and edits its local skills instead. An enabled workspace skill overrides a shared skill of the same name; the scope picker prevents a course-specific workflow from accidentally becoming your account-wide version. - -Create a skill for a repeatable procedure, such as reviewing an essay against a rubric or turning lab notes into a report. Include its trigger, expected inputs, steps, and output requirements. Import community skills through EduHub, inspect their instructions, and test against a small real example. Keep the account version general; use a local override when a course has a different rubric. See [Skills](/ecosystem/skills/) for authoring and lifecycle details. - -## Connect services and applications - -Use **MCP Services** when the work depends on a remote service. Connect from the store or add a server URL, finish its API-key or OAuth flow, and confirm it is connected. Allow the service in the intended workspace and select it for the conversation when needed. If a service changes to **needs auth**, reconnect from Installed. Removing a connection makes its tools unavailable; update workspaces that reference it. Credentials stay with the account connection rather than the workspace's files. - -Use **CLI Apps** for installed programs that operate on files. An administrator installs the app and grants access; the agent runs it in the sandbox. A skill may explain when and how to use that app, but importing the skill does not install the program or grant permission. See [MCP Services](/ecosystem/mcp/) and [CLI Apps](/ecosystem/cli-apps/). - -## Put the pieces together - -For a literature project, keep PDFs and reading notes in the project's **Resources**, read and annotate them in **Learning**, then open **Home** with the research persona and an allowed citation skill. Add a connected service for live reference lookup only when the task needs it. Outputs and conversation context remain associated with the working workspace. - -For exam preparation, use a course workspace's materials and learning topics with a teaching persona. Keep a general study-planning skill in the account shelf and a course-specific marking rubric in the workspace skill library. Review remembered preferences in **Memory** if the tutoring style stops matching your needs. - -For a companion available in IM, create an account-level Partner and choose whether it uses a private copied library or a live workspace binding. A connected Partner can also be consulted from Home through My Agents. Those choices control different things: where you reach the companion, which resources it sees, and which conversation it continues. - -## When something is missing - -Check the account library first, then the workspace selection, then the conversation selection. For a shared deployment, also check your per-user grants. A skill may be present but filtered out by the workspace; an MCP service may be selected but awaiting authorization; a CLI App may be listed but not installed, enabled, or granted. **Settings → Runtime status** helps distinguish a missing module or provider from a resource selection problem. diff --git a/docs/src/content/docs/get-started/desktop.md b/docs/src/content/docs/get-started/desktop.md index 2371f0c60..212b6e0ee 100644 --- a/docs/src/content/docs/get-started/desktop.md +++ b/docs/src/content/docs/get-started/desktop.md @@ -48,5 +48,5 @@ Learning data and settings stay in the app’s workspace folder. Replacing the a ## Next -- [A first study session](/explore/) — one topic, one source, one question. +- [A first study session](/learning-workspace/) — one topic, one source, one question. - [Changelog](/get-started/changelog/) — read this before replacing an older desktop app. v1.7.4 changes the runtime signing key, so install that app itself rather than importing an update into an older build. diff --git a/docs/src/content/docs/get-started/docker.md b/docs/src/content/docs/get-started/docker.md index 4e8d2d1ea..c16d5b5f5 100644 --- a/docs/src/content/docs/get-started/docker.md +++ b/docs/src/content/docs/get-started/docker.md @@ -22,183 +22,8 @@ docker run --rm --name deeptutor \ Open . The container creates `/app/data/user/settings/*.json` on first boot; configure model providers from the Web Settings page. Config, API keys, logs, the default content workspace, memory, knowledge bases, and Partner workspaces (`data/partners//`) all persist in the `deeptutor-data` volume. Optional extras belong on the deployment, not in a shell: set `DEEPTUTOR_EXTRAS` (and `DEEPTUTOR_APT_PACKAGES`), and every container re-applies them at start. -## Select a host content workspace - -By default content workspace storage lives inside the `deeptutor-data` volume. To use a folder on the host instead, mount it at the stable container path `/workspace` and lock DeepTutor to it: - -```bash -mkdir -p "$PWD/deeptutor-workspace/outputs" -docker run --rm --name deeptutor \ - -p 127.0.0.1:3782:3782 \ - -v deeptutor-data:/app/data \ - -v "$PWD/deeptutor-workspace:/workspace" \ - -e DEEPTUTOR_WORKSPACE_ROOT=/workspace \ - -e DEEPTUTOR_WORKSPACE_ALLOWED_ROOTS=/workspace \ - ghcr.io/hkuds/deeptutor:latest -``` - -Create `outputs/` yourself before the first run — otherwise Docker creates the bind source as root and the unprivileged app cannot write into it. - -The container always sees `/workspace`, so paths stay portable across hosts. This deployment root constrains every account. Managed workspaces use account-scoped directories under `outputs/.deeptutor/chat/`; **Settings → Workspace** manages their identities and storage without exposing private runtime settings. - -With Compose, set `DEEPTUTOR_WORKSPACE_HOST=/absolute/host/folder` before `python scripts/docker_compose.py up -d`; the helper creates the folder and its `outputs/` for you. Omit it to keep `./data/user/workspace`. - -## Detached mode - -Add `-d` to run in the background: - -```bash -docker run -d --name deeptutor \ - -p 127.0.0.1:3782:3782 \ - -v deeptutor-data:/app/data \ - ghcr.io/hkuds/deeptutor:latest - -docker logs -f deeptutor # follow logs -docker stop deeptutor # stop -docker rm deeptutor # remove (volume persists) -``` - -The `deeptutor-data` volume keeps your settings and default content workspace across `stop` / `rm` cycles. To truly start over: `docker volume rm deeptutor-data`. - -## Remote Docker / reverse proxy - -The browser only ever talks to the frontend origin (`:3782`); the in-container -Next.js middleware forwards `/api/*` and `/ws/*` to the backend on -`localhost:8001` server-side. So for the common **single-container** case you do -**not** need to configure an API base at all — just point your reverse proxy / -TLS terminator at the published `:3782`: - -```text -deeptutor.example.com { - reverse_proxy localhost:3782 -} -``` - -You only need an API base for a **split deployment**, where the backend runs in a -separate container or host. Set it in `data/user/settings/system.json` in the -mounted volume to the in-network address the **frontend server** uses to reach -the backend — it's read server-side by the proxy, not sent to the browser: - -```json -{ - "next_public_api_base": "http://backend:8001" -} -``` - -`next_public_api_base_external` (and its alias `public_api_base`) are accepted as -lower-precedence fallbacks and normalized on save. - -CORS only matters with auth enabled and a cross-origin frontend: `cors_origins` -lists the frontend page origins allowed to call the backend. With auth disabled, -DeepTutor permits normal HTTP/HTTPS browser origins by default. - -```json -{ - "cors_origins": ["https://deeptutor.example.com"] -} -``` - -## Different host ports - -Change the left side of the `-p host:container` mapping: - -```bash -docker run --rm --name deeptutor \ - -p 127.0.0.1:8088:3782 \ - -v deeptutor-data:/app/data \ - ghcr.io/hkuds/deeptutor:latest -``` - -Add `-p 127.0.0.1:8089:8001` as well if you also want the API exposed on the host. If you change container-side ports in `/app/data/user/settings/system.json`, restart and update the right side of each mapping to match. - -## Connecting to a local LLM (Ollama / LM Studio / llama.cpp / vLLM) - -Inside Docker, `localhost` is the container itself, not your host machine. To reach a model service running on the host, use the host gateway: - -```bash -docker run --rm --name deeptutor \ - -p 127.0.0.1:3782:3782 \ - --add-host=host.docker.internal:host-gateway \ - -v deeptutor-data:/app/data \ - ghcr.io/hkuds/deeptutor:latest -``` - -Then in **Settings → LLM** (or **Embedding**), point the provider Base URL at `host.docker.internal`: - -| Service | Base URL | -|---------|----------| -| Ollama LLM | `http://host.docker.internal:11434/v1` | -| Ollama embedding | `http://host.docker.internal:11434/api/embed` | -| LM Studio | `http://host.docker.internal:1234/v1` | -| llama.cpp | `http://host.docker.internal:8080/v1` | - -Docker Desktop (macOS / Windows) usually resolves `host.docker.internal` **without** `--add-host`. On Linux, the flag is the portable way to create that hostname on modern Docker Engine. - -### Linux alternative — host networking - -Add `--network=host` and drop the `-p` flags: - -```bash -docker run --rm --name deeptutor \ - --network=host \ - -v deeptutor-data:/app/data \ - ghcr.io/hkuds/deeptutor:latest -``` - -The container shares the host network directly, so open (or the `frontend_port` in `system.json`), and host services can be reached with normal localhost URLs like `http://127.0.0.1:11434/v1`. - -> Host networking exposes container ports directly on the host and may conflict with existing services. - -## Updating - -```bash -docker pull ghcr.io/hkuds/deeptutor:latest -docker rm -f deeptutor 2>/dev/null -docker run --rm --name deeptutor \ - -p 127.0.0.1:3782:3782 \ - -v deeptutor-data:/app/data \ - ghcr.io/hkuds/deeptutor:latest -``` - -The volume persists — your settings, KBs, memory all survive the upgrade. - -**Settings → About** identifies the Docker image and can check whether a newer release exists, but container replacement remains a deployment action: pull the new image and recreate the container as shown above. DeepTutor never upgrades packages inside the running container. - -## Common errors - -### `Bind for 0.0.0.0:3782 failed: port is already allocated` - -```bash -lsof -i :3782 # macOS -ss -ltnp | grep :3782 # Linux -``` - -Kill the conflicting process, or choose different host ports in your `-p` mapping. - -### Container exits immediately - -```bash -docker logs deeptutor | tail -30 -``` - -An invalid LLM credential is caught and logged as a warning; it does **not** make backend startup fail. If the container exited, look in the log for a different fatal error. Once the Web UI is available, correct the credential under **Settings → Models & services**. - -### Frontend loads but API calls fail (split deployment) - -With the single-container image this shouldn't happen — the in-container proxy -forwards `/api/*` to the backend automatically. If you run a **split -deployment** with the backend in a separate container or host, set -`next_public_api_base` in `data/user/settings/system.json` (inside the volume) to -the in-network address the frontend server uses to reach the backend, then -restart. - -### Multi-user mode in Docker - -Just toggle auth in the volume's `data/user/settings/auth.json` (`"enabled": true`) and restart. The container picks it up. See [**Multi-User Deployment**](/get-started/multi-user/) for the full setup. - -More: [**Troubleshooting**](/get-started/troubleshooting/). - ## Next -- [**Multi-User Deployment**](/get-started/multi-user/) — team setup -- [**Explore DeepTutor**](/explore/) — tour the running app +Host folders, detached mode, reverse proxies, local models, and upgrades are on [Docker operations](/self-hosting/docker/). + +- [**Explore DeepTutor**](/learning-workspace/) diff --git a/docs/src/content/docs/get-started/index.md b/docs/src/content/docs/get-started/index.md index a81baaae9..cfeb71911 100644 --- a/docs/src/content/docs/get-started/index.md +++ b/docs/src/content/docs/get-started/index.md @@ -12,10 +12,10 @@ For the full app, the recommended flow is **pick a runtime-home directory → in | Option | When to use | Page | |--------|-------------|------| -| **PyPI** | Published packages; full app uses [full] in 1.7.x | [**Install from PyPI**](/get-started/pypi/) | -| **From Source** | Current dev, local development, optional hot reload | [**Install from Source**](/get-started/from-source/) | +| **PyPI** | Published packages; full app uses [full] in 1.7.x | [**Install from PyPI**](/self-hosting/pypi/) | +| **From Source** | Current dev, local development, optional hot reload | [**Install from Source**](/self-hosting/source/) | | **Docker** | Production deployments, hosted hosts, persistent volumes | [**Docker**](/get-started/docker/) | -| **CLI Only** | Headless server, agent harness, no Web UI needed | [**CLI-Only Install**](/get-started/cli-only/) | +| **CLI Only** | Headless server, agent harness, no Web UI needed | [**CLI-Only Install**](/self-hosting/cli-only/) | > **1.7.x installation:** `deeptutor[full]` installs the Web app; bare `deeptutor` installs core CLI/SDK. Stop DeepTutor before changing modules and keep feature wheels at the core version. For development, use the source instructions or [build local wheels](https://github.com/HKUDS/DeepTutor/blob/dev/docs-for-dev/MODULES.md). Back up your runtime home before upgrading older installations. @@ -45,9 +45,9 @@ Both are overridable via `data/user/settings/system.json` or during `deeptutor i Once you can reach `http://localhost:3782/`: -- [**Explore DeepTutor**](/explore/) — start with workspaces, then Home, Learning, Resources, Partners, and Personalization -- [**DeepTutor CLI**](/cli/) — drive core runtime and workspace operations from the terminal -- [**Partners: channels**](/partners/) — connect autonomous tutors to WeChat, WeCom, QQ, Telegram, Slack, Feishu, and more -- [**Multi-User Deployment**](/get-started/multi-user/) — host DeepTutor for a team +- [**Explore DeepTutor**](/learning-workspace/) — start with workspaces, then Home, Learning, Resources, Partners, and Personalization +- [**DeepTutor CLI**](/developers/guides/cli/) — drive core runtime and workspace operations from the terminal +- [**Partners: channels**](/channels/) — connect autonomous tutors to WeChat, WeCom, QQ, Telegram, Slack, Feishu, and more +- [**Multi-User Deployment**](/self-hosting/multi-user/) — host DeepTutor for a team -If something breaks, jump to [**Troubleshooting**](/get-started/troubleshooting/). +If something breaks, jump to [**Troubleshooting**](/self-hosting/troubleshooting/). diff --git a/docs/src/content/docs/index.mdx b/docs/src/content/docs/index.mdx index 055f27bec..c177cd109 100644 --- a/docs/src/content/docs/index.mdx +++ b/docs/src/content/docs/index.mdx @@ -1,66 +1,9 @@ --- title: Home -description: Open-source learning workspace for chat, practice, research, and the materials they share. +description: An open-source, agent-native learning companion. Home, Learning, and Resources follow the workspace. Partners and Personalization stay with the account. template: splash -hero: - title: DeepTutor - tagline: Conversations, source materials, practice, and reusable assistance in one workspace. - actions: - - text: Desktop quickstart - link: /get-started/desktop/ - icon: right-arrow - - text: Docker quickstart - link: /get-started/docker/ - icon: rocket - variant: minimal --- -import { CardGrid, LinkCard } from '@astrojs/starlight/components'; +import HomeLanding from '../../components/HomeLanding.astro'; -## Start here - - - - - - - - -## What you can do with DeepTutor - - - - - - - - - - -## Supported capabilities - -Capability names, module ids, and requirements come from `deeptutor/modules/manifests/`. The “What it does” column is a short guide to that manifest. Optional modules are noted in the sentence, not in **Also needs**. - -| Capability | Module | Also needs | What it does | Read | -| --- | --- | --- | --- | --- | -| `chat` | `core` | — | Everyday agent loop with tools | [Chat](/explore/chat-workspace/) | -| `ask_questions` | `core` | — | Asks for missing context, then finishes the request | [Chat](/explore/chat-workspace/) | -| `deep_solve` | `solve` | — | Multi-step worked solutions, including photo problems | [Chat](/explore/chat-workspace/) | -| `deep_question` | `questions` | `parsing` | Generates a practice set from a topic or a source | [Practice](/explore/practice/) | -| `deep_research` | `research` | — | Cited research report. The knowledge module is optional | [Chat](/explore/chat-workspace/) | -| `visualize` | `visualize` | — | SVG, Mermaid, Chart.js, or HTML. The Manim renderer is optional | [Chat](/explore/chat-workspace/) | -| `math_animator` | `renderer-manim` | — | Manim math video or storyboard | [Chat](/explore/chat-workspace/) | -| `mastery_path` | `mastery` | `knowledge` | Adaptive path with a per-topic mastery gate | [Mastery Path](/explore/mastery-path/) | -| `immersive_reading` | `reading` | `knowledge`, `parsing`, `mastery`, `notebook` | Reading beside the thread, with citations back to the source | [Reading](/explore/reading/) | -| `video_lesson` | `video-lesson` | — | Browser lesson with captions and optional narration | [Chat](/explore/chat-workspace/) | - -## More resources - - - - - - - - - + diff --git a/docs/src/content/docs/learning-workspace/agent-loop.md b/docs/src/content/docs/learning-workspace/agent-loop.md new file mode 100644 index 000000000..69e728953 --- /dev/null +++ b/docs/src/content/docs/learning-workspace/agent-loop.md @@ -0,0 +1,44 @@ +--- +title: How the agent loop works +description: How one chat turn plans, calls tools, reads observations, and stops. +quadrant: explanation +--- + +A chat turn is not one completion. The model can call a tool, read the observation, and decide whether to continue or answer. The steps to send a turn are in [Chat](/learning-workspace/chat/). + +### Little Tutor — follow up on a selection + +Select text in a conversation and open **Little Tutor** to start an independent, source-grounded sidebar thread. It stays nested under the source conversation and keeps its own focused context without global memory or general-purpose tools, so a close reading does not derail the main thread. + + +## The agent loop (how it thinks) + +DeepTutor Chat runs a single agent loop, so one message can take several internal rounds before you see an answer: + +1. The model reads your message and the mounted context, then either answers directly or plans a tool call. +2. If tools are needed, DeepTutor dispatches them and appends the observations (you can watch this in the Activity panel). +3. The model continues with better evidence — reading a source, querying a KB, running code, fetching a URL. +4. A final, tool-free message ends the turn. + +`ask_user` is special: instead of guessing, the agent can **pause the turn**, ask you a structured clarifying question, and resume once you answer. + +## Knowing how full the window is + +A chip in the composer reports how much of the model's context window this turn actually used and what is filling it — prompt blocks, tool schemas, the message list. It is measured from the assembled prompt rather than re-derived afterwards, so the readout cannot drift from what was sent. Open it to see the breakdown before deciding whether to switch to a longer-context model or start a fresh session. + +Long conversations also grow a rail of ticks in the transcript's left gutter, one per question you asked, for jumping back without scrolling. + +## Tools — including generation + +Tools come in three kinds, and the split is about who decides. + +**You decide** for the experience-enhancement tools in **Settings → Tools**: `brainstorm`, `web_search`, `paper_search`, `zotero_search`, `reason`, and `geogebra_analysis` — plus `imagegen` and `videogen` once you configure the matching generation model. + +**Context decides** for the rest, which mount automatically when they are useful and are locked on from the composer's point of view: `rag`, `kb_files`, `knowledge_frontier`, `read_source`, `read_memory`, `write_memory`, `read_skill`, `list_favorites`, `save_favorite`, `question_bank`, `web_fetch`, `github`, `preprint`, `research_audit`, `research_lit`, `learning_status`, `learning_update`, `ask_user`, `load_tools`, `cron`, `mastery_topics`, `mastery_sessions`, `mastery_open_session`, `mastery_new_session`, and the single code path `exec` (python, c, cpp, or shell). A capability adds its own on top: the eight reading tools, the mastery tutoring tools, `consult_subagent`, and so on. A third group answers to neither: the workspace baseline includes file tools plus `write_note` and `search_notes`, while `workspace_export` needs your approval to move a file out of `outputs/`. (Partners are the exception: a companion can be denied context-gated tools individually — see [Partners](/channels/).) + +### Scheduling something for later + +`cron` lets a turn schedule work instead of doing it now: **at** a time, **every** N seconds, or on a **cron expression** with a timezone. When the job is due, its message runs as a new instruction **in this same conversation** and the reply lands here — so "quiz me on this chapter every weekday at 9" is a sentence, not a setup screen. The same tool lists this conversation's jobs and cancels one. For a Partner, a due job rides back out through the IM channel the partner is connected to. + +Configure an **Image Generation** (or Video Generation) model in Settings and it becomes a chat tool too — ask in plain language and the agent calls it, then previews the result inline with a downloadable file. + diff --git a/docs/src/content/docs/explore/book.md b/docs/src/content/docs/learning-workspace/books.md similarity index 95% rename from docs/src/content/docs/explore/book.md rename to docs/src/content/docs/learning-workspace/books.md index 306e0adfc..e909e1afb 100644 --- a/docs/src/content/docs/explore/book.md +++ b/docs/src/content/docs/learning-workspace/books.md @@ -81,6 +81,6 @@ Source pickers may retain **Notebook** terminology for saved Favorites collectio ## See also -- [Knowledge Center](/explore/knowledge/) — build the document libraries a book is compiled from -- [Home](/explore/chat-workspace/) — discuss book pages in context -- [CLI commands](/cli/commands/) — book maintenance commands +- [Knowledge Center](/learning-workspace/knowledge/) — build the document libraries a book is compiled from +- [Home](/learning-workspace/chat/) — discuss book pages in context +- [CLI commands](/developers/reference/cli/) — book maintenance commands diff --git a/docs/src/content/docs/explore/calendar.md b/docs/src/content/docs/learning-workspace/calendar.md similarity index 93% rename from docs/src/content/docs/explore/calendar.md rename to docs/src/content/docs/learning-workspace/calendar.md index 1352188ca..b32051405 100644 --- a/docs/src/content/docs/explore/calendar.md +++ b/docs/src/content/docs/learning-workspace/calendar.md @@ -32,4 +32,4 @@ Toggle layers to reduce visual clutter. A scheduled instruction is different fro Keep your classes in an account calendar. In the `Probability` workspace, add a task due Friday and reserve a study event on Wednesday. Review the due-learning layer before choosing that slot. When you switch to another workspace, Wednesday's event remains visible while the task and study layers change to that project's context. -See [Task Board](/explore/task-board/), [Practice](/explore/practice/) and [Workspaces](/explore/workspaces/). +See [Task Board](/learning-workspace/task-board/), [Practice](/learning-workspace/questions/) and [Workspaces](/learning-workspace/workspaces/). diff --git a/docs/src/content/docs/learning-workspace/chat.md b/docs/src/content/docs/learning-workspace/chat.md new file mode 100644 index 000000000..d115b4ee0 --- /dev/null +++ b/docs/src/content/docs/learning-workspace/chat.md @@ -0,0 +1,137 @@ +--- +title: Chat +description: "Send one useful chat turn: pick the workspace, attach material, and read the result in Activity." +quadrant: how-to +--- + +Home is where a turn runs. This page is how to send a useful one. For how a turn plans, calls tools, and stops, see [How the agent loop works](/learning-workspace/agent-loop/). + +## Where it is + +Select your [workspace](/learning-workspace/workspaces/), then open **Home → Chat** (`/chat`). Home also contains the [Task Board](/learning-workspace/task-board/), [Learning notebook](/learning-workspace/notebook/) and [Calendar](/learning-workspace/calendar/). Chat, tasks and notebook pages follow the workspace; Calendar events are account level, with workspace study layers. + +![Home and the conversation composer](/screenshots/dev/overview.png) + +The window has three regions: + +| Region | What it does | +| --- | --- | +| **Left sidebar** | The workspace menu sits above **Home**, **Learning** and **Resources**. **Partners** and **Personalization** are account-level areas. Conversations reopen with their learning context; Settings and workspace management are available from the workspace menu. Classic layout uses a different navigation arrangement. | +| **Composer** | The message box. Its **bottom-left** sets *what kind of turn* this is (capability) and adds references (`+`); its **bottom-right** exposes connected-agent, knowledge, persona, and model selectors. The microphone only transcribes the current message. | +| **Activity panel** (top-right toggle) | Tool calls, references, generated files, attachments, and previews for the current session, plus a quick way to open a URL or local file. | + +With authentication enabled, signed-in users also see **My profile** in the sidebar. It shows the username (not editable here), role, and join date; use it to upload an avatar image or choose an icon and color, and to sign out. + +The top-right icons above the thread let you **save useful content to Favorites**, **export the session as Markdown**, and **toggle the Activity panel**. + +## Your first useful conversation + +1. Select the workspace for your project and open a new Chat. +2. Add a PDF or a specific saved reference with the resource control; attach a knowledge base when you need retrieval across its library. +3. State the outcome and constraints: “Explain the sampling theorem using this lecture, then give me two questions. Let me try before showing answers.” +4. Follow tool progress in Activity and open cited sources or generated files when you need to inspect the evidence. +5. Save a useful result to [Favorites](/learning-workspace/favorites/), or develop your own explanation in the [Learning notebook](/learning-workspace/notebook/). Reopen the conversation from Resources → Chat History. + +Selecting a connected agent is by default a persistent choice for the session; importing an old agent transcript is a reference. Likewise, an attached file supplies this turn's material by default, while workspace instructions and session preferences shape later turns. Check the visible chips before sending if a reply seems to be using the wrong sources or persona. + +## Starting points + +Under the empty composer, Explain, Solve, Practice, Plan, and Research offer editable starting prompts. A separate personalized suggestion draws on your memory and recent activities; **Suggest something else** replaces it. Choose either to fill the composer, then review before sending. **Customize page → Starting prompts** edits the reusable titles and requests. + +**Settings → Conversation** sets how much history feeds them: raise the activity count for suggestions that range wider, lower it to keep them close to what you were just doing. + + +## Sticky context vs. one-time references + +DeepTutor splits context into two kinds, and the composer keeps them in two different places — this is the single most important idea to learn here. + +**Sticky session context** persists across turns until you change it: capability, workspace or course binding, tools, **knowledge bases**, **persona**, **model**, and Reading / Mastery state. The right side exposes the relevant selectors; an agent selected with the Agent chip or `@` stays attached by default, while the microphone only fills the current draft. + +**References** live behind the **`+` button** on the left. They default to *this* turn only; use the reuse control to reuse a supported reference on every turn. + + +| `+` reference | What it pulls in | +| --- | --- | +| **Attach files** | A PDF, image, Office doc, Markdown, or data file for the agent to read. | +| **Chat History** | A past session as grounding context. | +| **My Agents** | An imported Claude Code / Codex / ChatGPT transcript to explore — see [My Agents](/customize/agents/). | +| **Books / Reading / Notebooks / Question Bank** | A compiled book, a reading section, a saved notebook, or practice questions from your [Resources](/learning-workspace/resources/). Filter questions by material or category; **Select all** keeps earlier selections. | +| **Memory** | A specific memory document, when you want the agent to work from a fact you can point at rather than whatever recall surfaces. | + +Typing **`@`** in the main Chat composer filters the same connected-agent list as the Agent chip and keeps the selection attached by default. Follow-up surfaces without live-agent selection use `@` for their Space reference menu instead. + +### Knowledge — ground answers in your library + +The **database icon** opens the knowledge picker. Untouched conversations inherit ready workspace assignments or the default KB; explicit selections, including none, persist until changed. The agent retrieves from these bases when grounding is needed. + +How it retrieves depends on the base's engine, and the difference is worth knowing when an answer surprises you. Most bases — LlamaIndex, GraphRAG, LightRAG, a linked index, a remote LightRAG Server, a Tencent IMA library — are served by the `rag` tool. **PageIndex OSS** and **PageIndex Cloud** are not: their retrieval is agentic, so a reading loop walks the local or hosted document tree instead, and those bases are deliberately absent from `rag`'s list. An **Obsidian** vault has no index at all and is routed to the Obsidian capability, which navigates the live files; a **MarginNote 4** library is the same shape, walked by its own tools. + + +### Persona — set the voice and stance + +The **person icon** chooses a persona. `Default` is the plain assistant; built-ins like **peer**, **research-assistant**, and **teacher** change tone and pedagogy. Personas are managed under **Personalization → Personas** and can be reused by Partners. + + +### Model — switch per turn + +The **model chip** picks which model runs this turn. Every model you configured in Settings appears here with its provider and context window, and the default is marked. Switch to a long-context model for big documents, or a cheaper/faster one for quick exchanges — mid-session, without losing your place. + + +## The Activity panel + +The panel toggle (top-right) opens **Activity** — a live record of the tools, references, and files the current session has used — generated files listed above your uploads — plus an **Open** box to pull a URL or a local file into the in-app viewer. + +![Conversation and its activity controls](/screenshots/dev/chat.png) + +As a turn runs, each tool call collapses into a compact header (for example, `Done · 21s`) that you can expand to inspect inputs and outputs — so the thread stays readable while the full trace stays auditable. + +## The content workspace + +The **content workspace** is the folder bound to a conversation. Unbound sessions use the General workspace; you can create custom workspaces for separate projects. The System workspace holds shared skills and sanitized configuration snapshots; private runtime settings, API keys, databases, and memory stay outside conversational file access. + +Manage roots, workspaces, and **Workspace instructions** in **Settings → Workspace**. Instructions apply from the next turn for supported capabilities, excluding Deep Research, Quiz, and Manim; capability rules and permissions still apply. Built-in and managed custom folders live under `/data/user/workspaces` by default. The CLI also manages the legacy content-folder binding: + +```bash +deeptutor workspace show +deeptutor workspace set /absolute/path/to/my-folder +deeptutor workspace reset +``` + +Reading is free; writing is not. Everything a turn creates — downloads, generated files, code output, rendered assets — lands under a turn-scoped `outputs////` directory. Execution is read-only everywhere else in the folder, and copying a generated file out of `outputs/` into the rest of your material takes an explicit **Allow once** confirmation naming that exact source and destination. + +The model never sees an absolute path — only relative ones such as `outputs/report.docx`. When it calls `workspace_present`, the UI renders an authenticated, openable snapshot; the same relative path also works in an ordinary Markdown link or image. Changing the source file later does not change a snapshot already presented. + +On Docker and server deployments the deployment folder constrains managed workspace storage — see [Docker](/get-started/docker/). + +## On a phone + +Below tablet width the workspace collapses to a single column with a slide-over sidebar, so the same thread is usable on a phone rather than rendering a three-pane desktop layout off the edge of the viewport. + +## Practical examples + +```text +Attach a KB + ask: "Explain chapter 4 and quiz me on the weak spots." +``` + +```text +Attach a PDF + ask: "Extract the assumptions and save the final summary to my notebook." +``` + +```bash +deeptutor run chat "Explain the Fourier transform" --kb signals +deeptutor chat --capability deep_research --kb papers +``` + +## See also + +- [Immersive Reading](/learning-workspace/reading/) — the same loop, with documents or media open beside it +- [DeepTutor Ecosystem](/customize/) — Skills, MCP Services, and CLI Apps the agent can call +- [Partners](/channels/) — the same loop, running inside IM companions +- [My Agents](/customize/agents/) — consult Claude Code, Codex, or a Partner from a chat turn +- [Knowledge Center](/learning-workspace/knowledge/) — build the RAG libraries you attach here +- [Memory](/learning-workspace/memory/) — the personalization the loop reads and writes +- [Settings](/self-hosting/settings/) — models, tools, capabilities, and runtime control +- [How the agent loop works](/learning-workspace/agent-loop/) +- [Vision Solver](/learning-workspace/vision-solver/) +- [Research](/learning-workspace/research/) +- [Multimodal studio](/multimodal-studio/) diff --git a/docs/src/content/docs/explore/favorites.md b/docs/src/content/docs/learning-workspace/favorites.md similarity index 92% rename from docs/src/content/docs/explore/favorites.md rename to docs/src/content/docs/learning-workspace/favorites.md index 993640a53..998450e08 100644 --- a/docs/src/content/docs/explore/favorites.md +++ b/docs/src/content/docs/learning-workspace/favorites.md @@ -21,7 +21,7 @@ A favorite is saved material rather than a new AI request. Opening a record does ## Use favorites in a notebook page -1. Open a [Learning notebook](/explore/co-writer/) page. +1. Open a [Learning notebook](/learning-workspace/notebook/) page. 2. Choose **Insert favorite** from the page menu. 3. Search **All favorites**, or narrow to a collection and content type. 4. Preview records and select one or several. The insertion order follows the order you selected them. @@ -35,4 +35,4 @@ For one module, keep three collections: `Sources`, `Worked examples`, and `Quest Favorites belong to your current workspace's resources. They do not automatically become a knowledge-base index or global memory. Attach saved material in workflows that offer it, insert it into a notebook page, or use it as an explicit source when creating supported learning activities. -See [Resources](/explore/space/), [Learning notebook](/explore/co-writer/) and [Knowledge Center](/explore/knowledge/) for the related workflows. +See [Resources](/learning-workspace/resources/), [Learning notebook](/learning-workspace/notebook/) and [Knowledge Center](/learning-workspace/knowledge/) for the related workflows. diff --git a/docs/src/content/docs/learning-workspace/index.md b/docs/src/content/docs/learning-workspace/index.md new file mode 100644 index 000000000..51c10eb83 --- /dev/null +++ b/docs/src/content/docs/learning-workspace/index.md @@ -0,0 +1,50 @@ +--- +title: A connected learning workflow +description: Follow one project through workspace-scoped Home, Learning, and Resources, with account-level Partners and Personalization. +quadrant: tutorial +--- + +The sidebar is a map of **where your work belongs**. Choose a workspace first, then move between its conversations, learning activities, and reusable sources. Your account supplies the companions and preferences you can bring into that work. + +## Two scopes, five shelves + +| Shelf | Scope | What you use it for | +| --- | --- | --- | +| [Chat](/learning-workspace/chat/) | Workspace | Conversations, a task board, and your Learning notebook | +| [Books](/learning-workspace/books/) | Workspace | Books, Mastery Paths, Reading collections, and Practice | +| [Resources](/learning-workspace/resources/) | Workspace | Chat history, Favorites, question bank, learning journal, and knowledge bases | +| [Partners](/channels/) | Account | Persistent companions, their instructions, resource access, and channels | +| [Personalization](/customize/) | Account | Personas, skills, connected agents, MCP, CLI apps, and memory controls | + +**Calendar is an exception within Home:** it offers an account-wide view across workspaces. [Calendar](/learning-workspace/calendar/) explains how to read the source workspace of an event. A Partner also has an explicit working context: its account-level identity does not mean every conversation can read every workspace. + +## 1. Give a project its own workspace + +Create or select a workspace for “Signals and sampling.” Keep its lecture notes and exercises separate from another project such as “Academic writing.” Before adding material or starting a learning activity, check the active workspace. Switching changes the first three shelves’ contents, while your Partner and Personalization libraries remain available. See [scope and switching](/learning-workspace/workspaces/). + +## 2. Bring in sources, then ask a focused question + +Add reusable material to [Knowledge Center](/learning-workspace/knowledge/), or open a specific document in [Reading](/learning-workspace/reading/) when you want to work beside the source. In Home, attach the relevant context and ask something concrete: “Explain why low sampling rates can make two different signals look identical; cite this primer.” + +A stored asset is not automatically included in every model request. Attach sources or select the supported learning context explicitly. Check cited passages before building on an answer. + +## 3. Separate evidence from your own understanding + +Save useful original passages to [Favorites](/learning-workspace/favorites/). Then write your interpretation in a [Learning notebook](/learning-workspace/notebook/), inserting references where useful. The notebook is where you develop an explanation; Favorites preserves the material you may want to reuse. Reopen the source when a claim needs checking, and use Dito beside a paragraph when you need help improving it. + +## 4. Choose the learning activity that fits + +- Use [Books](/learning-workspace/books/) for a structured sequence of pages and interactive blocks. +- Use [Mastery Path](/learning-workspace/mastery/) for a goal broken into topics and guided study. +- Use [Reading](/learning-workspace/reading/) for questions tied to a document or media timestamp. +- Use [Practice](/learning-workspace/questions/) to answer, inspect feedback, and revisit weak areas. + +These are different ways to work with a topic, not steps you must complete in order. Start with one and use the supported capture or attachment controls to connect it to the next. + +## 5. Reuse assistance without mixing projects + +Choose a persona that asks you to explain your reasoning. Add a relevant skill when you need a repeatable method. Connect an external agent for consultation, or configure a Partner with a particular role and resource scope. Those account assets remain available in another workspace, while each workspace keeps its own learning records and materials. + +## Return to the work + +Use Home’s [Task Board](/learning-workspace/task-board/) for next actions, [Resources](/learning-workspace/resources/) for saved evidence and history, and the Learning list to reopen an activity. You do not need to repeat setup or recreate a Partner whenever you switch subjects. diff --git a/docs/src/content/docs/explore/knowledge.md b/docs/src/content/docs/learning-workspace/knowledge.md similarity index 82% rename from docs/src/content/docs/explore/knowledge.md rename to docs/src/content/docs/learning-workspace/knowledge.md index d98d14699..a620d0f8e 100644 --- a/docs/src/content/docs/explore/knowledge.md +++ b/docs/src/content/docs/learning-workspace/knowledge.md @@ -4,7 +4,7 @@ description: Create, version, sync, inspect, and reuse the Knowledge Bases that quadrant: how-to --- -The Knowledge Center is where you build and manage the document libraries behind **RAG**. A knowledge base (KB) can ground Home turns, Learning notebook edits, Book generation, and Partner conversations. This page focuses on the KB lifecycle; engine architecture and selection live under [RAG Integration](/ecosystem/rag-integration/). +The Knowledge Center is where you build and manage the document libraries behind **RAG**. A knowledge base (KB) can ground Home turns, Learning notebook edits, Book generation, and Partner conversations. This page focuses on the KB lifecycle; engine architecture and selection live under [RAG Integration](/customize/rag/). ## Where it is @@ -14,7 +14,7 @@ Open **Resources → Knowledge Center** from the left sidebar. Two tabs keep its ## Choose the RAG integration -Every KB is bound to one retrieval integration. Open **Knowledge engines** to see the catalog grouped as Local, Server, Cloud, and External knowledge sources. Each card reports **Ready**, **Needs key**, **Needs setup**, or **Not installed** before you create a base. Open [RAG Integration](/ecosystem/rag-integration/) for the full comparison, including the distinct PageIndex OSS and PageIndex Cloud contracts. +Every KB is bound to one retrieval integration. Open **Knowledge engines** to see the catalog grouped as Local, Server, Cloud, and External knowledge sources. Each card reports **Ready**, **Needs key**, **Needs setup**, or **Not installed** before you create a base. Open [RAG Integration](/customize/rag/) for the full comparison, including the distinct PageIndex OSS and PageIndex Cloud contracts. ## Create a knowledge base @@ -62,22 +62,7 @@ MarginNote instead shows **Devices** and **Settings** because its paired add-on | **PyMuPDF4LLM** | Lightweight, no downloads or CUDA. Converts PDF, e-books, XPS, images, text, and Markdown while extracting images. `pip install deeptutor[parse-pymupdf4llm]`. | | **LiteParse** | Lightweight structured parsing, no local model downloads. `pip install deeptutor[parse-liteparse]`. | -## CLI mirror - -```bash -deeptutor kb list -deeptutor kb create physics --doc chapter1.pdf -deeptutor kb create textbooks --docs-dir ./pdfs -deeptutor kb connect-kiwix wiki --server-url http://localhost:8080 --zim-name wikipedia_en -deeptutor kb add physics --doc chapter2.pdf -deeptutor kb add-github-source physics --repo owner/repo --branch main --path docs --glob '*.md' -deeptutor kb add-web-source physics --url https://docs.example.com --max-depth 3 --max-pages 200 -deeptutor kb list-sources physics -deeptutor kb sync physics -deeptutor kb search physics "What is angular momentum?" -deeptutor kb eval physics --dataset physics-qa.jsonl --top-k 5 --format json -deeptutor kb set-default physics -``` +The same operations are on the CLI. See the [command reference](/developers/reference/cli/). ## Tips @@ -95,9 +80,9 @@ Assigned resources determine which bases are available to a workspace. Sharing a ## See also -- [RAG Integration](/ecosystem/rag-integration/) — compare the knowledge engines behind a KB -- [Home](/explore/chat-workspace/) — attach KBs to a turn -- [Immersive Reading](/explore/reading/) — read one document instead of indexing a corpus -- [Books](/explore/book/) — compile learning material from KBs -- [Partners](/explore/partners/) — copy KBs into partner workspaces -- [Settings](/explore/settings/) — embedding providers and parsing engines +- [RAG Integration](/customize/rag/) — compare the knowledge engines behind a KB +- [Home](/learning-workspace/chat/) — attach KBs to a turn +- [Immersive Reading](/learning-workspace/reading/) — read one document instead of indexing a corpus +- [Books](/learning-workspace/books/) — compile learning material from KBs +- [Partners](/channels/) — copy KBs into partner workspaces +- [Settings](/self-hosting/settings/) — embedding providers and parsing engines diff --git a/docs/src/content/docs/explore/mastery-path.md b/docs/src/content/docs/learning-workspace/mastery.md similarity index 93% rename from docs/src/content/docs/explore/mastery-path.md rename to docs/src/content/docs/learning-workspace/mastery.md index 9dd1adde9..95ea11d3b 100644 --- a/docs/src/content/docs/explore/mastery-path.md +++ b/docs/src/content/docs/learning-workspace/mastery.md @@ -43,6 +43,6 @@ Paths and their study conversations belong to the current workspace. Reopen the ## See also -- [Resources](/explore/space/) — the library for reusable materials and personalization -- [Immersive Reading](/explore/reading/) — turn an open collection into a new mastery path -- [Home](/explore/chat-workspace/) — the shared agent loop behind study conversations +- [Resources](/learning-workspace/resources/) — the library for reusable materials and personalization +- [Immersive Reading](/learning-workspace/reading/) — turn an open collection into a new mastery path +- [Home](/learning-workspace/chat/) — the shared agent loop behind study conversations diff --git a/docs/src/content/docs/explore/memory.md b/docs/src/content/docs/learning-workspace/memory.md similarity index 78% rename from docs/src/content/docs/explore/memory.md rename to docs/src/content/docs/learning-workspace/memory.md index add40162c..a207605fb 100644 --- a/docs/src/content/docs/explore/memory.md +++ b/docs/src/content/docs/learning-workspace/memory.md @@ -32,27 +32,7 @@ The graph places the automatically synthesized L3 slots — profile, recent, and L2-to-L1 links can target a cited entity. Current L3 references name a surface, so the graph draws a soft link to its L2 cluster, not an exact end-to-end chain. Use it to locate supporting areas and inspect their facts and entities. -## Tuning the consolidator - -**Settings → Memory** sets **Update** / **Audit** LLM budgets, **Dedup** iterations, chunking and reference checks, and no-LLM footnote merging. Changes save to `data/user/settings/main.yaml`. - - -| Mode | What it does | -| --- | --- | -| **Update** | Incremental fact extraction with L2 and L3 budgets; per-doc overrides live in the workbench. | -| **Audit** | Line edits checked against source entities or L2 facts. | -| **Dedup** | Iterative dedup over the full doc; stops early when an iteration emits zero edits. | -| **Merge footnotes** | No-LLM cleanup that collapses and renumbers duplicate reference rows; three toggles run it after Update, Audit, or Dedup. | - -## CLI - -```bash -deeptutor memory show L3 -deeptutor memory show L2 -deeptutor memory show profile -deeptutor memory show chat -deeptutor memory clear trace --force -``` +Update, Audit, and Dedup budgets are **Settings → Memory**. See [Settings](/self-hosting/settings/). `deeptutor memory show` prints a layer; the flags are in the [command reference](/developers/reference/cli/). ## Good practice @@ -69,6 +49,6 @@ Try stating a preference explicitly in Chat, then inspect Memory to verify what ## See also -- [Home](/explore/chat-workspace/) — the loop that reads and writes memory -- [Partners](/explore/partners/) — how a partner's memory relates to yours -- [Settings](/explore/settings/) — the full control plane +- [Home](/learning-workspace/chat/) — the loop that reads and writes memory +- [Partners](/channels/) — how a partner's memory relates to yours +- [Settings](/self-hosting/settings/) — the full control plane diff --git a/docs/src/content/docs/explore/co-writer.md b/docs/src/content/docs/learning-workspace/notebook.md similarity index 89% rename from docs/src/content/docs/explore/co-writer.md rename to docs/src/content/docs/learning-workspace/notebook.md index 8d2879214..90763d37e 100644 --- a/docs/src/content/docs/explore/co-writer.md +++ b/docs/src/content/docs/learning-workspace/notebook.md @@ -27,7 +27,7 @@ A reply can be inserted below the line for review or saved as a subpage. Propose ## Bring sources into your own writing -Use **Insert favorite** to search, preview and insert original records from [Favorites](/explore/favorites/). You can also ask Dito to synthesize several favorites with citations. Source insertion and knowledge-base actions help ground notes in material you can revisit. +Use **Insert favorite** to search, preview and insert original records from [Favorites](/learning-workspace/favorites/). You can also ask Dito to synthesize several favorites with citations. Source insertion and knowledge-base actions help ground notes in material you can revisit. For example, create `Conditional probability`, insert a saved explanation, then write your own counterexample. Ask Dito to check the argument and propose a clearer paragraph; review the suggestion before applying it. Keep a `Practice` subpage for the questions the topic raises. @@ -39,4 +39,4 @@ The notebook can hold learning blocks such as quizzes, flashcards, diagrams and The page menu exports **Markdown** or **Word**. Word keeps text and source links; interactive blocks become static. Review the export when you need to submit or share it. Keep Favorites for original source records and the notebook for your synthesis, structure and study activity. -Notebook pages belong to the active workspace. Switching workspaces changes the page library. [Personalization](/explore/personalization/) can shape how the assistant helps across workspaces, while the page content remains with its project. +Notebook pages belong to the active workspace. Switching workspaces changes the page library. [Personalization](/customize/) can shape how the assistant helps across workspaces, while the page content remains with its project. diff --git a/docs/src/content/docs/explore/practice.md b/docs/src/content/docs/learning-workspace/questions.md similarity index 82% rename from docs/src/content/docs/explore/practice.md rename to docs/src/content/docs/learning-workspace/questions.md index 8b097ac09..d722887e0 100644 --- a/docs/src/content/docs/explore/practice.md +++ b/docs/src/content/docs/learning-workspace/questions.md @@ -1,5 +1,5 @@ --- -title: Practice +title: Questions and practice description: Collect questions, import your own, review mistakes, and schedule the next recall attempt. quadrant: how-to --- @@ -8,6 +8,11 @@ Practice turns questions from your learning activities into repeatable recall. O ![Practice sessions](/screenshots/dev/practice.png) + +## Generate a set + +In [Chat](/learning-workspace/chat/), choose **Quiz**. Ask for a set on one topic, or attach a source first. When the set looks right, collect it into this workspace's question bank and review it with the steps below. + ## Build a question collection Questions from supported chat, book and mastery activities can be collected in the bank. You can also import your own material rather than generating everything again. @@ -41,4 +46,4 @@ If there are no questions due, the page shows that you are caught up. You can st ## Combine practice with the tutor -When you repeatedly miss an item, return to its source chat or open the relevant material in [Reading](/explore/reading/). Ask for an explanation and produce your own example in the [Learning notebook](/explore/co-writer/). Use [Mastery Path](/explore/mastery-path/) when you need assessment of a broader ability; Practice's recall schedule and a path's mastery gate serve different purposes. +When you repeatedly miss an item, return to its source chat or open the relevant material in [Reading](/learning-workspace/reading/). Ask for an explanation and produce your own example in the [Learning notebook](/learning-workspace/notebook/). Use [Mastery Path](/learning-workspace/mastery/) when you need assessment of a broader ability; Practice's recall schedule and a path's mastery gate serve different purposes. diff --git a/docs/src/content/docs/explore/reading.md b/docs/src/content/docs/learning-workspace/reading.md similarity index 96% rename from docs/src/content/docs/explore/reading.md rename to docs/src/content/docs/learning-workspace/reading.md index f530ea083..c111085c3 100644 --- a/docs/src/content/docs/explore/reading.md +++ b/docs/src/content/docs/learning-workspace/reading.md @@ -99,7 +99,7 @@ Use Favorites to preserve a useful result, and the Learning notebook to write yo ## See also -- [Home](/explore/chat-workspace/) — the loop this capability runs on -- [Knowledge Center](/explore/knowledge/) — index a corpus instead of reading one document -- [Resources](/explore/space/) — save what you found into a notebook -- [Server API](/cli/server-api/#immersive-reading) — the `/api/reading` surface +- [Home](/learning-workspace/chat/) — the loop this capability runs on +- [Knowledge Center](/learning-workspace/knowledge/) — index a corpus instead of reading one document +- [Resources](/learning-workspace/resources/) — save what you found into a notebook +- [Server API](/developers/reference/http-api/#immersive-reading) — the `/api/reading` surface diff --git a/docs/src/content/docs/learning-workspace/research.md b/docs/src/content/docs/learning-workspace/research.md new file mode 100644 index 000000000..2f9e717ad --- /dev/null +++ b/docs/src/content/docs/learning-workspace/research.md @@ -0,0 +1,24 @@ +--- +title: Research +description: Run one Deep Research question and file the cited report in your notebook. +quadrant: how-to +--- + +**Research** (`deep_research`) investigates one question and returns a cited report. Use it when a chat answer is too thin and you want the sources kept with the writing. + +## Produce one cited report + +1. Open [Chat](/learning-workspace/chat/) in the project workspace. +2. Choose **Research** under **More Capabilities**. +3. Attach a knowledge base when the sources should come from your library. Otherwise the run can use the web and preprint search that the workspace already allows. +4. Ask one question, and say what the report must decide. Example: “What changed in retrieval-augmented generation after 2023? Cite the papers you use, and stop at six.” +5. Wait until the report is in the thread. Open cited items before you rely on a claim. + +## File it + +Save passages you will quote to [Favorites](/learning-workspace/favorites/). Continue in the [notebook](/learning-workspace/notebook/) when the report should become your own draft. Favorites keep the source; the notebook keeps your writing. + +## See also + +- [Knowledge](/learning-workspace/knowledge/) — build the library you attach +- [How the agent loop works](/learning-workspace/agent-loop/) diff --git a/docs/src/content/docs/explore/space.md b/docs/src/content/docs/learning-workspace/resources.md similarity index 70% rename from docs/src/content/docs/explore/space.md rename to docs/src/content/docs/learning-workspace/resources.md index b2abf2925..59de6b23a 100644 --- a/docs/src/content/docs/explore/space.md +++ b/docs/src/content/docs/learning-workspace/resources.md @@ -4,7 +4,7 @@ description: Find the current workspace's conversations, favorites, learning jou quadrant: how-to --- -**Resources** is the current [workspace](/explore/workspaces/)'s reusable material shelf. Open it from the sidebar (`/space`). The Classic layout calls this area **Learning Space**. It holds inputs and saved records that you can bring back into Chat and Learning. +**Resources** is the current [workspace](/learning-workspace/workspaces/)'s reusable material shelf. Open it from the sidebar (`/space`). The Classic layout calls this area **Learning Space**. It holds inputs and saved records that you can bring back into Chat and Learning. ![Resources for the active workspace](/screenshots/dev/resources.png) @@ -13,10 +13,10 @@ quadrant: how-to | Resource | What it keeps | A useful next step | | --- | --- | --- | | **Chat History** | Previous conversations with their organization and source context | Reopen the original thread or reference it in a new turn | -| **[Favorites](/explore/favorites/)** | Collections of saved original conversations and results | Insert selected records into a Learning notebook page | +| **[Favorites](/learning-workspace/favorites/)** | Collections of saved original conversations and results | Insert selected records into a Learning notebook page | | **Learning journal** | Current mission, session handoff and confirmed learning records | Check what you were working toward before resuming | -| **Question Bank** | Questions, answers, explanations and mistakes | Choose a set for [Practice](/explore/practice/) | -| **[Knowledge Center](/explore/knowledge/)** | Knowledge bases and retrieval integrations | Attach an available base to a conversation or learning task | +| **Question Bank** | Questions, answers, explanations and mistakes | Choose a set for [Practice](/learning-workspace/questions/) | +| **[Knowledge Center](/learning-workspace/knowledge/)** | Knowledge bases and retrieval integrations | Attach an available base to a conversation or learning task | Counts help locate populated resources. Their scope follows the active workspace and resource availability; a failed count does not mean the underlying records disappeared. @@ -25,7 +25,7 @@ Counts help locate populated resources. Their scope follows the active workspace 1. Select the workspace for your subject. 2. Add source documents to a knowledge base if you want reusable retrieval, or use Reading when you want the original document beside the conversation. 3. Work in Chat, Reading, Books or Mastery Path and save useful results to Favorites. -4. Open the [Learning notebook](/explore/co-writer/) from **Home** to write your own notes, inserting favorites and source links as needed. +4. Open the [Learning notebook](/learning-workspace/notebook/) from **Home** to write your own notes, inserting favorites and source links as needed. 5. Return to Question Bank for organization and Practice for scheduled recall. For example, keep lecture PDFs in a `Signals` knowledge base, clear explanations in a Favorites collection, and your own derivations in notebook pages. These assets can work together without being interchangeable. @@ -44,7 +44,7 @@ Some optional deployments show extra resource tiles only when the corresponding ## Continue from here -- [Workspaces](/explore/workspaces/) — choose the container before organizing materials. -- [Learning](/explore/learning/) — create and resume learning activities. -- [Home](/explore/chat-workspace/) — attach the appropriate material to a turn. -- [DeepTutor Ecosystem](/ecosystem/) — configure retrieval, Skills and connected tools. +- [Workspaces](/learning-workspace/workspaces/) — choose the container before organizing materials. +- [Learning](/learning-workspace/) — create and resume learning activities. +- [Home](/learning-workspace/chat/) — attach the appropriate material to a turn. +- [DeepTutor Ecosystem](/customize/) — configure retrieval, Skills and connected tools. diff --git a/docs/src/content/docs/explore/task-board.md b/docs/src/content/docs/learning-workspace/task-board.md similarity index 74% rename from docs/src/content/docs/explore/task-board.md rename to docs/src/content/docs/learning-workspace/task-board.md index 803e09f10..479e79fa5 100644 --- a/docs/src/content/docs/explore/task-board.md +++ b/docs/src/content/docs/learning-workspace/task-board.md @@ -16,10 +16,10 @@ Open **Home → Task Board** (`/kanban`) to organize the active workspace's task 4. Filter to **Today** or **This week** to narrow the board by date. 5. Archive completed tasks when you want to clear the active view. Use the archived view to restore them. -A card's due date appears on the card; overdue unfinished work is highlighted. Cards can also show how many calendar time blocks are linked to them. Open [Calendar](/explore/calendar/) to plan time around the work. A deadline and a reserved study period are distinct: giving a task a due date does not by itself mean you reserved time to do it. +A card's due date appears on the card; overdue unfinished work is highlighted. Cards can also show how many calendar time blocks are linked to them. Open [Calendar](/learning-workspace/calendar/) to plan time around the work. A deadline and a reserved study period are distinct: giving a task a due date does not by itself mean you reserved time to do it. ## A practical revision board Create three tasks: “Read the conditional-probability proof,” “Write my own example,” and “Complete today's review.” Keep the reading collection, notebook page and Practice session in their own learning surfaces; put their next actions on the board. Move each card as you finish it, and archive the set after the exam. -The board follows the selected [workspace](/explore/workspaces/). If you switch from `Probability` to `Research project`, you see that project's tasks. Calendar events remain account level, with workspace task and study layers shown alongside them. +The board follows the selected [workspace](/learning-workspace/workspaces/). If you switch from `Probability` to `Research project`, you see that project's tasks. Calendar events remain account level, with workspace task and study layers shown alongside them. diff --git a/docs/src/content/docs/learning-workspace/vision-solver.md b/docs/src/content/docs/learning-workspace/vision-solver.md new file mode 100644 index 000000000..312ccf0f3 --- /dev/null +++ b/docs/src/content/docs/learning-workspace/vision-solver.md @@ -0,0 +1,30 @@ +--- +title: Vision Solver +description: Solve one photographed problem in Chat, then keep the question for practice. +quadrant: how-to +--- + +Vision Solver is the **Solve** capability working from an image. The same turn can plan steps, run a check, and, for a geometric figure, call GeoGebra. + +## Solve one photo + +1. Open [Chat](/learning-workspace/chat/) in the workspace for this subject. +2. In the capability menu, open **More Capabilities** and choose **Solve**. +3. Use **+** and attach one photo of the problem. Crop to the question you want solved. +4. Send: “Solve this. Show each step, then the final answer. Stop and ask if the figure is ambiguous.” +5. Read the steps in the thread. Open Activity if you want the tool trace. + +You are done when the thread contains a worked solution you can check against the photo. + +## A geometric figure + +If the picture is a construction, turn on `geogebra_analysis` under **Settings → Tools** before you send. Solve can then turn the figure into GeoGebra commands. Leave it off for a purely algebraic photo. + +## Keep the question + +When the solution is worth practicing, collect it into [Questions and practice](/learning-workspace/questions/) and review it later. A [Mastery Path](/learning-workspace/mastery/) is the place to test a wider topic, not this single photo. + +## See also + +- [How the agent loop works](/learning-workspace/agent-loop/) +- [Math Animator](/multimodal-studio/math-animator/) — animate a derivation after you understand the steps diff --git a/docs/src/content/docs/explore/workspaces.md b/docs/src/content/docs/learning-workspace/workspaces.md similarity index 88% rename from docs/src/content/docs/explore/workspaces.md rename to docs/src/content/docs/learning-workspace/workspaces.md index eeacbdd9b..29aeb43a1 100644 --- a/docs/src/content/docs/explore/workspaces.md +++ b/docs/src/content/docs/learning-workspace/workspaces.md @@ -48,4 +48,4 @@ Settings lets you rename a custom workspace, edit its instructions and resource ## A practical study setup -Create `Signals and systems`, add lecture files, and assign the relevant knowledge base. Ask in [Home](/explore/chat-workspace/) for a short explanation, open the source in [Immersive Reading](/explore/reading/), and create a [Mastery Path](/explore/mastery-path/) for the skills you need. Save useful answers to [Favorites](/explore/favorites/) and build your own synthesis in the [Learning notebook](/explore/co-writer/). Return to [Practice](/explore/practice/) for daily recall. All of these remain organized under that workspace. +Create `Signals and systems`, add lecture files, and assign the relevant knowledge base. Ask in [Home](/learning-workspace/chat/) for a short explanation, open the source in [Immersive Reading](/learning-workspace/reading/), and create a [Mastery Path](/learning-workspace/mastery/) for the skills you need. Save useful answers to [Favorites](/learning-workspace/favorites/) and build your own synthesis in the [Learning notebook](/learning-workspace/notebook/). Return to [Practice](/learning-workspace/questions/) for daily recall. All of these remain organized under that workspace. diff --git a/docs/src/content/docs/multimodal-studio/index.md b/docs/src/content/docs/multimodal-studio/index.md new file mode 100644 index 000000000..6c6ca9916 --- /dev/null +++ b/docs/src/content/docs/multimodal-studio/index.md @@ -0,0 +1,17 @@ +--- +title: Which generator to use +description: How Visualize, Math Animator, and Video Lesson divide the work of making something you can watch. +quadrant: explanation +--- + +DeepTutor has three generators. They share the chat thread and a model, and they answer different jobs. + +| Generator | You want | What comes back | +| --- | --- | --- | +| [Visualize](/multimodal-studio/visualize/) | A figure you can read: a plot, a diagram, a small interactive page | SVG, Mermaid, Chart.js, or HTML in the thread | +| [Math Animator](/multimodal-studio/math-animator/) | A derivation or geometric construction that has to move | A Manim video or a storyboard | +| [Video Lesson](/multimodal-studio/video-lesson/) | A short lesson someone can play, with captions | A browser lesson, optionally narrated | + +Visualize can also hand a math animation to the Manim renderer. Math Animator is the path when the subject is the mathematics itself. Video Lesson is a lesson, not a single figure: it writes a sequence, checks the render, and plays it in the browser. + +All three are capabilities on top of the same [agent loop](/learning-workspace/agent-loop/). A missing system tool (LaTeX, ffmpeg, or Node for a source install) stops the render. It does not change which generator you should have chosen. diff --git a/docs/src/content/docs/multimodal-studio/math-animator.md b/docs/src/content/docs/multimodal-studio/math-animator.md new file mode 100644 index 000000000..479e3e103 --- /dev/null +++ b/docs/src/content/docs/multimodal-studio/math-animator.md @@ -0,0 +1,23 @@ +--- +title: Math Animator +description: Render one Manim math animation from Chat. +quadrant: how-to +--- + +**Math Animator** (`math_animator`) writes a Manim scene for one derivation or construction and renders a video or a storyboard. The machine that renders needs LaTeX and ffmpeg. A desktop install does not bundle those tools. + +On a source or PyPI install, the renderer comes from the `math-animator` extra. See [Install from source](/self-hosting/source/#optional-install-extras). + +## Render one animation + +1. Confirm `latex` and `ffmpeg` run in a terminal on this computer. +2. Open [Chat](/learning-workspace/chat/) and choose **Math Animator**. +3. Describe one transformation. Example: “Animate the derivative of sin(x²) as the chain rule, one step at a time, then hold the final expression.” +4. Wait for the video or storyboard in the thread. Play it once and check that each step matches the algebra. + +If the render fails on a missing binary, install that binary and send the same request again. Do not switch generators to hide a missing tool. + +## See also + +- [Visualize](/multimodal-studio/visualize/) — a still figure +- [Which generator to use](/multimodal-studio/) diff --git a/docs/src/content/docs/multimodal-studio/video-lesson.md b/docs/src/content/docs/multimodal-studio/video-lesson.md new file mode 100644 index 000000000..e7e731412 --- /dev/null +++ b/docs/src/content/docs/multimodal-studio/video-lesson.md @@ -0,0 +1,23 @@ +--- +title: Video Lesson +description: Generate one captioned lesson that plays in the browser. +quadrant: how-to +--- + +**Video Lesson** (`video_lesson`) writes a short lesson, checks the render, and plays it in the browser with captions. Narration uses the Text-to-Speech provider in Settings, or Edge when that provider is not set. + +A source install needs Node.js 22 or newer and npm on the machine that renders. The desktop app already includes Node. + +## Generate one lesson + +1. Open [Chat](/learning-workspace/chat/) and choose **Video Lesson**. +2. Ask for one idea and a length. Example: “A three-minute lesson on the sampling theorem for a first-year class. Captions on. One worked numeric example.” +3. Wait until the player appears in the thread. Play it through once. +4. If you wanted a voice and the lesson is silent, set a TTS provider under **Settings → Models & services** and generate the lesson again. + +The lesson is done when you can watch it in the thread with captions that match the pictures. + +## See also + +- [Which generator to use](/multimodal-studio/) +- [Providers and models](/get-started/providers/) — TTS lives with the other model profiles diff --git a/docs/src/content/docs/multimodal-studio/visualize.md b/docs/src/content/docs/multimodal-studio/visualize.md new file mode 100644 index 000000000..518ad3447 --- /dev/null +++ b/docs/src/content/docs/multimodal-studio/visualize.md @@ -0,0 +1,23 @@ +--- +title: Visualize +description: Generate one diagram from Chat with the Visualize capability. +quadrant: how-to +--- + +**Visualize** turns one description into a figure in the thread. Core results are SVG, Mermaid, Mermaid mind maps, Chart.js, and interactive HTML. + +## Make one figure + +1. Open [Chat](/learning-workspace/chat/). +2. Choose **Visualize** in the capability menu. +3. Name the figure and the claim it must show. Example: “A Chart.js line chart of sampling rate against aliasing, with the Nyquist rate marked. No 3D.” +4. Wait until the figure renders in the thread. If the type is wrong, reply with the type you wanted (SVG, Mermaid, or Chart.js) and ask for a replacement. + +The figure is done when you can read the claim off the picture without the surrounding prose. + +Manim animation and storyboard are also render modes of this capability. For a derivation you want to watch, use [Math Animator](/multimodal-studio/math-animator/). GeoGebra is an optional install, not one of the core types. + +## See also + +- [Which generator to use](/multimodal-studio/) +- [Vision Solver](/learning-workspace/vision-solver/) — start from a photo of a problem instead of a description diff --git a/docs/src/content/docs/partners/channels.md b/docs/src/content/docs/partners/channels.md deleted file mode 100644 index 06dd96019..000000000 --- a/docs/src/content/docs/partners/channels.md +++ /dev/null @@ -1,109 +0,0 @@ ---- -title: Channel Matrix -description: All built-in Partner channels, their connection model, required fields, and when to use each one. -quadrant: reference ---- - -Partner channels are delivery adapters around the same Partner brain. They do not create a second agent runtime: an inbound IM event becomes a scoped chat turn, and the reply is delivered back through the channel. - -Use the web UI for most configuration: **Partners -> your partner -> Channels** renders the live schema from `/api/partners/channels/schema`, masks secret fields, polls `/channels/status`, and lets you reload channels without rewriting YAML by hand. - -![A Partner’s channel configuration](/screenshots/dev/partners-channels.png) - -## Built-in channels - -| Channel | Key | Connection model | Best for | Required core fields | -| --- | --- | --- | --- | --- | -| WeChat | `weixin` | HTTP long-poll + QR login | Personal WeChat assistant | `allow_from`; optional `token`, `state_dir`, `route_tag`, `poll_timeout` | -| WeCom | `wecom` | WeCom AI Bot WebSocket | Enterprise WeChat / WeChat Work | `bot_id`, `secret`, `allow_from` | -| QQ | `qq` | Tencent botpy WebSocket | Official QQ bot deployments | `app_id`, `secret`, `allow_from`, `msg_format` | -| QQ (NapCat) | `napcat` | OneBot v11 WebSocket | Personal QQ via NapCat | `ws_url`, optional `access_token`, `allow_from`, `group_policy` | -| Telegram | `telegram` | Bot API polling | Simple personal or group bot | `token`, `allow_from` | -| Discord | `discord` | Gateway WebSocket | Discord servers and DMs | `token`, `allow_from`, group policy fields | -| Slack | `slack` | Socket Mode | Slack teams, DMs, threaded channel help | `bot_token`, `app_token`, `allow_from`, `group_policy` | -| Feishu / Lark | `feishu` | Lark SDK WebSocket | Feishu/Lark enterprise chat | `app_id`, `app_secret`, verification/encryption fields where used | -| DingTalk | `dingtalk` | Stream Mode | DingTalk enterprise chat | `client_id`, `client_secret`, `allow_from` | -| Matrix | `matrix` | Matrix sync loop | Decentralized rooms, optional E2EE setup | `homeserver`, user credentials or `access_token`, `allow_from`, `group_policy` | -| Zulip | `zulip` | Event queue | Stream + topic workflows | `email`, `api_key`, `site`, `allow_from`, `group_policy` | -| Mattermost | `mattermost` | Native v4 WebSocket + REST | Self-hosted open-source team chat | `server_url`, `bot_token`, `allow_from`, optional `group_policy`, `reply_in_thread`, `verify_ssl` | -| WhatsApp | `whatsapp` | Bridge WebSocket | WhatsApp via a bridge runtime | bridge URL/token, `allow_from` | -| Email | `email` | IMAP poll + SMTP send | Async email tutoring/helpdesk | IMAP host/user/password, SMTP host/user/password, `allow_from` | -| Mochat | `mochat` | Socket.IO or HTTP polling | Customer-service style chat panel | `base_url` / socket URL, `claw_token`, `allow_from` | -| Microsoft Teams | `msteams` | Built-in HTTP webhook listener | Teams DM-first Bot Framework integration | `app_id`, `app_password`, `tenant_id`, host/port/path | - -## Install requirements - -Every built-in channel except Matrix is covered by the Partners extra: - -```bash -python scripts/install_extras.py partners -# or, from an installed release when partners extras are available: -pip install "deeptutor[partners]" -``` - -This pulls in all channel SDKs — `python-telegram-bot`, `slack-sdk`, `lark-oapi`, `dingtalk-stream`, `qq-botpy`, `wecom-aibot-sdk`, `python-socketio`, and friends (the full list lives in `requirements/partners.txt`). Email needs nothing beyond the Python standard library. Matrix ships as its own extra because encrypted rooms need the native `libolm` library: run `python scripts/install_extras.py matrix` for plain rooms or `python scripts/install_extras.py matrix-e2e` for E2EE in a source checkout. - -If a channel's dependency is missing on the server, the Channels panel greys that channel out and shows the import error (for example `No module named 'lark_oapi'`). Installed cards distinguish **Connected**, **Connecting**, **Listener running**, **Waiting for scan**, **Configuration required**, **Connection failed**, and **Not connected**. Install a missing package or fix the displayed setup action, then restart/reload the Partner. - -Stop DeepTutor before changing installed modules or dependencies. Run the source helper from the repository root, restart with the same data directory, then check `deeptutor module list` and the Channels status. Wheel-based installations should use the extras supported by their matching release; do not install feature wheels over a source checkout. - -## Shared delivery switches - -Most channels inherit the same delivery controls: - -| Field | Meaning | -| --- | --- | -| `enabled` | Whether the Partner should start this channel. | -| `send_progress` | Deliver narration/progress updates during long turns. | -| `send_tool_hints` | Deliver one-line tool-call hints. Useful while debugging, noisy in production. | -| `streaming` | Telegram, Discord, and Feishu only: stream the reply live by editing the message in place as text arrives (Feishu uses CardKit streaming cards). Requires `send_progress`. Off by default. | -| `allow_from` | User/chat allowlist. `*` is convenient for tests; explicit ids are safer for deployment. | - -## Configuration workflow - -1. Create and test the Partner in the web UI before enabling any IM channel. -2. Enable only one channel first. -3. Keep `send_progress` and `send_tool_hints` on while debugging. -4. Start with `allow_from: ["*"]` only in local/private tests. -5. Confirm the live card reaches a connected/listening state, send a short message, then replace `*` with real sender ids; inspect logs only if the status detail is insufficient. -6. Add more channels only after the first channel is stable. - -## Choosing a channel - -- Use **WeChat** for personal WeChat. It requires a human QR-code scan and persisted state. -- Use **WeCom**, **Feishu**, **DingTalk**, **Slack**, or **Teams** for enterprise/team deployments. -- Use **QQ** for official Tencent bot accounts; use **NapCat** only when you intentionally operate a personal QQ bridge. -- Use **Email** when asynchronous replies are acceptable and users prefer inbox workflows. -- Use **Matrix** or **Zulip** when room/topic structure matters more than consumer IM convenience. -- Use **Mattermost** for a self-hosted, open-source team chat you run yourself. - -## Where state lives - -Channel state is stored below the Partner's `channels/` directory, for example: - -```text -data/partners//channels/weixin/account.json -data/partners//channels/msteams/msteams_conversations.json -``` - -Persist the whole `data/partners/` tree in Docker or production hosts. Losing channel state can force new QR scans or conversation-reference collection. - -## Detailed pages - -Every built-in channel has a dedicated page with platform-side registration steps, a field-by-field walkthrough of the channel card, and troubleshooting: - -- [WeChat](/partners/weixin/) — personal WeChat QR login and long-poll setup -- [WeCom](/partners/wecom/) — Enterprise WeChat AI Bot setup -- [QQ / NapCat](/partners/qq/) — official QQ bot and personal QQ bridge paths -- [Telegram](/partners/telegram/) — BotFather registration, Bot API polling, live streaming -- [Discord](/partners/discord/) — Developer Portal app, intents, Gateway WebSocket -- [Slack](/partners/slack/) — Socket Mode app with bot + app tokens -- [Feishu / Lark](/partners/feishu/) — open-platform app and CardKit streaming cards -- [DingTalk](/partners/dingtalk/) — Stream Mode enterprise bot -- [Matrix](/partners/matrix/) — homeserver credentials and optional E2EE -- [Zulip](/partners/zulip/) — bot account and stream subscriptions -- [Mattermost](/partners/mattermost/) — self-hosted server via bot token over the native v4 API -- [WhatsApp](/partners/whatsapp/) — bridge runtime setup -- [Email](/partners/email/) — IMAP polling and SMTP replies -- [Mochat](/partners/mochat/) — Socket.IO customer-service panel -- [Microsoft Teams](/partners/msteams/) — Bot Framework webhook listener diff --git a/docs/src/content/docs/partners/index.md b/docs/src/content/docs/partners/index.md deleted file mode 100644 index 87df10715..000000000 --- a/docs/src/content/docs/partners/index.md +++ /dev/null @@ -1,119 +0,0 @@ ---- -title: Partners & Channels -description: Operator guide for DeepTutor Partners, channel configuration, workspace layout, and IM delivery behavior. -quadrant: how-to ---- - -Partners are persistent DeepTutor companions that can live in the web UI and in external IM apps. They are not a second bot engine. Every incoming message becomes a normal chat-agent turn scoped to that Partner: - -```text -IM / Web message -> PartnerRunner -> ChatOrchestrator -> AgenticChatPipeline -> tools -> reply -``` - -![Partners library](/screenshots/dev/partners.png) - -This page is the operator guide. For the product tour of what a Partner *is* — its soul, library, memory, and web Chat view — see [Explore → Partners](/explore/partners/). A Partner can also be [consulted through My Agents](/explore/subagents/) from a normal chat turn. - -## What changed from TutorBot - -| Old TutorBot | New Partner | -| --- | --- | -| Separate bot engine and `data/tutorbot//` workspace | Same Chat loop, scoped workspace under `data/partners//workspace/` | -| Bot-specific CLI commands such as `deeptutor bot ...` | `deeptutor partner list/create/start/stop` | -| Channels edited in bot YAML | Schema-driven channel cards in the Partners UI | -| Bot skills / memory handled separately | Assigned KBs, skills, notebooks, tools, and memory are mounted like normal chat context | - -Old `/tutorbot/*` documentation URLs redirect to their `/partners/*` replacements so existing external links and bookmarks keep working. - -## Ownership, assignment, and private histories - -Any authenticated user can create a Partner and becomes its owner. The owner and any admin can manage its soul, library, channels, model, lifecycle, and deletion. An admin can also assign a Partner to other users; an assigned user can talk to it, but sees only its identity card rather than its configuration and credentials. - -Configuration and copied library assets are shared, but relationship state is not. Each authenticated non-admin user gets private conversation files and relationship memory under `users//`. During that user's turns, the Partner can also read the interacting user's own shared memory, while learned preferences are written to the private Partner-user relationship memory. Two people using the same Partner therefore do not see each other's threads or learned preferences. Admin turns and unattributed channel traffic use the Partner's top-level session and memory scope as a compatibility fallback. - -## Recommended setup flow - -1. Create the Partner in **Partners -> New partner**. -2. Fill **Identity** and **Soul** before enabling any channel. The first IM reply uses this soul. -3. In **Mind**, pick a model and keep optional tools minimal while testing. -4. In **Library**, choose a private copied library or bind an existing owner workspace for live resources. Test one small KB or skill first. See [resource modes](/explore/partners/#account-companions-and-workspace-resources). -5. In **Channels**, enable exactly one channel and start with a private/local test. -6. Keep `send_progress` and `send_tool_hints` on during debugging, then quiet them down for production. -7. Replace `allow_from: ["*"]` with explicit sender ids before opening a channel to real users. - -![A Partner’s channel configuration](/screenshots/dev/partners-channels.png) - -## Partner Groups - -The Partners page also supports first-class **Partner Groups**. Create a group from two or more Partners, choose its member roster, discussion mode, and shared-memory mode, then hold a shared discussion in which every selected Partner keeps its own role and reasoning. - -Groups keep separate conversation sessions and durable history. A turn can address all members or selected members, and every member's response occupies its own seat. If one seat fails, it can be retried independently without rerunning the Partners that already answered. - -## Channel entry points - -| Channel | Use when | Page | -| --- | --- | --- | -| WeChat (`weixin`) | Personal WeChat via QR-code login and HTTP long-poll | [WeChat](/partners/weixin/) | -| WeCom (`wecom`) | Enterprise WeChat / WeChat Work AI Bot platform | [WeCom](/partners/wecom/) | -| QQ (`qq`) | Official Tencent QQ bot account via botpy | [QQ / NapCat](/partners/qq/) | -| NapCat (`napcat`) | Personal QQ account through OneBot v11 / NapCat | [QQ / NapCat](/partners/qq/) | -| Telegram (`telegram`) | Fastest setup — BotFather token, no public IP | [Telegram](/partners/telegram/) | -| Discord (`discord`) | Discord servers and DMs via Gateway WebSocket | [Discord](/partners/discord/) | -| Slack (`slack`) | Slack teams over Socket Mode, threaded replies | [Slack](/partners/slack/) | -| Feishu (`feishu`) | Feishu / Lark with CardKit streaming cards | [Feishu](/partners/feishu/) | -| DingTalk (`dingtalk`) | DingTalk enterprise bot over Stream Mode | [DingTalk](/partners/dingtalk/) | -| Matrix (`matrix`) | Decentralized rooms, optional E2EE | [Matrix](/partners/matrix/) | -| Zulip (`zulip`) | Stream + topic structured team chat | [Zulip](/partners/zulip/) | -| Mattermost (`mattermost`) | Self-hosted Mattermost via native v4 WebSocket | [Mattermost](/partners/mattermost/) | -| WhatsApp (`whatsapp`) | WhatsApp through a bridge runtime | [WhatsApp](/partners/whatsapp/) | -| Email (`email`) | Async inbox workflows over IMAP/SMTP | [Email](/partners/email/) | -| Mochat (`mochat`) | Customer-service style chat panels | [Mochat](/partners/mochat/) | -| Microsoft Teams (`msteams`) | Teams via Bot Framework webhook listener | [Microsoft Teams](/partners/msteams/) | - -For a side-by-side comparison of connection models, required fields, and delivery switches, see the [Channel Matrix](/partners/channels/). - -## Runtime state - -```text -data/partners// -├── config.yaml # Partner identity, model, channels, tools -├── sessions/ # Shared/unattributed conversations -│ ├── .jsonl # One append-only file per conversation -│ └── _index.json # Archive metadata, created when needed -├── channels/ -│ └── /... # QR tokens, cursors, conversation refs -├── users// # Private state for an authenticated user -│ ├── sessions/.jsonl -│ └── workspace/memory/ -└── workspace/ - ├── knowledge_bases/ # Copied assigned KBs - └── user/ - ├── workspace/SOUL.md - ├── workspace/skills//SKILL.md - ├── workspace/notebook/ - └── workspace/memory/ -``` - -This tree shows the private-library arrangement. A Partner bound to an existing owner workspace uses that workspace's current resources and outputs folder instead. Soul, channel state, sessions, and relationship memory remain Partner state. Partners and Partner Groups belong to the account, so their cards remain available across workspace switches. - -## Conversation commands - -Partner chats share these slash commands: - -- `/help` — show the available commands. -- `/new` — archive the current conversation and start fresh; `/branch` archives it and continues in a copy; `/stop` halts a running reply. -- `/sessions` — list conversation ids; `/resume ` reopens an archived one and `/delete ` permanently removes one. -- `/status` — Partner, session, model, and tool status; `/history [n]` shows recent messages. -- `/tool [on|off |reset]` — inspect or change enabled tools. -- `/model [number|model name]` — owner or admin lists or switches the model, in a DM. -- `/link ` — in an external DM, link that chat account to the DeepTutor user who generated the code in the web app. - -## Web UI vs CLI - -Use the Web UI for channel configuration because it renders the live schema from `/api/partners/channels/schema` and masks secret-looking fields. Use the CLI for lifecycle checks: - -```bash -deeptutor partner list -deeptutor partner start math-tutor -deeptutor partner stop math-tutor -``` diff --git a/docs/src/content/docs/get-started/cli-only.md b/docs/src/content/docs/self-hosting/cli-only.md similarity index 92% rename from docs/src/content/docs/get-started/cli-only.md rename to docs/src/content/docs/self-hosting/cli-only.md index 3168daffb..ebfa3a8c8 100644 --- a/docs/src/content/docs/get-started/cli-only.md +++ b/docs/src/content/docs/self-hosting/cli-only.md @@ -50,7 +50,7 @@ deeptutor memory show deeptutor config show ``` -Full surface: [**DeepTutor CLI**](/cli/). +Full surface: [**DeepTutor CLI**](/developers/guides/cli/). ## Source CLI and minimal core are different installs @@ -79,13 +79,13 @@ python -m pip check deeptutor module list ``` -Restart using the same `DEEPTUTOR_HOME`. Account Partner state is stored under `data/partners//`; choosing a content workspace for the Partner is separate from its runtime home. Channel credentials and private relationship histories remain Partner state. See [Partners](/explore/partners/). +Restart using the same `DEEPTUTOR_HOME`. Account Partner state is stored under `data/partners//`; choosing a content workspace for the Partner is separate from its runtime home. Channel credentials and private relationship histories remain Partner state. See [Partners](/channels/). ## Use it from another agent The CLI is **agent-native**. `deeptutor run --format json` emits one JSON event per line, and data-inspection commands such as `kb list`, `kb search`, `session show`, and `notebook show` expose JSON where implemented — useful for piping into another agent's harness. -Hand the [`SKILL.md`](https://github.com/HKUDS/DeepTutor/blob/main/SKILL.md) at the project root to any tool-using LLM and it can drive DeepTutor on its own. See [**Agent handoff**](/cli/agent-handoff/) for the patterns. +Hand the [`SKILL.md`](https://github.com/HKUDS/DeepTutor/blob/main/SKILL.md) at the project root to any tool-using LLM and it can drive DeepTutor on its own. See [**Agent handoff**](/developers/guides/agent-handoff/) for the patterns. ## Updating @@ -120,10 +120,10 @@ Stop DeepTutor, then add the Partner dependency group from the source root: python scripts/install_extras.py partners ``` -More: [**Troubleshooting**](/get-started/troubleshooting/). +More: [**Troubleshooting**](/self-hosting/troubleshooting/). ## Next -- [**DeepTutor CLI**](/cli/) — full CLI reference -- [**Agent handoff**](/cli/agent-handoff/) — let your agent drive -- [**Partners & Channels**](/partners/) — run a Partner from CLI +- [**DeepTutor CLI**](/developers/guides/cli/) — full CLI reference +- [**Agent handoff**](/developers/guides/agent-handoff/) — let your agent drive +- [**Partners & Channels**](/channels/) — run a Partner from CLI diff --git a/docs/src/content/docs/self-hosting/configuration.md b/docs/src/content/docs/self-hosting/configuration.md new file mode 100644 index 000000000..4731d70c7 --- /dev/null +++ b/docs/src/content/docs/self-hosting/configuration.md @@ -0,0 +1,36 @@ +--- +title: Configuration files +description: The settings JSON files a deployment actually reads, and the keys the setup capability may write. +quadrant: reference +--- + +DeepTutor reads configuration from `data/user/settings/*.json` inside the runtime home. A process environment variable overrides only a few startup values. Podman host-port mappings are the variables in `.env.example`. + +## Files the app reads + +| File | What it holds | +| --- | --- | +| `interface.json` | Personal interface choices, including language and theme. | +| `system.json` | Ports and the server-side API base. `next_public_api_base` is the address the frontend server uses to reach the backend. `cors_origins` lists page origins allowed to call the API when auth is on. | +| `document_parsing.json` | The document parsing engine. | +| `model_catalog.json` | Provider profiles and the selected models. | +| `auth.json` | Multi-user auth. `enabled`, `token_expire_hours`, and `cookie_secure` are the switch documented in [Multi-user](/self-hosting/multi-user/). | + +The screen that edits these values is [Settings](/self-hosting/settings/). + +## Keys the setup capability may write + +These rows come from `deeptutor/services/config/settings_spec.py`. They are the knobs that capability is allowed to change. They are not a dump of every JSON field. Secrets are not in this table; credentials are entered in the Settings card. + +| Key | Area | Scope | Effect | +| --- | --- | --- | --- | +| `interface.language` | interface | personal | instant | +| `interface.response_language` | interface | personal | instant | +| `interface.theme` | interface | personal | instant | +| `document_parsing.engine` | parsing | global | instant; already parsed documents keep their text until re-upload | +| `catalog.llm` | models | global | instant, after a connectivity probe | +| `catalog.embedding` | models | global | reindex, after a connectivity probe | +| `catalog.search` | models | global | instant | +| `web_fetch.backend` | models | global | instant | + +Personal rows live in the caller's `interface.json`. Global rows live in the shared deployment settings and are administrator-only. diff --git a/docs/src/content/docs/self-hosting/desktop.md b/docs/src/content/docs/self-hosting/desktop.md new file mode 100644 index 000000000..3c5d60686 --- /dev/null +++ b/docs/src/content/docs/self-hosting/desktop.md @@ -0,0 +1,29 @@ +--- +title: Desktop editions +description: The four Open DeepTutor downloads and where each edition stores data and logs. +quadrant: reference +--- + +Open DeepTutor is the double-click app for macOS and Windows. The first launch installs the bundled runtime, starts the services on loopback, and opens the web UI. Packaging and signing stay in the repository's `apps/desktop/README.md`. + +## Downloads + +Each release publishes four files. `` is the DeepTutor version bundled in that build. + +| Target | App | Download | +| --- | --- | --- | +| `macos-arm64` | Open DeepTutor for MacOS with Apple Silicon | `Open-DeepTutor-MacOS-Apple-Silicon-v.dmg` | +| `macos-x64` | Open DeepTutor for MacOS with Intel | `Open-DeepTutor-MacOS-Intel-v.dmg` | +| `windows-x64` | Open DeepTutor for Windows | `Open-DeepTutor-Windows-v-Setup.exe` and `Open-DeepTutor-Windows-v-Portable.zip` | + +The GitHub Release also keeps unversioned aliases for the latest files. Install steps are in the [Desktop tutorial](/get-started/desktop/). + +## Data and logs + +| | macOS | Windows | +| --- | --- | --- | +| Data | `~/Library/Application Support/Open DeepTutor/workspace/data` | `%LOCALAPPDATA%\Open DeepTutor\workspace\data` | +| Runtimes | `…/Open DeepTutor/runtimes/` | the same path under `%LOCALAPPDATA%` | +| Logs | `…/Open DeepTutor/logs/runtime.log` | the same path under `%LOCALAPPDATA%` | + +Quitting the app stops the services that app started. It does not stop a separate `deeptutor start`. diff --git a/docs/src/content/docs/self-hosting/docker.md b/docs/src/content/docs/self-hosting/docker.md new file mode 100644 index 000000000..ae9325703 --- /dev/null +++ b/docs/src/content/docs/self-hosting/docker.md @@ -0,0 +1,188 @@ +--- +title: Docker operations +description: Volumes, ports, reverse proxies, local models, and upgrades for the published container. +quadrant: how-to +--- + +The first-run command stays on the [Docker tutorial](/get-started/docker/). This page is the rest of the deployment. + +## Select a host content workspace + +By default content workspace storage lives inside the `deeptutor-data` volume. To use a folder on the host instead, mount it at the stable container path `/workspace` and lock DeepTutor to it: + +```bash +mkdir -p "$PWD/deeptutor-workspace/outputs" +docker run --rm --name deeptutor \ + -p 127.0.0.1:3782:3782 \ + -v deeptutor-data:/app/data \ + -v "$PWD/deeptutor-workspace:/workspace" \ + -e DEEPTUTOR_WORKSPACE_ROOT=/workspace \ + -e DEEPTUTOR_WORKSPACE_ALLOWED_ROOTS=/workspace \ + ghcr.io/hkuds/deeptutor:latest +``` + +Create `outputs/` yourself before the first run — otherwise Docker creates the bind source as root and the unprivileged app cannot write into it. + +The container always sees `/workspace`, so paths stay portable across hosts. This deployment root constrains every account. Managed workspaces use account-scoped directories under `outputs/.deeptutor/chat/`; **Settings → Workspace** manages their identities and storage without exposing private runtime settings. + +With Compose, set `DEEPTUTOR_WORKSPACE_HOST=/absolute/host/folder` before `python scripts/docker_compose.py up -d`; the helper creates the folder and its `outputs/` for you. Omit it to keep `./data/user/workspace`. + +## Detached mode + +Add `-d` to run in the background: + +```bash +docker run -d --name deeptutor \ + -p 127.0.0.1:3782:3782 \ + -v deeptutor-data:/app/data \ + ghcr.io/hkuds/deeptutor:latest + +docker logs -f deeptutor # follow logs +docker stop deeptutor # stop +docker rm deeptutor # remove (volume persists) +``` + +The `deeptutor-data` volume keeps your settings and default content workspace across `stop` / `rm` cycles. To truly start over: `docker volume rm deeptutor-data`. + +## Remote Docker / reverse proxy + +The browser only ever talks to the frontend origin (`:3782`); the in-container +Next.js middleware forwards `/api/*` and `/ws/*` to the backend on +`localhost:8001` server-side. So for the common **single-container** case you do +**not** need to configure an API base at all — just point your reverse proxy / +TLS terminator at the published `:3782`: + +```text +deeptutor.example.com { + reverse_proxy localhost:3782 +} +``` + +You only need an API base for a **split deployment**, where the backend runs in a +separate container or host. Set it in `data/user/settings/system.json` in the +mounted volume to the in-network address the **frontend server** uses to reach +the backend — it's read server-side by the proxy, not sent to the browser: + +```json +{ + "next_public_api_base": "http://backend:8001" +} +``` + +`next_public_api_base_external` (and its alias `public_api_base`) are accepted as +lower-precedence fallbacks and normalized on save. + +CORS only matters with auth enabled and a cross-origin frontend: `cors_origins` +lists the frontend page origins allowed to call the backend. With auth disabled, +DeepTutor permits normal HTTP/HTTPS browser origins by default. + +```json +{ + "cors_origins": ["https://deeptutor.example.com"] +} +``` + +## Different host ports + +Change the left side of the `-p host:container` mapping: + +```bash +docker run --rm --name deeptutor \ + -p 127.0.0.1:8088:3782 \ + -v deeptutor-data:/app/data \ + ghcr.io/hkuds/deeptutor:latest +``` + +Add `-p 127.0.0.1:8089:8001` as well if you also want the API exposed on the host. If you change container-side ports in `/app/data/user/settings/system.json`, restart and update the right side of each mapping to match. + +## Connecting to a local LLM (Ollama / LM Studio / llama.cpp / vLLM) + +Inside Docker, `localhost` is the container itself, not your host machine. To reach a model service running on the host, use the host gateway: + +```bash +docker run --rm --name deeptutor \ + -p 127.0.0.1:3782:3782 \ + --add-host=host.docker.internal:host-gateway \ + -v deeptutor-data:/app/data \ + ghcr.io/hkuds/deeptutor:latest +``` + +Then in **Settings → LLM** (or **Embedding**), point the provider Base URL at `host.docker.internal`: + +| Service | Base URL | +|---------|----------| +| Ollama LLM | `http://host.docker.internal:11434/v1` | +| Ollama embedding | `http://host.docker.internal:11434/api/embed` | +| LM Studio | `http://host.docker.internal:1234/v1` | +| llama.cpp | `http://host.docker.internal:8080/v1` | + +Docker Desktop (macOS / Windows) usually resolves `host.docker.internal` **without** `--add-host`. On Linux, the flag is the portable way to create that hostname on modern Docker Engine. + +### Linux alternative — host networking + +Add `--network=host` and drop the `-p` flags: + +```bash +docker run --rm --name deeptutor \ + --network=host \ + -v deeptutor-data:/app/data \ + ghcr.io/hkuds/deeptutor:latest +``` + +The container shares the host network directly, so open (or the `frontend_port` in `system.json`), and host services can be reached with normal localhost URLs like `http://127.0.0.1:11434/v1`. + +> Host networking exposes container ports directly on the host and may conflict with existing services. + +## Updating + +```bash +docker pull ghcr.io/hkuds/deeptutor:latest +docker rm -f deeptutor 2>/dev/null +docker run --rm --name deeptutor \ + -p 127.0.0.1:3782:3782 \ + -v deeptutor-data:/app/data \ + ghcr.io/hkuds/deeptutor:latest +``` + +The volume persists — your settings, KBs, memory all survive the upgrade. + +**Settings → About** identifies the Docker image and can check whether a newer release exists, but container replacement remains a deployment action: pull the new image and recreate the container as shown above. DeepTutor never upgrades packages inside the running container. + +## Common errors + +### `Bind for 0.0.0.0:3782 failed: port is already allocated` + +```bash +lsof -i :3782 # macOS +ss -ltnp | grep :3782 # Linux +``` + +Kill the conflicting process, or choose different host ports in your `-p` mapping. + +### Container exits immediately + +```bash +docker logs deeptutor | tail -30 +``` + +An invalid LLM credential is caught and logged as a warning; it does **not** make backend startup fail. If the container exited, look in the log for a different fatal error. Once the Web UI is available, correct the credential under **Settings → Models & services**. + +### Frontend loads but API calls fail (split deployment) + +With the single-container image this shouldn't happen — the in-container proxy +forwards `/api/*` to the backend automatically. If you run a **split +deployment** with the backend in a separate container or host, set +`next_public_api_base` in `data/user/settings/system.json` (inside the volume) to +the in-network address the frontend server uses to reach the backend, then +restart. + +### Multi-user mode in Docker + +Just toggle auth in the volume's `data/user/settings/auth.json` (`"enabled": true`) and restart. The container picks it up. See [**Multi-User Deployment**](/self-hosting/multi-user/) for the full setup. + +More: [**Troubleshooting**](/self-hosting/troubleshooting/). + +## Next + +- [**Multi-User Deployment**](/self-hosting/multi-user/) — team setup +- [**Explore DeepTutor**](/explore/) — tour the running app diff --git a/docs/src/content/docs/self-hosting/index.md b/docs/src/content/docs/self-hosting/index.md new file mode 100644 index 000000000..6bc9f0bb1 --- /dev/null +++ b/docs/src/content/docs/self-hosting/index.md @@ -0,0 +1,23 @@ +--- +title: Runtime home +description: Where a self-hosted DeepTutor keeps settings, workspaces, and account data. +quadrant: explanation +--- + +Every install path lands in the same runtime home. Settings live in `data/user/settings/` under the directory you launch from, or under `DEEPTUTOR_HOME` / `deeptutor start --home` when you set one. Knowledge bases, memory, Partner runtime state, multi-user accounts, and audit logs live in that same `data/` tree. Persist the tree, and persist any content-workspace directories you configured separately. + +The runtime home is the deployment storage root. It is separate from the workspaces you select inside the app. Home, Learning, and Resources follow the active workspace. Partners and Personalization stay with the account. + +Process environment variables override only a few startup values, such as the ports passed to `deeptutor start`. Podman host-port mappings live in `.env.example`, not in the application settings files. + +## Install paths + +| Path | When it fits | Page | +| --- | --- | --- | +| PyPI | Published packages, full app after 1.7.0 | [PyPI](/self-hosting/pypi/) | +| Source | Current dev checkout | [From source](/self-hosting/source/) | +| Docker | One published container | [Docker tutorial](/get-started/docker/) and [operations](/self-hosting/docker/) | +| CLI only | No web frontend | [CLI only](/self-hosting/cli-only/) | +| Desktop | Double-click app on macOS or Windows | [Desktop editions](/self-hosting/desktop/) | + +Desktop and Docker quickstarts stay under [Get started](/get-started/). This section is the deployment map. diff --git a/docs/src/content/docs/get-started/multi-user.md b/docs/src/content/docs/self-hosting/multi-user.md similarity index 99% rename from docs/src/content/docs/get-started/multi-user.md rename to docs/src/content/docs/self-hosting/multi-user.md index ab645137e..52273b804 100644 --- a/docs/src/content/docs/get-started/multi-user.md +++ b/docs/src/content/docs/self-hosting/multi-user.md @@ -171,4 +171,4 @@ print(bcrypt.hashpw(b"your-password", bcrypt.gensalt()).decode()) Then `deeptutor start` and log in with `alice` + your-password. -More fixes: [**Troubleshooting**](/get-started/troubleshooting/). +More fixes: [**Troubleshooting**](/self-hosting/troubleshooting/). diff --git a/docs/src/content/docs/self-hosting/oauth.md b/docs/src/content/docs/self-hosting/oauth.md new file mode 100644 index 000000000..1417a74e9 --- /dev/null +++ b/docs/src/content/docs/self-hosting/oauth.md @@ -0,0 +1,24 @@ +--- +title: Codex sign-in +description: Sign in to OpenAI Codex with your own ChatGPT plan and confirm the callback. +quadrant: how-to +--- + +OpenAI Codex sign-in uses your own ChatGPT plan. It does not need `OPENAI_API_KEY`. + +## Sign in + +1. Open **Settings → Models & services** and add **OpenAI Codex**. +2. Complete the browser sign-in that DeepTutor opens. +3. The provider redirects the browser to `GET /api/auth/openai-codex/callback` with `code` and `state`, or `error` if the provider refused the login. +4. A successful callback page says that authentication was received. Return to DeepTutor. + +The model list comes from that account's live catalog. Signing in publishes a profile. The profile becomes the active model only when no LLM is configured yet. + +## Where the token lives + +Tokens are stored only in `data/system/user-secrets//private/openai-codex/`. DeepTutor does not read or modify a `~/.codex` CLI login. A token authorizes one person's plan, so the profile cannot be shared through user grants. Each account, including a non-admin user, signs in for itself. The resulting models, catalog, and sign-out stay on that account. + +## Containers + +A default local Docker or Podman deployment uses its own loopback network, so the browser callback needs a temporary bridge during sign-in. The exact Docker, Compose, Podman, and teardown commands are in the repository's [containerization guide](https://github.com/HKUDS/DeepTutor/blob/dev/docs-for-dev/CONTAINERIZATION.md#temporary-local-codex-oauth-bridge). diff --git a/docs/src/content/docs/get-started/pypi.md b/docs/src/content/docs/self-hosting/pypi.md similarity index 93% rename from docs/src/content/docs/get-started/pypi.md rename to docs/src/content/docs/self-hosting/pypi.md index 5eaa98176..05d59a64e 100644 --- a/docs/src/content/docs/get-started/pypi.md +++ b/docs/src/content/docs/self-hosting/pypi.md @@ -4,7 +4,7 @@ description: Understand the published package layout, the modular full profile, quadrant: how-to --- -This page explains the **1.7.x** modular family (the current release is 1.7.4) and migration from the **1.6.15** package layout. Choose the full profile for the Web app or core for terminal chat. For current development features, use [Install from Source](/get-started/from-source/) or build a complete matching local wheel family in a separate environment. +This page explains the **1.7.x** modular family (the current release is 1.7.4) and migration from the **1.6.15** package layout. Choose the full profile for the Web app or core for terminal chat. For current development features, use [Install from Source](/self-hosting/source/) or build a complete matching local wheel family in a separate environment. The 1.6.15 full package includes the Web app and CLI. In the 1.7.x family, **`deeptutor` is core CLI/SDK**, **`deeptutor-cli` is a compatibility alias**, and **`deeptutor[full]` selects the full Web application**. Feature wheels must match the core version. Use Python 3.11–3.14 and Node.js 22 LTS for the current development setup. @@ -59,7 +59,7 @@ For the published 1.6.15 layout, the full PyPI wheel includes Web + CLI. The 1.7 pip install -U "deeptutor[partners]" ``` -The full extras table (`matrix`, `matrix-e2e`, `math-animator`, `dev`, `all`) is in [**Install from Source**](/get-started/from-source/#optional-install-extras) — the same extra names work against the PyPI package. +The full extras table (`matrix`, `matrix-e2e`, `math-animator`, `dev`, `all`) is in [**Install from Source**](/self-hosting/source/#optional-install-extras) — the same extra names work against the PyPI package. ## Where things live @@ -110,7 +110,7 @@ deeptutor memory show # inspect memory deeptutor config show # current config ``` -Full surface: [**DeepTutor CLI**](/cli/). +Full surface: [**DeepTutor CLI**](/developers/guides/cli/). ## Updating @@ -170,9 +170,9 @@ API key was rejected. Re-enter it in **Settings → Language models**, or: deeptutor init # re-runs the wizard, preserves the workspace ``` -For more, see [**Troubleshooting**](/get-started/troubleshooting/). +For more, see [**Troubleshooting**](/self-hosting/troubleshooting/). ## Next -- [**Explore DeepTutor**](/explore/) — tour the running app -- [**Multi-User Deployment**](/get-started/multi-user/) — turn it into a team server +- [**Explore DeepTutor**](/learning-workspace/) — tour the running app +- [**Multi-User Deployment**](/self-hosting/multi-user/) — turn it into a team server diff --git a/docs/src/content/docs/explore/settings.md b/docs/src/content/docs/self-hosting/settings.md similarity index 90% rename from docs/src/content/docs/explore/settings.md rename to docs/src/content/docs/self-hosting/settings.md index 36279777d..aecd7fb07 100644 --- a/docs/src/content/docs/explore/settings.md +++ b/docs/src/content/docs/self-hosting/settings.md @@ -4,7 +4,7 @@ description: The control plane for DeepTutor — appearance, network, workspace, quadrant: how-to --- -Settings is the operational control plane for DeepTutor. Most sections use a **draft-and-apply** model: you edit a draft, test it, then **Apply** — so a bad provider change never takes down a working setup. Values persist to `data/user/settings/*.json` (and a couple of YAML files) in your account. +Settings is the operational control plane for DeepTutor. Most sections use a **draft-and-apply** model: you edit a draft, test it, then **Apply** — so a bad provider change never takes down a working setup. Values persist to `data/user/settings/*.json` (and a couple of YAML files) in your account. The file names and the setup-agent keys are listed in [Configuration files](/self-hosting/configuration/). ## Where it is @@ -26,7 +26,7 @@ Open **Settings** at the bottom of the left sidebar. Its searchable navigator op ## Choose the right scope -Use **Settings** to configure the application, services, and workspace policy. Use [Personalization](/explore/personalization/) to manage reusable personas, skills, agents, and service connections. Use the working workspace's **Home**, **Learning**, and **Resources** for conversations, study, and materials. Partners has its own account-level shelf. +Use **Settings** to configure the application, services, and workspace policy. Use [Personalization](/customize/) to manage reusable personas, skills, agents, and service connections. Use the working workspace's **Home**, **Learning**, and **Resources** for conversations, study, and materials. Partners has its own account-level shelf. Personal preferences accompany the account across workspace switches. Deployment settings such as provider infrastructure, local harness execution, and application installation may require an administrator. Changing a workspace's resource selection does not change either type of ownership. @@ -45,7 +45,7 @@ Save the selection, return to Home, and check its resource picker. Assignments a The workspace policy is an upper bound. Selecting skills or MCP services in a conversation can narrow it further; clearing a conversation selection restores inheritance from the workspace. On a shared deployment, per-user grants are applied as well. The policy never reveals another account's files or credentials. -A Partner can bind an owner workspace to share its current materials. Manage those materials in the workspace's Resources; configure the Partner's identity, channels, and model from Partners. See [Partners](/explore/partners/). +A Partner can bind an owner workspace to share its current materials. Manage those materials in the workspace's Resources; configure the Partner's identity, channels, and model from Partners. See [Partners](/channels/). ## Appearance @@ -57,11 +57,11 @@ Theme, learning text, and code blocks. The two language toggles moved to the Gen The hub for every model and service: language models, a **task model** for automatic calls and Math Animator/Video Lesson repairs, embeddings, web search, voice (TTS/STT), and generation (image/video). Each service uses profiles and a model catalog; credential edits trigger discovery for bulk model import. LLM and Task profiles offer provider-supported API formats: default URLs follow the format, while custom URLs stay unchanged. Models use automatic capability detection or overrides for tools, images, JSON, and reasoning. The **Providers** page holds one vendor credential and links it into every service that vendor serves — one key, entered once. A voice model powers read-aloud and the composer mic; image/video models become chat tools. Use **Test** before **Apply** — a green test proves the profile can make a minimal call, not that the model suits every capability. -See [Chat Workspace → Configure what Chat can use](/explore/chat-workspace/#configure-what-chat-can-use) for the Models page in context, and [Providers](/get-started/providers/) for setup recipes. +See [Chat Workspace → Configure what Chat can use](/learning-workspace/chat/#configure-what-chat-can-use) for the Models page in context, and [Providers](/get-started/providers/) for setup recipes. ## Knowledge Base -The **document parsing** engine that converts uploads into text for knowledge bases and question generation — Text-only, MinerU, Docling, Tika, markitdown, PyMuPDF4LLM, or LiteParse. Local model downloads are **off by default**. See [Knowledge Center → Document parsing](/explore/knowledge/#document-parsing). +The **document parsing** engine that converts uploads into text for knowledge bases and question generation — Text-only, MinerU, Docling, Tika, markitdown, PyMuPDF4LLM, or LiteParse. Local model downloads are **off by default**. See [Knowledge Center → Document parsing](/learning-workspace/knowledge/#document-parsing). ## Chat @@ -73,7 +73,7 @@ Five related controls have their own settings pages: - **Starting points** — how much recent activity feeds the three suggestions under an empty composer. - **Attachments** — upload size caps and extracted-text budgets for chat attachments (admin-gated). -MCP servers are **not** here any more: each account installs its own from the MCP Services store at `/space/mcp` in Personalization, or adds a remote server by URL. See [MCP Services](/ecosystem/mcp/). +MCP servers are **not** here any more: each account installs its own from the MCP Services store at `/space/mcp` in Personalization, or adds a remote server by URL. See [MCP Services](/customize/mcp/). ![Video Learning settings](/screenshots/dev/settings-video.png) @@ -93,13 +93,13 @@ It can also do the slow jobs: installing a parsing engine or fetching its model ## Partners & Agents -Configure the **local agent harnesses you can call on in chat** — Claude Code, Codex, Grok CLI, Antigravity CLI, Kimi CLI, opencode, MiMo Code, Hermes Agent, OpenClaw, and DeepSeek Harness, plus a remote Hermes connection. Each local block reports whether the command exists on this machine, offers model-list sync where supported, and exposes that harness's unattended-run parameters. See [My Agents](/explore/subagents/). +Configure the **local agent harnesses you can call on in chat** — Claude Code, Codex, Grok CLI, Antigravity CLI, Kimi CLI, opencode, MiMo Code, Hermes Agent, OpenClaw, and DeepSeek Harness, plus a remote Hermes connection. Each local block reports whether the command exists on this machine, offers model-list sync where supported, and exposes that harness's unattended-run parameters. See [My Agents](/customize/agents/). ![Partners and agents settings](/screenshots/dev/settings-agents.png) ## Memory -Tunes the chunk-based consolidator: LLM-round budgets per L2 surface and L3 slot for **Update** and **Audit**, plus **Dedup** iterations. See [Memory → Tuning the consolidator](/explore/memory/#tuning-the-consolidator). +Tunes the chunk-based consolidator: LLM-round budgets per L2 surface and L3 slot for **Update** and **Audit**, plus **Dedup** iterations. See [Memory → Tuning the consolidator](/learning-workspace/memory/#tuning-the-consolidator). ## About and updates @@ -118,6 +118,6 @@ Automatic **Update and restart** is offered only for a regular PyPI install insi ## See also - [Providers](/get-started/providers/) — model and search setup recipes -- [DeepTutor Ecosystem](/ecosystem/) — Skills, MCP Services, and CLI Apps managed from Personalization +- [DeepTutor Ecosystem](/customize/) — Skills, MCP Services, and CLI Apps managed from Personalization - [Docker](/get-started/docker/) — port and reverse-proxy notes -- [Memory](/explore/memory/) · [Knowledge Center](/explore/knowledge/) · [My Agents](/explore/subagents/) +- [Memory](/learning-workspace/memory/) · [Knowledge Center](/learning-workspace/knowledge/) · [My Agents](/customize/agents/) diff --git a/docs/src/content/docs/get-started/from-source.md b/docs/src/content/docs/self-hosting/source.md similarity index 96% rename from docs/src/content/docs/get-started/from-source.md rename to docs/src/content/docs/self-hosting/source.md index 17e361719..d6643305f 100644 --- a/docs/src/content/docs/get-started/from-source.md +++ b/docs/src/content/docs/self-hosting/source.md @@ -27,7 +27,7 @@ deeptutor init deeptutor start --dev ``` -`deeptutor start` builds the local `web/` frontend for production once and reuses it; `--dev` runs Next.js with HMR. Config layout, ports, and `Ctrl+C` match the [**PyPI install**](/get-started/pypi/). +`deeptutor start` builds the local `web/` frontend for production once and reuses it; `--dev` runs Next.js with HMR. Config layout, ports, and `Ctrl+C` match the [**PyPI install**](/self-hosting/pypi/). Before changing modules or dependency groups, stop DeepTutor. Check `python -m pip check` and `deeptutor module list` after installation. In source, `module enable/disable` controls assembly; installing or uninstalling module wheels is reserved for a separate wheel environment. Keep the same runtime home when restarting. @@ -167,9 +167,9 @@ python -m uvicorn deeptutor.api.main:app \ --reload --reload-exclude "web/*" --reload-exclude "data/*" ``` -More fixes: [**Troubleshooting**](/get-started/troubleshooting/). +More fixes: [**Troubleshooting**](/self-hosting/troubleshooting/). ## Next -- [**DeepTutor CLI**](/cli/) — drive the CLI from the same workspace -- [**Explore DeepTutor**](/explore/) — tour the running app +- [**DeepTutor CLI**](/developers/guides/cli/) — drive the CLI from the same workspace +- [**Explore DeepTutor**](/learning-workspace/) — tour the running app diff --git a/docs/src/content/docs/get-started/troubleshooting.md b/docs/src/content/docs/self-hosting/troubleshooting.md similarity index 99% rename from docs/src/content/docs/get-started/troubleshooting.md rename to docs/src/content/docs/self-hosting/troubleshooting.md index ba84e0a19..bb119d322 100644 --- a/docs/src/content/docs/get-started/troubleshooting.md +++ b/docs/src/content/docs/self-hosting/troubleshooting.md @@ -298,7 +298,7 @@ Long-poll / WebSocket connections drop occasionally. The channel manager auto-re - For Teams/webhook-style channels, confirm the public callback URL reaches the configured host/port/path - For Matrix, verify the homeserver is not aggressively timing out -See [**Partners & Channels**](/partners/) and the [**Channel Matrix**](/partners/channels/) for channel-specific debugging. +See [**Partners & Channels**](/channels/) and the [**Channel Matrix**](/channels/schema/) for channel-specific debugging. ## Memory / RAG accuracy diff --git a/docs/src/content/docs/welcome.mdx b/docs/src/content/docs/welcome.mdx new file mode 100644 index 000000000..7757f855c --- /dev/null +++ b/docs/src/content/docs/welcome.mdx @@ -0,0 +1,44 @@ +--- +title: Welcome +description: DeepTutor is an agent-native learning companion. Use it to study with your own materials, practice, research, and keep each subject in its own workspace. +quadrant: explanation +--- + +import { CardGrid, LinkCard } from '@astrojs/starlight/components'; + +DeepTutor is an agent-native learning companion. Use it to study with your own materials, practice, research, and keep each subject in its own workspace. + +The DeepTutor workspace, with a conversation beside the learning shelves. + +## Start here + +
+ + + + + +
+ +## What you can do with DeepTutor + +
+ + + + + + + + +
+ +## More resources + +
+ + + + + +
diff --git a/docs/src/content/docs/zh-cn/partners/dingtalk.md b/docs/src/content/docs/zh-cn/channels/domestic/dingtalk.md similarity index 82% rename from docs/src/content/docs/zh-cn/partners/dingtalk.md rename to docs/src/content/docs/zh-cn/channels/domestic/dingtalk.md index accbc240f..d67d14a14 100644 --- a/docs/src/content/docs/zh-cn/partners/dingtalk.md +++ b/docs/src/content/docs/zh-cn/channels/domestic/dingtalk.md @@ -35,14 +35,8 @@ pip install "deeptutor[partners]" 打开 **Partners -> 你的 partner -> Channels -> DingTalk**。 -| 字段 | 怎么填 | -| --- | --- | -| **Send Progress** | 测试时建议开启。长任务会把过程 narration 实时发过来。 | -| **Send Tool Hints** | 调试时建议开启;不想让用户看到一行工具调用就关掉。 | -| **Enabled** | 准备启动 channel 时再打开。 | -| **Client Id** | 凭证与基础信息页的 AppKey(一般 `ding...` 开头)。 | -| **Client Secret** | 同页的 AppSecret。按 secret 存储,保存后会打码。 | -| **Allow From** | 一行一个值。测试可填 `*` 表示开放;正式用换成钉钉 staff id(每条入站消息的 sender id 都会打在 partner 日志里)。空列表会拒绝所有人。 | +这张卡片的字段见[渠道 schema](/zh-cn/channels/schema/#dingtalk)。 + 回复以 markdown 消息发出,标题、列表、链接在钉钉里都能正常渲染。语音消息也能处理:钉钉自带的语音转文字结果会以纯文本转给 partner。 @@ -80,5 +74,5 @@ pip install "deeptutor[partners]" ## 相关页面 -- [Channel Matrix](/zh-cn/partners/channels/) — 所有 channel 一览 -- [Feishu](/zh-cn/partners/feishu/) — 另一大国内办公 IM,同样免 webhook +- [Channel Matrix](/zh-cn/channels/schema/) — 所有 channel 一览 +- [Feishu](/zh-cn/channels/domestic/feishu/) — 另一大国内办公 IM,同样免 webhook diff --git a/docs/src/content/docs/zh-cn/partners/feishu.md b/docs/src/content/docs/zh-cn/channels/domestic/feishu.md similarity index 77% rename from docs/src/content/docs/zh-cn/partners/feishu.md rename to docs/src/content/docs/zh-cn/channels/domestic/feishu.md index 9cedde2e9..4450ef53b 100644 --- a/docs/src/content/docs/zh-cn/partners/feishu.md +++ b/docs/src/content/docs/zh-cn/channels/domestic/feishu.md @@ -51,20 +51,8 @@ channel card 内置了凭据 onboarding,不需要手工复制凭据也能创 打开 **Partners -> 你的 partner -> Channels -> Feishu**。 -| 字段 | 怎么填 | -| --- | --- | -| **Streaming** | 默认关闭。打开后回复用 CardKit 流式卡片实时打字渲染。依赖 **Send Progress**:过程 narration 也会逐轮流式输出。 | -| **Send Progress** | 测试时建议开启。长任务会把过程 narration 实时发过来。 | -| **Send Tool Hints** | 调试时建议开启;不想让用户看到一行工具调用就关掉。 | -| **Enabled** | 准备启动 channel 时再打开。 | -| **App Id** | 凭证与基础信息页的 App ID,`cli_...` 开头。 | -| **App Secret** | 同页的 App Secret。按 secret 存储,保存后会打码。 | -| **Domain** | 国内飞书应用用默认的 `feishu`;国际版 Lark tenant 要选 `lark`,这样 SDK 才会使用 `open.larksuite.com`。扫码流程会自动填写。 | -| **Encrypt Key** | 只有在平台开启了事件加密时才需要填,否则留空。 | -| **Verification Token** | 平台的事件 Verification Token,用于事件签名校验。没配置就留空。 | -| **Allow From** | 一行一个值。测试可填 `*` 表示开放;正式用换成 `ou_...` open id(发一条消息后从 partner 日志里抄)。空列表会拒绝所有人。 | -| **React Emoji** | 机器人收到消息后立刻回应的表情,相当于"已读"确认。默认 `THUMBSUP`;常用的还有 `OK`、`EYES`、`DONE`、`OnIt`、`HEART`。 | -| **Group Policy** | `mention`(默认):群里只有被 @ 才回答。`open`:群里每条消息都回答。私聊永远会回复。 | +这张卡片的字段见[渠道 schema](/zh-cn/channels/schema/#feishu)。 + 出站消息格式由 DeepTutor 自动挑选:短的纯文本直接发文本消息,只带链接的发富文本 post,含标题、代码块、列表、表格的发交互卡片。飞书每张卡片只允许一个表格,多表格回复会自动拆成几张卡片。 @@ -102,5 +90,5 @@ channel card 内置了凭据 onboarding,不需要手工复制凭据也能创 ## 相关页面 -- [Channel Matrix](/zh-cn/partners/channels/) — 所有 channel 一览 -- [DingTalk](/zh-cn/partners/dingtalk/) — 另一大国内办公 IM,同样免 webhook +- [Channel Matrix](/zh-cn/channels/schema/) — 所有 channel 一览 +- [DingTalk](/zh-cn/channels/domestic/dingtalk/) — 另一大国内办公 IM,同样免 webhook diff --git a/docs/src/content/docs/zh-cn/channels/domestic/index.md b/docs/src/content/docs/zh-cn/channels/domestic/index.md new file mode 100644 index 000000000..96fc7db3a --- /dev/null +++ b/docs/src/content/docs/zh-cn/channels/domestic/index.md @@ -0,0 +1,18 @@ +--- +title: 国内 IM +description: 内置的国内聊天渠道各自适合什么样的伙伴。 +quadrant: explanation +--- + +这些渠道投递的是同一个伙伴。差别在于谁持有账号,以及连接怎么维持。 + +| 渠道 | 连接 | 适合 | +| --- | --- | --- | +| [个人微信](/zh-cn/channels/domestic/weixin/) | 扫码登录和 HTTP 长轮询 | 个人微信助手。需要有人扫码。 | +| [企业微信](/zh-cn/channels/domestic/wecom/) | 企业微信 AI Bot WebSocket | 企业微信 | +| [QQ / NapCat](/zh-cn/channels/domestic/qq/) | 官方机器人 WebSocket,或经 NapCat 的个人号 | 官方 QQ 机器人,或你有意桥接的个人 QQ | +| [飞书 / Lark](/zh-cn/channels/domestic/feishu/) | 开放平台 WebSocket 和 CardKit 卡片 | 飞书或 Lark 企业会话 | +| [钉钉](/zh-cn/channels/domestic/dingtalk/) | Stream Mode | 钉钉企业会话,不需要公网回调地址 | +| [Mochat](/zh-cn/channels/domestic/mochat/) | Socket.IO,失败时退回 HTTP 轮询 | 客服面板 | + +先让一个渠道答上话,再加下一个。共用开关和每张卡片的字段在[渠道 schema](/zh-cn/channels/schema/)。 diff --git a/docs/src/content/docs/zh-cn/partners/mochat.md b/docs/src/content/docs/zh-cn/channels/domestic/mochat.md similarity index 58% rename from docs/src/content/docs/zh-cn/partners/mochat.md rename to docs/src/content/docs/zh-cn/channels/domestic/mochat.md index e60c1af8f..521ed0fc6 100644 --- a/docs/src/content/docs/zh-cn/partners/mochat.md +++ b/docs/src/content/docs/zh-cn/channels/domestic/mochat.md @@ -30,39 +30,15 @@ pip install "deeptutor[partners]" 打开 **Partners -> 你的 partner -> Channels -> Mochat**。 -| 字段 | 怎么填 | -| --- | --- | -| **Send Progress** | 测试时建议开启。长任务会把过程 narration 发出去。 | -| **Send Tool Hints** | 调试时建议开启;不想让用户看到一行工具调用就关掉。 | -| **Enabled** | 准备启动 channel 时再打开。 | -| **Base Url** | 你的 Mochat 实例。默认 `https://mochat.io`。 | -| **Socket Url** | 可选的独立 Socket.IO endpoint。留空表示用 **Base Url**。 | -| **Socket Path** | Socket.IO 挂载路径。默认 `/socket.io`。 | -| **Socket Disable Msgpack** | 默认关闭(可用时优先 msgpack)。服务端没有 msgpack parser 时打开,强制走 JSON。 | -| **Socket Reconnect Delay Ms** | 初始重连延迟。默认 `1000`。 | -| **Socket Max Reconnect Delay Ms** | 重连退避上限。默认 `10000`。 | -| **Socket Connect Timeout Ms** | 连接超时。默认 `10000`。 | -| **Refresh Interval Ms** | channel 刷新 session/panel 目录的频率。默认 `30000`。 | -| **Watch Timeout Ms** | HTTP 回退模式下的 long-poll 超时。默认 `25000`。 | -| **Claw Token** | 必填。Mochat 管理后台拿到的 bot token。 | -| **Sessions** | 要监听的 session id,一行一个。`*` 表示自动发现并订阅新 session。 | -| **Panels** | 要监听的 panel id,一行一个。`*` 表示自动发现 panel。两个列表都留空时 channel 什么都不监听。 | -| **Allow From** | 一行一个值。测试可填 `*` 表示开放,或填具体的 Mochat user id。空列表拒绝访问。 | +这张卡片的字段见[渠道 schema](/zh-cn/channels/schema/#mochat)。 + ### 进阶字段 这些用来调重试和群行为;首次部署用默认值就好。 -| 字段 | 怎么填 | -| --- | --- | -| **Watch Limit** | 单次 poll 最多拉取的事件数。默认 `100`。 | -| **Retry Delay Ms** | HTTP 重试失败之间的延迟。默认 `500`。 | -| **Max Retry Attempts** | Socket.IO 重连次数上限。`0` 表示一直重连;这个字段不会限制 HTTP fallback loop。 | -| **Agent User Id** | bot 自己的 Mochat user id。用于忽略 bot 自己的消息和识别 @ 提及。 | -| **Mention** | `require_in_groups` —— 群 session 里必须被 @ 才回复。 | -| **Groups** | 按 group id 的逐群覆盖:`{"": {"require_mention": true}}`。 | -| **Reply Delay Mode** | `non-mention`(默认)会缓冲没有提及 bot 的 panel 消息;填其他值则关闭缓冲。 | -| **Reply Delay Ms** | 缓冲窗口。默认 `120000`(2 分钟)。 | +这张卡片的字段见[渠道 schema](/zh-cn/channels/schema/#mochat)。 + 默认的 reply-delay 模式下,连珠炮式的 panel 消息会合并成一个 Partner turn:每来一条新消息计时器就重置,而直接 @ bot 会让缓冲立刻被处理。 diff --git a/docs/src/content/docs/zh-cn/partners/qq.md b/docs/src/content/docs/zh-cn/channels/domestic/qq.md similarity index 68% rename from docs/src/content/docs/zh-cn/partners/qq.md rename to docs/src/content/docs/zh-cn/channels/domestic/qq.md index fde6f4ea0..759172f66 100644 --- a/docs/src/content/docs/zh-cn/partners/qq.md +++ b/docs/src/content/docs/zh-cn/channels/domestic/qq.md @@ -23,13 +23,8 @@ DeepTutor 有两个 QQ 系渠道: 配置字段: -| 字段 | 说明 | -| --- | --- | -| `enabled` | 是否随 partner 启动该渠道。 | -| `app_id` | 腾讯 bot 平台里的 App ID。 | -| `secret` | Bot secret。 | -| `allow_from` | 允许访问的 QQ user ids / openids。空列表拒绝访问;生产环境建议明确 id。 | -| `msg_format` | `plain` 或 `markdown`。不同 QQ 客户端 Markdown 表现不一,不确定时先用 `plain`。 | +这张卡片的字段见[渠道 schema](/zh-cn/channels/schema/#qq)。 + 启动: @@ -45,16 +40,8 @@ NapCat 会把个人 QQ 暴露成 OneBot v11 WebSocket endpoint。你需要单独 配置字段: -| 字段 | 说明 | -| --- | --- | -| `enabled` | 是否随 partner 启动该渠道。 | -| `ws_url` | NapCat WebSocket endpoint,默认 `ws://127.0.0.1:3001`。 | -| `access_token` | 可选 OneBot access token。 | -| `allow_from` | 允许访问的用户 id。`*` 只建议本地测试使用。 | -| `group_policy` | `mention`、`open`,或 `0` 到 `1` 的概率。被 @ 或回复时总会响应。 | -| `group_policy_overrides` | 按群 id 覆盖 group policy 的 map。 | -| `welcome_new_members` | 是否欢迎新群成员。 | -| `max_image_bytes` | 入站图片下载大小上限。 | +这张卡片的字段见[渠道 schema](/zh-cn/channels/schema/#qq)。 + ## 怎么选 diff --git a/docs/src/content/docs/zh-cn/partners/wecom.md b/docs/src/content/docs/zh-cn/channels/domestic/wecom.md similarity index 84% rename from docs/src/content/docs/zh-cn/partners/wecom.md rename to docs/src/content/docs/zh-cn/channels/domestic/wecom.md index 2b87f5a47..4f57e9ed7 100644 --- a/docs/src/content/docs/zh-cn/partners/wecom.md +++ b/docs/src/content/docs/zh-cn/channels/domestic/wecom.md @@ -6,7 +6,7 @@ quadrant: how-to -`wecom` 用于企业微信 / WeChat Work。它通过企业微信 AI Bot WebSocket 长连接接入,和个人 [WeChat (`weixin`)](/zh-cn/partners/weixin/) 不同。 +`wecom` 用于企业微信 / WeChat Work。它通过企业微信 AI Bot WebSocket 长连接接入,和个人 [WeChat (`weixin`)](/zh-cn/channels/domestic/weixin/) 不同。 ![WeCom 渠道配置](/screenshots/dev/partners-channel-wecom.png) @@ -45,14 +45,8 @@ WeCom channel card 可以通过扫码 onboarding 获取并保存 bot 凭据: 打开 **Partners -> 你的 partner -> Channels -> WeCom**,填写: -| 字段 | 说明 | -| --- | --- | -| `enabled` | partner 启动时是否启动该渠道。 | -| `bot_id` | 企业微信 AI Bot 平台里的 Bot ID。 | -| `secret` | 企业微信 Secret,按凭证处理。 | -| `allow_from` | 允许访问的用户 id。空列表拒绝访问;基础 channel policy 支持时,`*` 表示开放。 | -| `welcome_message` | 用户打开会话时发送的可选欢迎语。 | -| `send_progress` / `send_tool_hints` | 是否投递过程 narration 和一行工具调用提示。 | +这张卡片的字段见[渠道 schema](/zh-cn/channels/schema/#wecom)。 + ## 访问控制和可见范围 diff --git a/docs/src/content/docs/zh-cn/partners/weixin.md b/docs/src/content/docs/zh-cn/channels/domestic/weixin.md similarity index 74% rename from docs/src/content/docs/zh-cn/partners/weixin.md rename to docs/src/content/docs/zh-cn/channels/domestic/weixin.md index e9e08ce0a..d67235a86 100644 --- a/docs/src/content/docs/zh-cn/partners/weixin.md +++ b/docs/src/content/docs/zh-cn/channels/domestic/weixin.md @@ -6,7 +6,7 @@ quadrant: how-to -`weixin` channel 用 iLink long-poll API 把 Partner 接到个人微信账号。它和 **WeCom 企业微信** 不一样:普通个人微信看本页,企业微信 / WeChat Work 看 [WeCom](/zh-cn/partners/wecom/)。 +`weixin` channel 用 iLink long-poll API 把 Partner 接到个人微信账号。它和 **WeCom 企业微信** 不一样:普通个人微信看本页,企业微信 / WeChat Work 看 [WeCom](/zh-cn/channels/domestic/wecom/)。 ![WeChat 渠道配置](/screenshots/dev/partners-channel-weixin.png) @@ -26,18 +26,8 @@ pip install "deeptutor[partners]" 打开 **Partners -> 你的 partner -> Channels -> WeChat**。 -| 字段 | 怎么填 | -| --- | --- | -| **Send Progress** | 测试时建议开启。长任务会把过程 narration 发到微信。 | -| **Send Tool Hints** | 调试时建议开启;如果不想让用户看到一行工具调用,生产环境可关闭。 | -| **Enabled** | 准备登录/启动时再打开。 | -| **Allow From** | 一行一个值。测试可填 `*` 表示开放;上线后换成具体微信用户 id。空列表通常表示拒绝所有人。 | -| **Base Url** | 默认 `https://ilinkai.weixin.qq.com`,一般不用改。 | -| **Cdn Base Url** | 默认 `https://novac2c.cdn.weixin.qq.com/c2c`,用于媒体上传/下载。 | -| **Route Tag** | 可选腾讯路由标签。没有特殊部署要求就留空。 | -| **Token** | 可选 bot token。扫码登录时留空;扫码成功后 channel 会保存 token。 | -| **State Dir** | 可选状态目录。留空时使用 `data/partners//channels/weixin/` 存 `account.json`。 | -| **Poll Timeout** | long-poll 超时时间,单位秒。默认 `35`,多数网络可用。 | +这张卡片的字段见[渠道 schema](/zh-cn/channels/schema/#weixin)。 + ## 登录流程 diff --git a/docs/src/content/docs/zh-cn/channels/index.md b/docs/src/content/docs/zh-cn/channels/index.md new file mode 100644 index 000000000..6867533f0 --- /dev/null +++ b/docs/src/content/docs/zh-cn/channels/index.md @@ -0,0 +1,28 @@ +--- +title: 创建一个伙伴 +description: 创建一个伙伴,先在应用里对话,再让一个渠道送出一条回复。 +quadrant: how-to +--- + +伙伴是和[对话](/zh-cn/learning-workspace/chat/)同一套聊天循环上的持久同伴。它有自己的灵魂、资料库和记忆。渠道只是把这个循环送到外部应用。 + +伙伴曾经是单独的 TutorBot 引擎,使用 `deeptutor bot` 命令和 YAML 渠道。那些地址会重定向到这里。现在同伴以限定范围的一轮对话运行,渠道是伙伴界面里的卡片。 + +## 创建一个并送出一条消息 + +1. 打开 **伙伴**,选择 **New partner**。 +2. 填写 **Identity**(名称和默认回复语言)和 **Soul**(角色和语气)。第一条回复使用这个灵魂。 +3. 在 **Mind** 里选一个模型。第一条回复成功之前先不要打开额外工具。 +4. 在 **Library** 里把一个小知识库或技能复制进私人资料库,或绑定一个已有工作区。完成向导。 +5. 打开伙伴的 **Chat** 标签,发一个问题。它按你写的灵魂回答之后,再继续。 +6. 打开 **Channels**,只启用一个渠道并保存。**Allow From** 里填你自己的发送者 id。这次测试保持 **Send Progress** 和 **Send Tool Hints** 打开。 +7. 从那个应用发一条消息。回复应该出现在伙伴 Chat 标签里的同一条线程中。 + +卡片上的字段名在[渠道 schema](/zh-cn/channels/schema/)。在[国内 IM](/zh-cn/channels/domestic/)或[海外 IM](/zh-cn/channels/international/)里选择应用。 + +你创建的伙伴归你所有。管理员可以把一个伙伴分配给其他人;他们可以对话,看不到凭据。每个人有自己的会话和关系记忆。 + +## 另见 + +- [我的智能体](/zh-cn/customize/agents/) — 从普通对话里咨询一个伙伴 +- [记忆](/zh-cn/learning-workspace/memory/) — 伙伴能读和能写的范围 diff --git a/docs/src/content/docs/zh-cn/partners/discord.md b/docs/src/content/docs/zh-cn/channels/international/discord.md similarity index 71% rename from docs/src/content/docs/zh-cn/partners/discord.md rename to docs/src/content/docs/zh-cn/channels/international/discord.md index 68f403974..337a5c60e 100644 --- a/docs/src/content/docs/zh-cn/partners/discord.md +++ b/docs/src/content/docs/zh-cn/channels/international/discord.md @@ -36,17 +36,8 @@ pip install "deeptutor[partners]" 打开 **Partners -> 你的 partner -> Channels -> Discord**。 -| 字段 | 怎么填 | -| --- | --- | -| **Streaming** | 默认关闭。打开后回复实时流式输出:文本一边生成,一边原地编辑消息。依赖 **Send Progress**:narration 轮次也会随生成实时流出。 | -| **Send Progress** | 测试时建议开启。长任务会实时投递过程 narration。 | -| **Send Tool Hints** | 调试时建议开启;不想让用户看到一行工具调用就关掉。 | -| **Enabled** | 准备启动 channel 时再打开。 | -| **Token** | Developer Portal 里的 bot token(**Bot** -> **Reset Token**)。按密钥存储,保存后会打码显示。 | -| **Allow From** | 一行一个值。开放测试 bot 可填 `*`,正式用填 Discord 用户 id(开 Developer Mode 后右键 -> Copy User ID)。空列表拒绝所有人。 | -| **Gateway Url** | 默认 `wss://gateway.discord.gg/?v=10&encoding=json`。除非你要代理 gateway,否则别改。 | -| **Intents** | Gateway intent 位字段。默认 `37377` 覆盖 Guilds、Guild Messages、Direct Messages 和 Message Content。这个数字里包含的特权 intent,必须同时在 Developer Portal 里启用。 | -| **Group Policy** | `mention`(默认):服务器频道里只有被 @ 时才答。`open`:能读到的频道里每条消息都答。私聊永远会回复。 | +这张卡片的字段见[渠道 schema](/zh-cn/channels/schema/#discord)。 + 超过 Discord 2000 字符上限的回复会自动拆成多条消息。 @@ -87,6 +78,6 @@ pip install "deeptutor[partners]" ## 相关页面 -- [Channel Matrix](/zh-cn/partners/channels/) —— 所有 channel 一览 -- [Telegram](/zh-cn/partners/telegram/) —— 更简单的 polling 模型,同一个流式开关 -- [Slack](/zh-cn/partners/slack/) —— 类似的开发者后台配置体验,走 Socket Mode +- [Channel Matrix](/zh-cn/channels/schema/) —— 所有 channel 一览 +- [Telegram](/zh-cn/channels/international/telegram/) —— 更简单的 polling 模型,同一个流式开关 +- [Slack](/zh-cn/channels/international/slack/) —— 类似的开发者后台配置体验,走 Socket Mode diff --git a/docs/src/content/docs/zh-cn/partners/email.md b/docs/src/content/docs/zh-cn/channels/international/email.md similarity index 64% rename from docs/src/content/docs/zh-cn/partners/email.md rename to docs/src/content/docs/zh-cn/channels/international/email.md index 44d6c9910..bf60fa086 100644 --- a/docs/src/content/docs/zh-cn/partners/email.md +++ b/docs/src/content/docs/zh-cn/channels/international/email.md @@ -35,31 +35,8 @@ Partner 需要一个自己的邮箱,开通 IMAP 和 SMTP。不要复用个人 打开 **Partners -> 你的 partner -> Channels -> Email**。 -| 字段 | 怎么填 | -| --- | --- | -| **Send Progress** | 每条过程更新都是一封单独的邮件。第一次测试可以开;多数部署会关掉,免得邮箱被刷屏。 | -| **Send Tool Hints** | 同样的问题——一条 hint 一封邮件。调试之外建议关闭。 | -| **Enabled** | 准备开始轮询时再打开。 | -| **Consent Granted** | 硬性隐私闸门。没打开之前 channel 拒绝读写任何邮件。务必在邮箱所有者明确同意让 DeepTutor 处理收件箱之后再开。 | -| **Imap Host** | 如 `imap.gmail.com`。 | -| **Imap Port** | 默认 `993`(IMAP over SSL)。 | -| **Imap Username** | 通常是完整邮箱地址,如 `tutor@example.com`。 | -| **Imap Password** | App Password(Gmail/Outlook 开 2FA 时)或账号密码(自建服务)。以 secret 方式存储。 | -| **Imap Mailbox** | 默认 `INBOX`。有些服务商的文件夹名拼法不一样——轮询收不到邮件时去 webmail 里确认一下。 | -| **Imap Use Ssl** | 端口 993 时保持开启。 | -| **Smtp Host** | 如 `smtp.gmail.com`。 | -| **Smtp Port** | 默认 `587`(STARTTLS)。配合 **Smtp Use Ssl** 时用 `465`。 | -| **Smtp Username** | 通常和 Imap Username 一样。 | -| **Smtp Password** | 通常是同一个 App Password。以 secret 方式存储。 | -| **Smtp Use Tls** | 端口 587 上的 STARTTLS。除非换用下面的隐式 SSL,否则保持开启。 | -| **Smtp Use Ssl** | 隐式 SSL,一般配端口 465。两个 TLS 选项二选一,不要同时开。 | -| **From Address** | 可选。留空时回退到 Smtp Username,再回退到 Imap Username。 | -| **Auto Reply Enabled** | 关闭后 Partner 不再自动回复入站邮件(主动发送不受影响)。测试时可以当刹车用。 | -| **Poll Interval Seconds** | 默认 `30`。检查收件箱的频率;小于 5 的值会被钳到 5。 | -| **Mark Seen** | 把处理过的邮件标为已读——这是最主要的去重保护。保持开启。 | -| **Max Body Chars** | 默认 `12000`。超长正文会在进入 Partner 之前被截断。 | -| **Subject Prefix** | 默认 `Re: `。回信主题会加上这个前缀,除非原主题已经以 `Re:` 开头。 | -| **Allow From** | 一行一个邮箱地址,全小写。测试可填 `*` 表示开放。空列表拒绝所有人。 | +这张卡片的字段见[渠道 schema](/zh-cn/channels/schema/#email)。 + 每个不同的发件人地址是一个独立 session;回信带 `In-Reply-To` header,在对方的邮件客户端里能正确归到同一个会话线程。 diff --git a/docs/src/content/docs/zh-cn/channels/international/index.md b/docs/src/content/docs/zh-cn/channels/international/index.md new file mode 100644 index 000000000..0771166b4 --- /dev/null +++ b/docs/src/content/docs/zh-cn/channels/international/index.md @@ -0,0 +1,21 @@ +--- +title: 海外 IM +description: 内置的海外渠道和异步渠道各自适合什么样的伙伴。 +quadrant: explanation +--- + +这些渠道把同一个伙伴送到国内那一组之外。邮件放在这里,是因为它是异步收件箱,不是某个地区的即时通讯。 + +| 渠道 | 连接 | 适合 | +| --- | --- | --- | +| [Telegram](/zh-cn/channels/international/telegram/) | Bot API 长轮询 | 最短的配置:一个 BotFather token,不需要公网地址 | +| [Discord](/zh-cn/channels/international/discord/) | Gateway WebSocket | Discord 服务器或私信 | +| [Slack](/zh-cn/channels/international/slack/) | Socket Mode | Slack 工作区,包括线程 | +| [Microsoft Teams](/zh-cn/channels/international/msteams/) | Bot Framework webhook | Teams,需要一个公网消息端点 | +| [WhatsApp](/zh-cn/channels/international/whatsapp/) | 外部 bridge | 通过那个 bridge 运行时接入 WhatsApp | +| [Matrix](/zh-cn/channels/international/matrix/) | 对 homeserver 做 sync | 你选定的 homeserver 上的房间,加密可选 | +| [Zulip](/zh-cn/channels/international/zulip/) | 事件队列 | 按 stream 和 topic 组织的会话 | +| [Mattermost](/zh-cn/channels/international/mattermost/) | 原生 v4 WebSocket | 你自己托管的 Mattermost | +| [邮件](/zh-cn/channels/international/email/) | IMAP 轮询和 SMTP 回信 | 可以接受延迟回复的收件箱 | + +共用开关和每张卡片的字段在[渠道 schema](/zh-cn/channels/schema/)。 diff --git a/docs/src/content/docs/zh-cn/partners/matrix.md b/docs/src/content/docs/zh-cn/channels/international/matrix.md similarity index 72% rename from docs/src/content/docs/zh-cn/partners/matrix.md rename to docs/src/content/docs/zh-cn/channels/international/matrix.md index 1900bf138..300b79aca 100644 --- a/docs/src/content/docs/zh-cn/partners/matrix.md +++ b/docs/src/content/docs/zh-cn/channels/international/matrix.md @@ -59,22 +59,8 @@ curl -X POST https://matrix.org/_matrix/client/r0/login \ 打开 **Partners -> 你的 partner -> Channels -> Matrix**。 -| 字段 | 怎么填 | -| --- | --- | -| **Send Progress** | 测试时建议开启。长任务会把过程 narration 发到房间里。 | -| **Send Tool Hints** | 调试时建议开启;不想让用户看到一行工具调用就关掉。 | -| **Enabled** | 准备启动 channel 时再打开。 | -| **Homeserver** | 默认 `https://matrix.org`。自建就填自己服务器的 URL。 | -| **Access Token** | 从 Element 或 login API 拿到的 token。以 secret 方式存储。 | -| **User Id** | bot 的完整 Matrix id,如 `@my-bot:matrix.org`。也用于识别 @ 提及。 | -| **Device Id** | 可选但建议填:随便选一个稳定的字符串并保持不变。留空的话,重启可能会重放最近的消息。 | -| **E2Ee Enabled** | 装好 `[matrix-e2e]` extra 和 libolm 之后再打开。没装的话 bot 解不开加密房间。 | -| **Sync Stop Grace Seconds** | 默认 `2`。关停时给进行中的 sync 多少秒收尾。基本不用改。 | -| **Max Media Bytes** | 默认 `20971520`(20 MB)。附件上传/下载的大小上限。 | -| **Allow From** | 一行一个 Matrix user id,如 `@frank:matrix.org`。测试可填 `*` 表示开放。空列表拒绝所有人——包括房间邀请。 | -| **Group Policy** | 多人房间的策略:`open`(默认)回复所有消息,`mention` 只在 bot 被 @ 时回复,`allowlist` 只回复下面列出的房间。1:1 直聊总是会回复。 | -| **Group Allow From** | 房间 id(`!abc123:matrix.org`),一行一个。只在 `allowlist` 策略下生效。 | -| **Allow Room Mentions** | 在 `mention` 策略下,`@room` 群发提醒算不算提及 bot。默认关闭。 | +这张卡片的字段见[渠道 schema](/zh-cn/channels/schema/#matrix)。 + ## 保存之后 diff --git a/docs/src/content/docs/zh-cn/partners/mattermost.md b/docs/src/content/docs/zh-cn/channels/international/mattermost.md similarity index 75% rename from docs/src/content/docs/zh-cn/partners/mattermost.md rename to docs/src/content/docs/zh-cn/channels/international/mattermost.md index be93bdabe..db6729be8 100644 --- a/docs/src/content/docs/zh-cn/partners/mattermost.md +++ b/docs/src/content/docs/zh-cn/channels/international/mattermost.md @@ -36,17 +36,8 @@ pip install "deeptutor[partners]" 打开 **Partners -> 你的 partner -> Channels -> Mattermost**。 -| 字段 | 怎么填 | -| --- | --- | -| **Send Progress** | 测试时建议开启。长任务会实时投递过程 narration。 | -| **Send Tool Hints** | 调试时建议开启;不想让用户看到一行工具调用就关掉。 | -| **Enabled** | 准备启动 channel 时再打开。 | -| **Server Url** | 你的 Mattermost 基础 URL,例如 `https://mattermost.example.com`。scheme 可省略(默认 `https`),WebSocket URL 会自动推导出来 —— 不要在后面加 `/api/v4`。 | -| **Bot Token** | **Integrations -> Bot Accounts** 里 bot 账号的 access token。按密钥存储,保存后会打码显示。 | -| **Allow From** | 一行一个值。开放测试 bot 可填 `*`,正式用填 Mattermost user id。空列表拒绝所有人。 | -| **Group Policy** | `mention`(默认):频道里只有被 @ 时才答。`open`:已加入的频道里每条消息都答。私聊永远会回复。 | -| **Reply In Thread** | 开(默认):bot 在以触发 post 为根的线程里回复。线程后续消息仍会先经过 **Group Policy**;默认 `mention` 策略下,每条后续消息都要 @ bot。关:回复直接发到频道。 | -| **Verify Ssl** | 开(默认)。仅当自托管服务器用的是自签名证书或内部 CA 签发的证书时才关掉。 | +这张卡片的字段见[渠道 schema](/zh-cn/channels/schema/#mattermost)。 + 超过 Mattermost 单条上限(约 16k 字符)的回复会自动拆成多条消息;支持最大 50 MB 的文件附件。 @@ -87,6 +78,6 @@ channel 在连接前会调用 `/api/v4/users/me` 校验 **Bot Token**,所以 ## 相关页面 -- [Channel Matrix](/zh-cn/partners/channels/) —— 所有 channel 一览 -- [Slack](/zh-cn/partners/slack/) —— Mattermost 原生 API 所替代的团队聊天 channel -- [Discord](/zh-cn/partners/discord/) —— 同样的直连 WebSocket + REST 传输 +- [Channel Matrix](/zh-cn/channels/schema/) —— 所有 channel 一览 +- [Slack](/zh-cn/channels/international/slack/) —— Mattermost 原生 API 所替代的团队聊天 channel +- [Discord](/zh-cn/channels/international/discord/) —— 同样的直连 WebSocket + REST 传输 diff --git a/docs/src/content/docs/zh-cn/partners/msteams.md b/docs/src/content/docs/zh-cn/channels/international/msteams.md similarity index 66% rename from docs/src/content/docs/zh-cn/partners/msteams.md rename to docs/src/content/docs/zh-cn/channels/international/msteams.md index bee39cd21..4b4fb0516 100644 --- a/docs/src/content/docs/zh-cn/partners/msteams.md +++ b/docs/src/content/docs/zh-cn/channels/international/msteams.md @@ -39,26 +39,8 @@ pip install "deeptutor[partners]" 打开 **Partners -> 你的 partner -> Channels -> Microsoft Teams**。 -| 字段 | 怎么填 | -| --- | --- | -| **Send Progress** | 测试时建议开启。长任务会把过程 narration 实时发过来。 | -| **Send Tool Hints** | 调试时建议开启;不想让用户看到一行工具调用就关掉。 | -| **Enabled** | 准备启动 channel 时再打开。 | -| **App Id** | App registration 的 Application (client) ID。同时也是校验入站 JWT 时要求的 audience。 | -| **App Password** | client secret 的 Value。按 secret 存储,保存后会打码。 | -| **Tenant Id** | Directory (tenant) ID。单租户注册必填;只有多租户 bot 才能留空。 | -| **Host** | 内置 HTTP 服务器的监听地址。默认 `0.0.0.0` 监听所有网卡;如果只有本机的反向代理来访问,可以收紧到 `127.0.0.1`。 | -| **Port** | 监听端口。默认 `3978`,Bot Framework 的惯例端口。同一主机上所有已启用的 Teams Partners 必须各用一个不同端口。 | -| **Path** | 接收消息的 URL 路径。默认 `/api/messages`,必须和 messaging endpoint 的结尾一致。 | -| **Allow From** | 一行一个值。测试可填 `*`;正式用换成 Microsoft Entra object id——被拒的 sender id 会打在 partner 日志里。空列表会拒绝所有人。 | -| **Reply In Thread** | 开启(默认)时,回复会挂在触发它的那条消息下面,而不是另起一条。 | -| **Mention Only Response** | 消息里除了 @ 机器人什么都没有时,机器人回的那句话。 | -| **Validate Inbound Auth** | 保持开启。每个入站请求都校验 Bot Framework JWT(用微软公开的密钥做 RS256 验签,audience 必须等于 App Id)。关掉它意味着任何拿到 URL 的人都能冒充任意用户跟 partner 说话——只限本地测试。 | -| **Ref Ttl Days** | 闲置的 conversation reference 保留多少天后清理。默认 `30`。 | -| **Prune Web Chat Refs** | 把 Bot Framework Web Chat 的会话从存储里剔除(Web Chat 不支持)。 | -| **Prune Non Personal Refs** | 把群聊/频道的会话 reference 剔除;channel 目前只做私聊。 | -| **Ref Touch Interval S** | 活跃会话 reference 的时间戳刷新最小间隔(秒)。默认 `300`。 | -| **Trusted Service Url Hosts** | 接受并回复的 Bot Framework 服务域名白名单。默认覆盖公有云和 GCC/DoD 政务云——除非微软把你路由去了别处,否则不用动。 | +这张卡片的字段见[渠道 schema](/zh-cn/channels/schema/#msteams)。 + ## 保存之后 @@ -94,5 +76,5 @@ messaging endpoint 不可达。确认 endpoint URL 以你配置的 **Path** 结 ## 相关页面 -- [Channel Matrix](/zh-cn/partners/channels/) — 所有 channel 一览 -- [WeCom](/zh-cn/partners/wecom/) — 企业微信接入,另一种企业 IM 路线 +- [Channel Matrix](/zh-cn/channels/schema/) — 所有 channel 一览 +- [WeCom](/zh-cn/channels/domestic/wecom/) — 企业微信接入,另一种企业 IM 路线 diff --git a/docs/src/content/docs/zh-cn/partners/slack.md b/docs/src/content/docs/zh-cn/channels/international/slack.md similarity index 69% rename from docs/src/content/docs/zh-cn/partners/slack.md rename to docs/src/content/docs/zh-cn/channels/international/slack.md index cb238e6f6..1c56f32ca 100644 --- a/docs/src/content/docs/zh-cn/partners/slack.md +++ b/docs/src/content/docs/zh-cn/channels/international/slack.md @@ -36,22 +36,8 @@ pip install "deeptutor[partners]" 打开 **Partners -> 你的 partner -> Channels -> Slack**。 -| 字段 | 怎么填 | -| --- | --- | -| **Send Progress** | 测试时建议开启。长任务会实时投递过程 narration。 | -| **Send Tool Hints** | 调试时建议开启;不想让用户看到一行工具调用就关掉。 | -| **Enabled** | 准备启动 channel 时再打开。 | -| **Mode** | 目前只支持 `socket`,保持不动。 | -| **Webhook Path** | 为将来的 webhook 模式预留;**Mode** 是 `socket` 时用不上。留默认 `/slack/events` 即可。 | -| **Bot Token** | **OAuth & Permissions** 里的 `xoxb-…` token。按密钥存储,保存后会打码显示。 | -| **App Token** | **Socket Mode** 里的 `xapp-…` App-Level Token(需要 `connections:write`)。同样是密钥。别和 Bot Token 填反了。 | -| **User Token Read Only** | 保持默认(开)。 | -| **Reply In Thread** | 开(默认):bot 在触发消息下面的线程里回答。线程内的后续消息仍会先经过 **Group Policy**;默认 `mention` 策略下,每条后续消息都要 @ bot。关:回复直接发进频道。 | -| **React Emoji** | bot 加在你消息上、表示"收到"的 emoji 名(不带冒号)。默认 `eyes`。 | -| **Allow From** | 一行一个值。开放测试 bot 可填 `*`,正式用填 Slack 用户 id(`U…`)。空列表拒绝所有人。 | -| **Group Policy** | `mention`(默认):频道里只回答 @ 提及。`open`:所在频道每条消息都答。`allowlist`:只响应 **Group Allow From** 里列出的频道。 | -| **Group Allow From** | 频道 id(`C…`),一行一个。**Group Policy** 是 `allowlist` 时生效。 | -| **Dm** | DM 子策略:**Enabled** 整体开关 DM;**Policy** 取 `open` 时任何 DM 都答,取 `allowlist` 时只放行它自己那份 **Allow From** 列表里的 id。 | +这张卡片的字段见[渠道 schema](/zh-cn/channels/schema/#slack)。 + ## 保存之后 @@ -91,5 +77,5 @@ pip install "deeptutor[partners]" ## 相关页面 -- [Channel Matrix](/zh-cn/partners/channels/) —— 所有 channel 一览 -- [Discord](/zh-cn/partners/discord/) —— 类似的开发者后台配置,走 Gateway WebSocket +- [Channel Matrix](/zh-cn/channels/schema/) —— 所有 channel 一览 +- [Discord](/zh-cn/channels/international/discord/) —— 类似的开发者后台配置,走 Gateway WebSocket diff --git a/docs/src/content/docs/zh-cn/partners/telegram.md b/docs/src/content/docs/zh-cn/channels/international/telegram.md similarity index 67% rename from docs/src/content/docs/zh-cn/partners/telegram.md rename to docs/src/content/docs/zh-cn/channels/international/telegram.md index 929a4a117..3cd9c4e61 100644 --- a/docs/src/content/docs/zh-cn/partners/telegram.md +++ b/docs/src/content/docs/zh-cn/channels/international/telegram.md @@ -36,21 +36,8 @@ pip install "deeptutor[partners]" 打开 **Partners -> 你的 partner -> Channels -> Telegram**。 -| 字段 | 怎么填 | -| --- | --- | -| **Streaming** | 默认关闭。打开后回复实时流式输出:文本一边生成,一边原地编辑那条 Telegram 消息。依赖 **Send Progress**:narration 轮次也会随生成实时流出。 | -| **Send Progress** | 测试时建议开启。长任务会实时投递过程 narration。 | -| **Send Tool Hints** | 调试时建议开启;不想让用户看到一行工具调用就关掉。 | -| **Enabled** | 准备启动 channel 时再打开。 | -| **Token** | BotFather 给的 HTTP API token。按密钥存储,保存后会打码显示。 | -| **Allow From** | 一行一个值。开放测试 bot 可填 `*`,正式用填 `@userinfobot` 查到的数字用户 id(username 也能匹配)。空列表拒绝所有人。 | -| **Proxy** | 可选代理 URL,Telegram 不可达的网络环境用,比如 `socks5://127.0.0.1:1080` 或 `http://proxy:8080`。直连就留空。 | -| **Reply To Message** | 打开后,bot 的回答会引用触发它的那条消息。热闹的群里很有用,私聊里就显得多余。 | -| **Group Policy** | 群组的回退策略:`mention`(默认)需 @ 或回复 bot;`open` 每条都答。私聊跳过群策略,但仍受 **Allow From** 限制。 | -| **Chat Policies** | 按 `chat_id` 覆盖:`open`、`mention` 或 `topics_only`。后者在 `allowed_topics` 中自动答,其他话题需 @ 或回复 bot;首个匹配规则生效。 | -| **Connection Pool Size** | Bot API 客户端的 HTTP 连接池大小。单个 bot 用默认 `16` 就够。 | -| **Pool Timeout** | 等待空闲连接的秒数。默认 `15`。 | -| **Stream Edit Interval** | 流式输出时两次原地编辑之间的最小间隔秒数。默认 `0.6`;如果 Telegram 报 flood-control 错误就调大。 | +这张卡片的字段见[渠道 schema](/zh-cn/channels/schema/#telegram)。 + 超过 Telegram 4096 字符上限的回复会自动拆成多条消息(DeepTutor 在 4000 处拆分,留出安全余量)。 @@ -91,5 +78,5 @@ pip install "deeptutor[partners]" ## 相关页面 -- [Channel Matrix](/zh-cn/partners/channels/) —— 所有 channel 一览 -- [Discord](/zh-cn/partners/discord/) —— Gateway WebSocket 模型,同样支持流式输出 +- [Channel Matrix](/zh-cn/channels/schema/) —— 所有 channel 一览 +- [Discord](/zh-cn/channels/international/discord/) —— Gateway WebSocket 模型,同样支持流式输出 diff --git a/docs/src/content/docs/zh-cn/partners/whatsapp.md b/docs/src/content/docs/zh-cn/channels/international/whatsapp.md similarity index 88% rename from docs/src/content/docs/zh-cn/partners/whatsapp.md rename to docs/src/content/docs/zh-cn/channels/international/whatsapp.md index 503113b5b..c7daceab9 100644 --- a/docs/src/content/docs/zh-cn/partners/whatsapp.md +++ b/docs/src/content/docs/zh-cn/channels/international/whatsapp.md @@ -97,14 +97,8 @@ bridge 的 `qr` 事件会显示在 DeepTutor 渠道卡片中(示例 bridge 也 打开 **Partners -> 你的 partner -> Channels -> WhatsApp**。 -| 字段 | 怎么填 | -| --- | --- | -| **Send Progress** | 测试时建议开启。长任务会把过程 narration 发到 WhatsApp。 | -| **Send Tool Hints** | 调试时建议开启;不想让用户看到一行工具调用就关掉。 | -| **Enabled** | bridge 跑起来、准备启动 channel 时再打开。 | -| **Bridge Url** | bridge 的 WebSocket 地址,默认 `ws://localhost:3001`。 | -| **Bridge Token** | 可选共享密钥。只有你的 bridge 校验 `auth` 消息时才需要填。 | -| **Allow From** | 一行一个值。测试可填 `*` 表示开放;上线后换成具体 sender id(WhatsApp id 里 `@` 前面那段,通常是手机号)。空列表拒绝所有人。 | +这张卡片的字段见[渠道 schema](/zh-cn/channels/schema/#whatsapp)。 + ## 配置完成之后 diff --git a/docs/src/content/docs/zh-cn/partners/zulip.md b/docs/src/content/docs/zh-cn/channels/international/zulip.md similarity index 75% rename from docs/src/content/docs/zh-cn/partners/zulip.md rename to docs/src/content/docs/zh-cn/channels/international/zulip.md index fca850e48..de82f5794 100644 --- a/docs/src/content/docs/zh-cn/partners/zulip.md +++ b/docs/src/content/docs/zh-cn/channels/international/zulip.md @@ -34,18 +34,8 @@ pip install "deeptutor[partners]" 打开 **Partners -> 你的 partner -> Channels -> Zulip**。 -| 字段 | 怎么填 | -| --- | --- | -| **Send Progress** | 测试时建议开启。长任务会投递过程 narration。 | -| **Send Tool Hints** | 调试时建议开启;不想让用户看到一行工具调用就关掉。 | -| **Enabled** | 准备启动 channel 时再打开。 | -| **Site** | 你的 Zulip 服务器 URL,比如 `https://yourorg.zulipchat.com`。要带 scheme,realm 子域名要写对。 | -| **Email** | 创建页生成的 bot 邮箱 —— 不是你自己的。 | -| **Api Key** | bot 的 API key。按密钥存储。 | -| **Allow From** | 一行一个 Zulip 用户 id 或邮箱,两种写法都能匹配。开放测试可填 `*`。空列表拒绝所有人。 | -| **Group Policy** | 针对 stream 消息:`mention`(默认)只在 bot 被 @ 时回答,`open` 对已订阅 stream 的每条消息都答。私聊永远会回复。 | -| **Subscribe Streams** | stream 名,一行一个。channel 启动时会替 bot 订阅它们。 | -| **Timeout** | event-queue long-poll 超时秒数。默认 `60` 适用于大多数服务器。 | +这张卡片的字段见[渠道 schema](/zh-cn/channels/schema/#zulip)。 + ## 保存之后 diff --git a/docs/src/content/docs/zh-cn/channels/schema.md b/docs/src/content/docs/zh-cn/channels/schema.md new file mode 100644 index 000000000..0abf8bed4 --- /dev/null +++ b/docs/src/content/docs/zh-cn/channels/schema.md @@ -0,0 +1,404 @@ +--- +title: 渠道矩阵 +description: 所有内置 Partner channels 的连接模型、关键字段和适用场景。 +quadrant: reference +--- + +Partner channels 是同一个 Partner brain 外面的投递适配器。它不会创建第二套 agent runtime:一条 IM 入站事件会变成作用域内的 chat turn,最终回复再通过 channel 发回去。 + +大多数配置建议在 Web UI 完成:**Partners -> 你的 partner -> Channels** 会从 `/api/partners/channels/schema` 渲染实时 schema,自动 mask secret 字段,轮询 `/channels/status`,并允许你 reload channels,而不需要手写 YAML。 + +![伙伴渠道配置](/screenshots/dev/partners-channels.png) + +## 内置渠道 + +| 渠道 | Key | 连接模型 | 适合场景 | 核心字段 | +| --- | --- | --- | --- | --- | +| WeChat | `weixin` | HTTP long-poll + 扫码登录 | 个人微信助手 | `allow_from`;可选 `token`、`state_dir`、`route_tag`、`poll_timeout` | +| WeCom | `wecom` | 企业微信 AI Bot WebSocket | 企业微信 / WeChat Work | `bot_id`、`secret`、`allow_from` | +| QQ | `qq` | 腾讯 botpy WebSocket | 官方 QQ Bot 部署 | `app_id`、`secret`、`allow_from`、`msg_format` | +| QQ (NapCat) | `napcat` | OneBot v11 WebSocket | 通过 NapCat 接个人 QQ | `ws_url`、可选 `access_token`、`allow_from`、`group_policy` | +| Telegram | `telegram` | Bot API polling | 简单个人/群 bot | `token`、`allow_from` | +| Discord | `discord` | Gateway WebSocket | Discord server 和 DM | `token`、`allow_from`、群策略字段 | +| Slack | `slack` | Socket Mode | Slack team、DM、threaded channel help | `bot_token`、`app_token`、`allow_from`、`group_policy` | +| Feishu / Lark | `feishu` | Lark SDK WebSocket | 飞书 / Lark 企业聊天 | `app_id`、`app_secret`,以及 verification/encryption 字段 | +| DingTalk | `dingtalk` | Stream Mode | 钉钉企业聊天 | `client_id`、`client_secret`、`allow_from` | +| Matrix | `matrix` | Matrix sync loop | 去中心化房间,可选 E2EE | `homeserver`、用户凭证或 `access_token`、`allow_from`、`group_policy` | +| Zulip | `zulip` | Event queue | stream + topic 工作流 | `email`、`api_key`、`site`、`allow_from`、`group_policy` | +| Mattermost | `mattermost` | 原生 v4 WebSocket + REST | 自托管开源团队聊天 | `server_url`、`bot_token`、`allow_from`、可选 `group_policy`、`reply_in_thread`、`verify_ssl` | +| WhatsApp | `whatsapp` | Bridge WebSocket | 通过桥接运行时接 WhatsApp | bridge URL/token、`allow_from` | +| Email | `email` | IMAP poll + SMTP send | 异步邮件答疑 / helpdesk | IMAP host/user/password、SMTP host/user/password、`allow_from` | +| Mochat | `mochat` | Socket.IO 或 HTTP polling | 客服式聊天面板 | `base_url` / socket URL、`claw_token`、`allow_from` | +| Microsoft Teams | `msteams` | 内置 HTTP webhook listener | Teams DM-first Bot Framework 集成 | `app_id`、`app_password`、`tenant_id`、host/port/path | + +## 安装依赖 + +除 Matrix 外,所有内置 channel 都包含在 Partners extra 里: + +```bash +python scripts/install_extras.py partners +# 或发布包支持 extras 时: +pip install "deeptutor[partners]" +``` + +这一条命令会装齐全部 channel SDK——`python-telegram-bot`、`slack-sdk`、`lark-oapi`、`dingtalk-stream`、`qq-botpy`、`wecom-aibot-sdk`、`python-socketio` 等(完整清单见 `requirements/partners.txt`)。Email 只用 Python 标准库,不需要额外的包。Matrix 单独成 extra,因为加密房间依赖原生 `libolm` 库:源码中普通房间运行 `python scripts/install_extras.py matrix`,加密房间运行 `python scripts/install_extras.py matrix-e2e`。 + +如果服务器上缺某个 channel 的依赖,Channels 面板会把它置灰并显示 import 错误(如 `No module named 'lark_oapi'`)。已安装卡片会区分 **Connected**、**Connecting**、**Listener running**、**Waiting for scan**、**Configuration required**、**Connection failed** 与 **Not connected**。按提示补依赖或配置,再重启/reload Partner。 + +修改模块或依赖前先停止 DeepTutor。从源码仓库根目录运行安装助手,用同一个数据目录重启,再检查 `deeptutor module list` 与 Channels 状态。wheel 环境使用对应版本支持的 extras,不要在源码安装上叠加功能 wheel。 + +## 共享投递开关 + +大多数 channels 都继承同一组 delivery controls: + +| 字段 | 含义 | +| --- | --- | +| `enabled` | Partner 是否启动这个 channel。 | +| `send_progress` | 长 turn 期间是否投递 narration/progress。 | +| `send_tool_hints` | 是否投递一行工具调用提示。调试时有用,生产环境可能太吵。 | +| `streaming` | 仅 Telegram、Discord、Feishu:回复实时流式输出,靠原地编辑消息逐步长出(Feishu 走 CardKit 流式卡片)。需要 `send_progress` 开启。默认关闭。 | +| `allow_from` | 用户/会话 allowlist。`*` 适合测试;部署时更建议明确 id。 | + +## 配置流程 + +1. 先在 Web UI 创建并测试 Partner,不要一开始就开 IM channel。 +2. 第一次只启用一个 channel。 +3. 调试阶段保持 `send_progress` 和 `send_tool_hints` 开启。 +4. `allow_from: ["*"]` 只用于本地/私有测试。 +5. 先确认实时卡片进入 connected/listening 状态,再发一条短消息并把 `*` 换成真实 sender ids;只有状态详情不够时才查日志。 +6. 第一个 channel 稳定后,再添加其它 channels。 + +## 怎么选 + +- 个人微信用 **WeChat**,需要人工扫码和持久化 state。 +- 企业/团队部署用 **WeCom**、**Feishu**、**DingTalk**、**Slack** 或 **Teams**。 +- 官方 QQ Bot 用 **QQ**;只有在明确操作个人 QQ bridge 时才用 **NapCat**。 +- 异步 inbox 工作流用 **Email**。 +- 需要 room/topic 结构时,用 **Matrix** 或 **Zulip**。 +- 想要自己运维的自托管开源团队聊天,用 **Mattermost**。 + +## 状态存在哪里 + +Channel state 存在 Partner 的 `channels/` 目录下,例如: + +```text +data/partners//channels/weixin/account.json +data/partners//channels/msteams/msteams_conversations.json +``` + +Docker 或生产部署要持久化整个 `data/partners/`。丢失 channel state 可能导致重新扫码,或重新收集 conversation reference。 + +## 详细页面 + +每个内置 channel 都有专属配置页:平台侧申请步骤、对着截图逐字段讲解 channel card、配完后的验证流程和故障排查: + +- [WeChat](/zh-cn/channels/domestic/weixin/) —— 个人微信扫码登录和 long-poll 配置 +- [WeCom](/zh-cn/channels/domestic/wecom/) —— 企业微信 AI Bot 配置 +- [QQ / NapCat](/zh-cn/channels/domestic/qq/) —— 官方 QQ bot 和个人 QQ bridge 两条路径 +- [Telegram](/zh-cn/channels/international/telegram/) —— BotFather 注册、Bot API 轮询、流式回复 +- [Discord](/zh-cn/channels/international/discord/) —— Developer Portal 应用、intents、Gateway WebSocket +- [Slack](/zh-cn/channels/international/slack/) —— Socket Mode 应用(bot + app 双 token) +- [Feishu / Lark](/zh-cn/channels/domestic/feishu/) —— 开放平台应用和 CardKit 流式卡片 +- [DingTalk](/zh-cn/channels/domestic/dingtalk/) —— Stream Mode 企业机器人 +- [Matrix](/zh-cn/channels/international/matrix/) —— homeserver 凭证和可选 E2EE +- [Zulip](/zh-cn/channels/international/zulip/) —— bot 账号和 stream 订阅 +- [Mattermost](/zh-cn/channels/international/mattermost/) —— 自托管服务器,bot token 走原生 v4 API +- [WhatsApp](/zh-cn/channels/international/whatsapp/) —— bridge 运行时配置 +- [Email](/zh-cn/channels/international/email/) —— IMAP 收件轮询和 SMTP 回信 +- [Mochat](/zh-cn/channels/domestic/mochat/) —— Socket.IO 客服面板 +- [Microsoft Teams](/zh-cn/channels/international/msteams/) —— Bot Framework webhook 监听 + +## 各渠道字段 + +下面是每张渠道卡片上的字段。卡片由 `GET /api/v1/partners/channels/schema` 渲染。共用开关仍在上面的矩阵里。 + + + +### DingTalk(钉钉) + +| 字段 | 怎么填 | +| --- | --- | +| **Send Progress** | 测试时建议开启。长任务会把过程 narration 实时发过来。 | +| **Send Tool Hints** | 调试时建议开启;不想让用户看到一行工具调用就关掉。 | +| **Enabled** | 准备启动 channel 时再打开。 | +| **Client Id** | 凭证与基础信息页的 AppKey(一般 `ding...` 开头)。 | +| **Client Secret** | 同页的 AppSecret。按 secret 存储,保存后会打码。 | +| **Allow From** | 一行一个值。测试可填 `*` 表示开放;正式用换成钉钉 staff id(每条入站消息的 sender id 都会打在 partner 日志里)。空列表会拒绝所有人。 | + + +### Feishu(飞书) + +| 字段 | 怎么填 | +| --- | --- | +| **Streaming** | 默认关闭。打开后回复用 CardKit 流式卡片实时打字渲染。依赖 **Send Progress**:过程 narration 也会逐轮流式输出。 | +| **Send Progress** | 测试时建议开启。长任务会把过程 narration 实时发过来。 | +| **Send Tool Hints** | 调试时建议开启;不想让用户看到一行工具调用就关掉。 | +| **Enabled** | 准备启动 channel 时再打开。 | +| **App Id** | 凭证与基础信息页的 App ID,`cli_...` 开头。 | +| **App Secret** | 同页的 App Secret。按 secret 存储,保存后会打码。 | +| **Domain** | 国内飞书应用用默认的 `feishu`;国际版 Lark tenant 要选 `lark`,这样 SDK 才会使用 `open.larksuite.com`。扫码流程会自动填写。 | +| **Encrypt Key** | 只有在平台开启了事件加密时才需要填,否则留空。 | +| **Verification Token** | 平台的事件 Verification Token,用于事件签名校验。没配置就留空。 | +| **Allow From** | 一行一个值。测试可填 `*` 表示开放;正式用换成 `ou_...` open id(发一条消息后从 partner 日志里抄)。空列表会拒绝所有人。 | +| **React Emoji** | 机器人收到消息后立刻回应的表情,相当于"已读"确认。默认 `THUMBSUP`;常用的还有 `OK`、`EYES`、`DONE`、`OnIt`、`HEART`。 | +| **Group Policy** | `mention`(默认):群里只有被 @ 才回答。`open`:群里每条消息都回答。私聊永远会回复。 | +| **Reply In Thread** | 默认开启。群回复留在触发消息的话题里。单聊始终是普通回复。 | +| **Thinking Notice** | 默认开启。模型思考时发一条短暂提示,回答开始后删掉。 | +| **Stream Print Frequency Ms** | CardKit 打字机间隔,单位毫秒。默认 `30`。`0` 使用平台默认值。 | +| **Stream Print Step** | 每一步打出的字符数。默认 `6`。`0` 使用平台默认值。 | +| **Stream Print Strategy** | `fast`(默认)或 `delay`。 | + + +### Mochat + +| 字段 | 怎么填 | +| --- | --- | +| **Send Progress** | 测试时建议开启。长任务会把过程 narration 发出去。 | +| **Send Tool Hints** | 调试时建议开启;不想让用户看到一行工具调用就关掉。 | +| **Enabled** | 准备启动 channel 时再打开。 | +| **Base Url** | 你的 Mochat 实例。默认 `https://mochat.io`。 | +| **Socket Url** | 可选的独立 Socket.IO endpoint。留空表示用 **Base Url**。 | +| **Socket Path** | Socket.IO 挂载路径。默认 `/socket.io`。 | +| **Socket Disable Msgpack** | 默认关闭(可用时优先 msgpack)。服务端没有 msgpack parser 时打开,强制走 JSON。 | +| **Socket Reconnect Delay Ms** | 初始重连延迟。默认 `1000`。 | +| **Socket Max Reconnect Delay Ms** | 重连退避上限。默认 `10000`。 | +| **Socket Connect Timeout Ms** | 连接超时。默认 `10000`。 | +| **Refresh Interval Ms** | channel 刷新 session/panel 目录的频率。默认 `30000`。 | +| **Watch Timeout Ms** | HTTP 回退模式下的 long-poll 超时。默认 `25000`。 | +| **Claw Token** | 必填。Mochat 管理后台拿到的 bot token。 | +| **Sessions** | 要监听的 session id,一行一个。`*` 表示自动发现并订阅新 session。 | +| **Panels** | 要监听的 panel id,一行一个。`*` 表示自动发现 panel。两个列表都留空时 channel 什么都不监听。 | +| **Allow From** | 一行一个值。测试可填 `*` 表示开放,或填具体的 Mochat user id。空列表拒绝访问。 | + +| 字段 | 怎么填 | +| --- | --- | +| **Watch Limit** | 单次 poll 最多拉取的事件数。默认 `100`。 | +| **Retry Delay Ms** | HTTP 重试失败之间的延迟。默认 `500`。 | +| **Max Retry Attempts** | Socket.IO 重连次数上限。`0` 表示一直重连;这个字段不会限制 HTTP fallback loop。 | +| **Agent User Id** | bot 自己的 Mochat user id。用于忽略 bot 自己的消息和识别 @ 提及。 | +| **Mention** | `require_in_groups` —— 群 session 里必须被 @ 才回复。 | +| **Groups** | 按 group id 的逐群覆盖:`{"": {"require_mention": true}}`。 | +| **Reply Delay Mode** | `non-mention`(默认)会缓冲没有提及 bot 的 panel 消息;填其他值则关闭缓冲。 | +| **Reply Delay Ms** | 缓冲窗口。默认 `120000`(2 分钟)。 | + + +### QQ / NapCat + +| 字段 | 说明 | +| --- | --- | +| `enabled` | 是否随 partner 启动该渠道。 | +| `app_id` | 腾讯 bot 平台里的 App ID。 | +| `secret` | Bot secret。 | +| `allow_from` | 允许访问的 QQ user ids / openids。空列表拒绝访问;生产环境建议明确 id。 | +| `msg_format` | `plain` 或 `markdown`。不同 QQ 客户端 Markdown 表现不一,不确定时先用 `plain`。 | + + + +| 字段 | 说明 | +| --- | --- | +| `enabled` | 是否随 partner 启动该渠道。 | +| `ws_url` | NapCat WebSocket endpoint,默认 `ws://127.0.0.1:3001`。 | +| `access_token` | 可选 OneBot access token。 | +| `allow_from` | 允许访问的用户 id。`*` 只建议本地测试使用。 | +| `group_policy` | `mention`、`open`,或 `0` 到 `1` 的概率。被 @ 或回复时总会响应。 | +| `group_policy_overrides` | 按群 id 覆盖 group policy 的 map。 | +| `welcome_new_members` | 是否欢迎新群成员。 | +| `max_image_bytes` | 入站图片下载大小上限。 | + + +### WeCom(企业微信) + +| 字段 | 说明 | +| --- | --- | +| `enabled` | partner 启动时是否启动该渠道。 | +| `bot_id` | 企业微信 AI Bot 平台里的 Bot ID。 | +| `secret` | 企业微信 Secret,按凭证处理。 | +| `allow_from` | 允许访问的用户 id。空列表拒绝访问;基础 channel policy 支持时,`*` 表示开放。 | +| `welcome_message` | 用户打开会话时发送的可选欢迎语。 | +| `send_progress` / `send_tool_hints` | 是否投递过程 narration 和一行工具调用提示。 | + + +### WeChat(个人微信) + +| 字段 | 怎么填 | +| --- | --- | +| **Send Progress** | 测试时建议开启。长任务会把过程 narration 发到微信。 | +| **Send Tool Hints** | 调试时建议开启;如果不想让用户看到一行工具调用,生产环境可关闭。 | +| **Enabled** | 准备登录/启动时再打开。 | +| **Allow From** | 一行一个值。测试可填 `*` 表示开放;上线后换成具体微信用户 id。空列表通常表示拒绝所有人。 | +| **Base Url** | 默认 `https://ilinkai.weixin.qq.com`,一般不用改。 | +| **Cdn Base Url** | 默认 `https://novac2c.cdn.weixin.qq.com/c2c`,用于媒体上传/下载。 | +| **Route Tag** | 可选腾讯路由标签。没有特殊部署要求就留空。 | +| **Token** | 可选 bot token。扫码登录时留空;扫码成功后 channel 会保存 token。 | +| **State Dir** | 可选状态目录。留空时使用 `data/partners//channels/weixin/` 存 `account.json`。 | +| **Poll Timeout** | long-poll 超时时间,单位秒。默认 `35`,多数网络可用。 | + + +### Discord + +| 字段 | 怎么填 | +| --- | --- | +| **Streaming** | 默认关闭。打开后回复实时流式输出:文本一边生成,一边原地编辑消息。依赖 **Send Progress**:narration 轮次也会随生成实时流出。 | +| **Send Progress** | 测试时建议开启。长任务会实时投递过程 narration。 | +| **Send Tool Hints** | 调试时建议开启;不想让用户看到一行工具调用就关掉。 | +| **Enabled** | 准备启动 channel 时再打开。 | +| **Token** | Developer Portal 里的 bot token(**Bot** -> **Reset Token**)。按密钥存储,保存后会打码显示。 | +| **Allow From** | 一行一个值。开放测试 bot 可填 `*`,正式用填 Discord 用户 id(开 Developer Mode 后右键 -> Copy User ID)。空列表拒绝所有人。 | +| **Gateway Url** | 默认 `wss://gateway.discord.gg/?v=10&encoding=json`。除非你要代理 gateway,否则别改。 | +| **Intents** | Gateway intent 位字段。默认 `37377` 覆盖 Guilds、Guild Messages、Direct Messages 和 Message Content。这个数字里包含的特权 intent,必须同时在 Developer Portal 里启用。 | +| **Group Policy** | `mention`(默认):服务器频道里只有被 @ 时才答。`open`:能读到的频道里每条消息都答。私聊永远会回复。 | + + +### Email + +| 字段 | 怎么填 | +| --- | --- | +| **Send Progress** | 每条过程更新都是一封单独的邮件。第一次测试可以开;多数部署会关掉,免得邮箱被刷屏。 | +| **Send Tool Hints** | 同样的问题——一条 hint 一封邮件。调试之外建议关闭。 | +| **Enabled** | 准备开始轮询时再打开。 | +| **Consent Granted** | 硬性隐私闸门。没打开之前 channel 拒绝读写任何邮件。务必在邮箱所有者明确同意让 DeepTutor 处理收件箱之后再开。 | +| **Imap Host** | 如 `imap.gmail.com`。 | +| **Imap Port** | 默认 `993`(IMAP over SSL)。 | +| **Imap Username** | 通常是完整邮箱地址,如 `tutor@example.com`。 | +| **Imap Password** | App Password(Gmail/Outlook 开 2FA 时)或账号密码(自建服务)。以 secret 方式存储。 | +| **Imap Mailbox** | 默认 `INBOX`。有些服务商的文件夹名拼法不一样——轮询收不到邮件时去 webmail 里确认一下。 | +| **Imap Use Ssl** | 端口 993 时保持开启。 | +| **Smtp Host** | 如 `smtp.gmail.com`。 | +| **Smtp Port** | 默认 `587`(STARTTLS)。配合 **Smtp Use Ssl** 时用 `465`。 | +| **Smtp Username** | 通常和 Imap Username 一样。 | +| **Smtp Password** | 通常是同一个 App Password。以 secret 方式存储。 | +| **Smtp Use Tls** | 端口 587 上的 STARTTLS。除非换用下面的隐式 SSL,否则保持开启。 | +| **Smtp Use Ssl** | 隐式 SSL,一般配端口 465。两个 TLS 选项二选一,不要同时开。 | +| **From Address** | 可选。留空时回退到 Smtp Username,再回退到 Imap Username。 | +| **Auto Reply Enabled** | 关闭后 Partner 不再自动回复入站邮件(主动发送不受影响)。测试时可以当刹车用。 | +| **Poll Interval Seconds** | 默认 `30`。检查收件箱的频率;小于 5 的值会被钳到 5。 | +| **Mark Seen** | 把处理过的邮件标为已读——这是最主要的去重保护。保持开启。 | +| **Max Body Chars** | 默认 `12000`。超长正文会在进入 Partner 之前被截断。 | +| **Subject Prefix** | 默认 `Re: `。回信主题会加上这个前缀,除非原主题已经以 `Re:` 开头。 | +| **Allow From** | 一行一个邮箱地址,全小写。测试可填 `*` 表示开放。空列表拒绝所有人。 | + + +### Matrix + +| 字段 | 怎么填 | +| --- | --- | +| **Send Progress** | 测试时建议开启。长任务会把过程 narration 发到房间里。 | +| **Send Tool Hints** | 调试时建议开启;不想让用户看到一行工具调用就关掉。 | +| **Enabled** | 准备启动 channel 时再打开。 | +| **Homeserver** | 默认 `https://matrix.org`。自建就填自己服务器的 URL。 | +| **Access Token** | 从 Element 或 login API 拿到的 token。以 secret 方式存储。 | +| **User Id** | bot 的完整 Matrix id,如 `@my-bot:matrix.org`。也用于识别 @ 提及。 | +| **Device Id** | 可选但建议填:随便选一个稳定的字符串并保持不变。留空的话,重启可能会重放最近的消息。 | +| **E2Ee Enabled** | 装好 `[matrix-e2e]` extra 和 libolm 之后再打开。没装的话 bot 解不开加密房间。 | +| **Sync Stop Grace Seconds** | 默认 `2`。关停时给进行中的 sync 多少秒收尾。基本不用改。 | +| **Max Media Bytes** | 默认 `20971520`(20 MB)。附件上传/下载的大小上限。 | +| **Allow From** | 一行一个 Matrix user id,如 `@frank:matrix.org`。测试可填 `*` 表示开放。空列表拒绝所有人——包括房间邀请。 | +| **Group Policy** | 多人房间的策略:`open`(默认)回复所有消息,`mention` 只在 bot 被 @ 时回复,`allowlist` 只回复下面列出的房间。1:1 直聊总是会回复。 | +| **Group Allow From** | 房间 id(`!abc123:matrix.org`),一行一个。只在 `allowlist` 策略下生效。 | +| **Allow Room Mentions** | 在 `mention` 策略下,`@room` 群发提醒算不算提及 bot。默认关闭。 | + + +### Mattermost + +| 字段 | 怎么填 | +| --- | --- | +| **Send Progress** | 测试时建议开启。长任务会实时投递过程 narration。 | +| **Send Tool Hints** | 调试时建议开启;不想让用户看到一行工具调用就关掉。 | +| **Enabled** | 准备启动 channel 时再打开。 | +| **Server Url** | 你的 Mattermost 基础 URL,例如 `https://mattermost.example.com`。scheme 可省略(默认 `https`),WebSocket URL 会自动推导出来 —— 不要在后面加 `/api/v4`。 | +| **Bot Token** | **Integrations -> Bot Accounts** 里 bot 账号的 access token。按密钥存储,保存后会打码显示。 | +| **Allow From** | 一行一个值。开放测试 bot 可填 `*`,正式用填 Mattermost user id。空列表拒绝所有人。 | +| **Group Policy** | `mention`(默认):频道里只有被 @ 时才答。`open`:已加入的频道里每条消息都答。私聊永远会回复。 | +| **Reply In Thread** | 开(默认):bot 在以触发 post 为根的线程里回复。线程后续消息仍会先经过 **Group Policy**;默认 `mention` 策略下,每条后续消息都要 @ bot。关:回复直接发到频道。 | +| **Verify Ssl** | 开(默认)。仅当自托管服务器用的是自签名证书或内部 CA 签发的证书时才关掉。 | + + +### Microsoft Teams + +| 字段 | 怎么填 | +| --- | --- | +| **Send Progress** | 测试时建议开启。长任务会把过程 narration 实时发过来。 | +| **Send Tool Hints** | 调试时建议开启;不想让用户看到一行工具调用就关掉。 | +| **Enabled** | 准备启动 channel 时再打开。 | +| **App Id** | App registration 的 Application (client) ID。同时也是校验入站 JWT 时要求的 audience。 | +| **App Password** | client secret 的 Value。按 secret 存储,保存后会打码。 | +| **Tenant Id** | Directory (tenant) ID。单租户注册必填;只有多租户 bot 才能留空。 | +| **Host** | 内置 HTTP 服务器的监听地址。默认 `0.0.0.0` 监听所有网卡;如果只有本机的反向代理来访问,可以收紧到 `127.0.0.1`。 | +| **Port** | 监听端口。默认 `3978`,Bot Framework 的惯例端口。同一主机上所有已启用的 Teams Partners 必须各用一个不同端口。 | +| **Path** | 接收消息的 URL 路径。默认 `/api/messages`,必须和 messaging endpoint 的结尾一致。 | +| **Allow From** | 一行一个值。测试可填 `*`;正式用换成 Microsoft Entra object id——被拒的 sender id 会打在 partner 日志里。空列表会拒绝所有人。 | +| **Reply In Thread** | 开启(默认)时,回复会挂在触发它的那条消息下面,而不是另起一条。 | +| **Mention Only Response** | 消息里除了 @ 机器人什么都没有时,机器人回的那句话。 | +| **Validate Inbound Auth** | 保持开启。每个入站请求都校验 Bot Framework JWT(用微软公开的密钥做 RS256 验签,audience 必须等于 App Id)。关掉它意味着任何拿到 URL 的人都能冒充任意用户跟 partner 说话——只限本地测试。 | +| **Ref Ttl Days** | 闲置的 conversation reference 保留多少天后清理。默认 `30`。 | +| **Prune Web Chat Refs** | 把 Bot Framework Web Chat 的会话从存储里剔除(Web Chat 不支持)。 | +| **Prune Non Personal Refs** | 把群聊/频道的会话 reference 剔除;channel 目前只做私聊。 | +| **Ref Touch Interval S** | 活跃会话 reference 的时间戳刷新最小间隔(秒)。默认 `300`。 | +| **Trusted Service Url Hosts** | 接受并回复的 Bot Framework 服务域名白名单。默认覆盖公有云和 GCC/DoD 政务云——除非微软把你路由去了别处,否则不用动。 | + + +### Slack + +| 字段 | 怎么填 | +| --- | --- | +| **Send Progress** | 测试时建议开启。长任务会实时投递过程 narration。 | +| **Send Tool Hints** | 调试时建议开启;不想让用户看到一行工具调用就关掉。 | +| **Enabled** | 准备启动 channel 时再打开。 | +| **Mode** | 目前只支持 `socket`,保持不动。 | +| **Webhook Path** | 为将来的 webhook 模式预留;**Mode** 是 `socket` 时用不上。留默认 `/slack/events` 即可。 | +| **Bot Token** | **OAuth & Permissions** 里的 `xoxb-…` token。按密钥存储,保存后会打码显示。 | +| **App Token** | **Socket Mode** 里的 `xapp-…` App-Level Token(需要 `connections:write`)。同样是密钥。别和 Bot Token 填反了。 | +| **User Token Read Only** | 保持默认(开)。 | +| **Reply In Thread** | 开(默认):bot 在触发消息下面的线程里回答。线程内的后续消息仍会先经过 **Group Policy**;默认 `mention` 策略下,每条后续消息都要 @ bot。关:回复直接发进频道。 | +| **React Emoji** | bot 加在你消息上、表示"收到"的 emoji 名(不带冒号)。默认 `eyes`。 | +| **Allow From** | 一行一个值。开放测试 bot 可填 `*`,正式用填 Slack 用户 id(`U…`)。空列表拒绝所有人。 | +| **Group Policy** | `mention`(默认):频道里只回答 @ 提及。`open`:所在频道每条消息都答。`allowlist`:只响应 **Group Allow From** 里列出的频道。 | +| **Group Allow From** | 频道 id(`C…`),一行一个。**Group Policy** 是 `allowlist` 时生效。 | +| **Dm** | DM 子策略:**Enabled** 整体开关 DM;**Policy** 取 `open` 时任何 DM 都答,取 `allowlist` 时只放行它自己那份 **Allow From** 列表里的 id。 | + + +### Telegram + +| 字段 | 怎么填 | +| --- | --- | +| **Streaming** | 默认关闭。打开后回复实时流式输出:文本一边生成,一边原地编辑那条 Telegram 消息。依赖 **Send Progress**:narration 轮次也会随生成实时流出。 | +| **Send Progress** | 测试时建议开启。长任务会实时投递过程 narration。 | +| **Send Tool Hints** | 调试时建议开启;不想让用户看到一行工具调用就关掉。 | +| **Enabled** | 准备启动 channel 时再打开。 | +| **Token** | BotFather 给的 HTTP API token。按密钥存储,保存后会打码显示。 | +| **Allow From** | 一行一个值。开放测试 bot 可填 `*`,正式用填 `@userinfobot` 查到的数字用户 id(username 也能匹配)。空列表拒绝所有人。 | +| **Proxy** | 可选代理 URL,Telegram 不可达的网络环境用,比如 `socks5://127.0.0.1:1080` 或 `http://proxy:8080`。直连就留空。 | +| **Reply To Message** | 打开后,bot 的回答会引用触发它的那条消息。热闹的群里很有用,私聊里就显得多余。 | +| **Group Policy** | 群组的回退策略:`mention`(默认)需 @ 或回复 bot;`open` 每条都答。私聊跳过群策略,但仍受 **Allow From** 限制。 | +| **Chat Policies** | 按 `chat_id` 覆盖:`open`、`mention` 或 `topics_only`。后者在 `allowed_topics` 中自动答,其他话题需 @ 或回复 bot;首个匹配规则生效。 | +| **Connection Pool Size** | Bot API 客户端的 HTTP 连接池大小。单个 bot 用默认 `16` 就够。 | +| **Pool Timeout** | 等待空闲连接的秒数。默认 `15`。 | +| **Stream Edit Interval** | 流式输出时两次原地编辑之间的最小间隔秒数。默认 `0.6`;如果 Telegram 报 flood-control 错误就调大。 | + + +### WhatsApp + +| 字段 | 怎么填 | +| --- | --- | +| **Send Progress** | 测试时建议开启。长任务会把过程 narration 发到 WhatsApp。 | +| **Send Tool Hints** | 调试时建议开启;不想让用户看到一行工具调用就关掉。 | +| **Enabled** | bridge 跑起来、准备启动 channel 时再打开。 | +| **Bridge Url** | bridge 的 WebSocket 地址,默认 `ws://localhost:3001`。 | +| **Bridge Token** | 可选共享密钥。只有你的 bridge 校验 `auth` 消息时才需要填。 | +| **Allow From** | 一行一个值。测试可填 `*` 表示开放;上线后换成具体 sender id(WhatsApp id 里 `@` 前面那段,通常是手机号)。空列表拒绝所有人。 | + + +### Zulip + +| 字段 | 怎么填 | +| --- | --- | +| **Send Progress** | 测试时建议开启。长任务会投递过程 narration。 | +| **Send Tool Hints** | 调试时建议开启;不想让用户看到一行工具调用就关掉。 | +| **Enabled** | 准备启动 channel 时再打开。 | +| **Site** | 你的 Zulip 服务器 URL,比如 `https://yourorg.zulipchat.com`。要带 scheme,realm 子域名要写对。 | +| **Email** | 创建页生成的 bot 邮箱 —— 不是你自己的。 | +| **Api Key** | bot 的 API key。按密钥存储。 | +| **Allow From** | 一行一个 Zulip 用户 id 或邮箱,两种写法都能匹配。开放测试可填 `*`。空列表拒绝所有人。 | +| **Group Policy** | 针对 stream 消息:`mention`(默认)只在 bot 被 @ 时回答,`open` 对已订阅 stream 的每条消息都答。私聊永远会回复。 | +| **Subscribe Streams** | stream 名,一行一个。channel 启动时会替 bot 订阅它们。 | +| **Timeout** | event-queue long-poll 超时秒数。默认 `60` 适用于大多数服务器。 | diff --git a/docs/src/content/docs/zh-cn/cli/server-api.md b/docs/src/content/docs/zh-cn/cli/server-api.md deleted file mode 100644 index c4348157f..000000000 --- a/docs/src/content/docs/zh-cn/cli/server-api.md +++ /dev/null @@ -1,368 +0,0 @@ ---- -title: 服务端 API -description: deeptutor serve 暴露的 HTTP 和 WebSocket 表面 —— 用于自定义前端和集成。 -quadrant: reference ---- - -`deeptutor serve` 在 `http://localhost:8001/` 上启动 FastAPI 后端(除非你改了后端端口)。本页是给自定义前端、移动 App 和服务间集成准备的高密度地图。 - -要看穷尽且永远最新的 schema,启动服务后打开: - -```text -GET /openapi.json # 完整 OpenAPI 3.1 spec -GET /docs # 交互式 Swagger UI -GET /redoc # 备选的 ReDoc UI -``` - -## 启动服务 - -```bash -# 仅后端。端口取自 data/user/settings/system.json,默认 8001。 -deeptutor serve - -# 给本次进程指定自定义 host/port -deeptutor serve --host 127.0.0.1 --port 18001 - -# 开发模式:Python 文件变动时热重载 -deeptutor serve --reload -``` - -## 鉴权 - -开启鉴权后,多数路由要求 Bearer JWT 或 `dt_token` cookie。登录/初始化可公开,资料/管理受保护;`GET /api/settings/ui` 公开。MarginNote `/sync`、`/heartbeat` 使用 `Authorization: MarginNote :`。 - -```bash -# 登录 -curl -X POST http://localhost:8001/api/auth/login \ - -c cookies.txt \ - -H "Content-Type: application/json" \ - -d '{"username":"alice","password":"..."}' - -# 响应是用户元数据;JWT 写入 dt_token cookie。 - -# 复用 cookie -curl -b cookies.txt http://localhost:8001/api/sessions -``` - -如果鉴权没开,认证依赖就是 no-op,本地单用户请求不需要带 token。 - -## Turn 执行 WebSocket - -```text -WS /ws -``` - -这是 Web UI 在用的统一 turn WebSocket。它对所有 capability 一视同仁,输出的事件和 `deeptutor run --format json` 打印的是同一族。 - -发一个 `type: "start_turn"` 或 `type: "message"` 载荷启动 turn: - -```json -{ - "type": "start_turn", - "protocol_version": "2.0", - "content": "Find d/dx [sin(x^2)]", - "capability": "deep_solve", - "session_id": null, - "tools": ["reason"], - "knowledge_bases": ["math"], - "language": "en", - "config": {}, - "notebook_references": [], - "history_references": [], - "partner_group_references": [], - "attachments": [] -} -``` - -上面只是单轮 turn 的载荷本身。`/ws` 上的每个 client 帧都必须带 `"protocol_version": "2.0"`——`start_turn`、`subscribe_turn`、`cancel_turn`、`ping` 都一样。缺这个字段的帧会先收到 `protocol_error` 事件(`error_code: "unsupported_protocol_version"`),此时还不会对载荷做任何命令模型的校验。 - -`skills` 不是无效字段,而是用来收窄本轮的:它会和当前工作区允许的技能取交集,所以指定了 skill 的 turn 里,`read_skill` 只能看到这几个。省略该字段或传空数组表示继承工作区允许的全部可见 skill。turn 的选择永远不会超出工作区允许的范围。 - -其他 client 类型包括 `subscribe_turn`、`resume_from`、`cancel_turn`、`submit_user_reply`、`regenerate` 等;订阅按 `after_seq` 补帧,终态必收 `done`(失败先 `error`)。 - -典型收到的事件: - -```json -{"type":"stage_start","stage":"responding"} -{"type":"tool_call","content":"rag","metadata":{"args":{"query":"chain rule","kb_name":"math"}}} -{"type":"tool_result","content":"...","metadata":{"tool":"rag"}} -{"type":"content","content":"## Solution\n\nThe derivative..."} -{"type":"stage_end","stage":"responding"} -{"type":"done","session_id":"sess_abc123","turn_id":"turn_xyz789","metadata":{"status":"completed"}} -``` - -## WebSocket 接口 - -```text -WS /ws -WS /ws/books -WS /ws/questions/mimic -WS /ws/questions/generate -WS /ws/questions/judge -WS /ws/knowledge-bases/{kb_name}/progress -WS /ws/mastery-paths -WS /ws/partners/{partner_id} -WS /ws/partner-groups/{group_id} -``` - -旧的 `/api/v1/chat`、`/api/v1/ws` 与各功能的 API-prefixed socket 均已移除。上面是完整的规范 WebSocket namespace;`/ws` 统一处理所有 turn capability、回放、取消、重新生成与 `ask_user` 回复。 - -## Session - -```text -GET /api/sessions 列 session -GET /api/sessions/{session_id} 拿到一个 session + 消息 -PATCH /api/sessions/{session_id} 重命名(body: {"title":"..."}) -DELETE /api/sessions/{session_id} 删除 -PUT /api/sessions/{session_id}/branch-selection -DELETE /api/sessions/{session_id}/messages/{message_id} -POST /api/sessions/{session_id}/quiz-results -``` - -其他会话状态接口: - -```text -GET /api/sessions/{session_id}/ask-hint -PATCH /api/sessions/{session_id}/organization -``` - -## 知识库 - -```text -GET /api/knowledge-bases 列 KB -GET /api/knowledge-bases/{kb_name} KB 信息 -DELETE /api/knowledge-bases/{kb_name} 删除 -POST /api/knowledge-bases 创建 KB -POST /api/knowledge-bases/{kb_name}/upload 添加文档 -POST /api/knowledge-bases/{kb_name}/reindex 重新 embed 文档 -GET /api/knowledge-bases/default 获取默认 KB -PUT /api/knowledge-bases/default/{kb_name} 设置默认 KB -GET /api/knowledge-bases/supported-file-types 支持的上传格式 -GET /api/knowledge-bases/{kb_name}/files 列源文件 -GET /api/knowledge-bases/{kb_name}/files/{filename} 取单个源文件(预览/下载) -GET /api/knowledge-bases/{kb_name}/file-preview-text/{filename} 提取的纯文本预览 -GET /api/knowledge-bases/{kb_name}/progress 索引进度 -WS /ws/knowledge-bases/{kb_name}/progress `task_id` 回放终态;孤立任务 → `knowledge_task_interrupted` -``` - -临时的 KB 搜索目前是通过 RAG 运行时 / tool 路径暴露的,当前 API 里没有专门的 `POST /knowledge/{name}/search` 路由。从 CLI 走,用 `deeptutor kb search `。 - -## Notebook - -```text -GET /api/notebooks -GET /api/notebooks/statistics -POST /api/notebooks -GET /api/notebooks/{notebook_id} -PUT /api/notebooks/{notebook_id} -DELETE /api/notebooks/{notebook_id} -POST /api/notebooks/actions/add-record -POST /api/notebooks/actions/add-record-with-summary -DELETE /api/notebooks/{notebook_id}/records/{record_id} -PUT /api/notebooks/{notebook_id}/records/{record_id} -POST /api/notebooks/{notebook_id}/records/{record_id}/actions/copy -POST /api/notebooks/{notebook_id}/records/{record_id}/actions/move -GET /api/notebooks/{notebook_id}/export -``` - -## Memory - -```text -GET /api/memory/overview -GET /api/memory/doc/{layer}/{key} -PUT /api/memory/doc/{layer}/{key} -POST /api/memory/doc/{layer}/{key}/reset -POST /api/memory/doc/{layer}/{key}/update -POST /api/memory/doc/{layer}/{key}/audit -POST /api/memory/doc/{layer}/{key}/dedup -POST /api/memory/runs/start -GET /api/memory/runs -GET /api/memory/runs/{run_id} -GET /api/memory/runs/{run_id}/events?since=N 绝对 N = last_seen_seq + 1 -POST /api/memory/runs/{run_id}/cancel -POST /api/memory/runs/{run_id}/undo -GET /api/memory/trace/{surface} -DELETE /api/memory/trace/{surface} -GET /api/memory/settings -PUT /api/memory/settings -``` - -层级是 `L2` 和 `L3`;例:`/api/memory/doc/L3/profile` 和 `/api/memory/doc/L2/chat`。 - -## Settings、tools、visualizers 和 system - -```text -GET /api/settings -GET /api/settings/catalog -PUT /api/settings/catalog -POST /api/settings/apply -POST /api/settings/model-capabilities -PUT /api/settings/enabled-tools -GET /api/tools -GET /api/system/status -GET /api/system/memory -GET /api/system/runtime -GET /api/system/update -POST /api/system/update/check -PUT /api/system/update/settings -GET /api/system/update/job -POST /api/system/update -POST /api/system/test/llm -POST /api/system/test/embeddings -POST /api/system/test/search -GET /api/visualizers/list -POST /api/visualizers/bundled/{visualizer_id}/install -POST /api/visualizers/{visualizer_id}/enable -POST /api/visualizers/{visualizer_id}/disable -DELETE /api/visualizers/{visualizer_id} -POST /api/visualizers/import -GET /api/visualizers/{visualizer_id}/assets/{asset_path} -``` - -Provider profile 通过 catalog endpoint 编辑;当前 API 里没有单独的 `/settings/llm` 或 `/settings/embedding` 路由。Capability 走统一 WebSocket / CLI 合约。Visualizer 导入的是声明式浏览器包,不是可执行的后端插件。 - -## Partners Manager - -```text -GET /api/partners -POST /api/partners -GET /api/partners/recent -GET /api/partners/channels/schema -GET /api/partners/tool-options -GET /api/partners/souls -POST /api/partners/souls -GET /api/partners/soul-sources -GET /api/partners/{partner_id} -PATCH /api/partners/{partner_id} -POST /api/partners/{partner_id}/start -POST /api/partners/{partner_id}/stop -DELETE /api/partners/{partner_id} -POST /api/partners/{partner_id}/channels/reload -GET /api/partners/{partner_id}/channels/status -POST /api/partners/{partner_id}/channel-onboarding/start -GET /api/partners/{partner_id}/channel-onboarding/{session_id} -DELETE /api/partners/{partner_id}/channel-onboarding/{session_id} -POST /api/partners/{partner_id}/channel-onboarding/{session_id}/apply -GET /api/partners/{partner_id}/soul -PUT /api/partners/{partner_id}/soul -GET /api/partners/{partner_id}/assets -POST /api/partners/{partner_id}/assets -DELETE /api/partners/{partner_id}/assets/{asset_type}/{name} -GET /api/partners/{partner_id}/history -GET /api/partners/{partner_id}/sessions -POST /api/partners/{partner_id}/sessions/archive -POST /api/partners/{partner_id}/sessions/resume -POST /api/partners/{partner_id}/sessions/delete -POST /api/partners/{partner_id}/sessions/branch -POST /api/partners/{partner_id}/chat -POST /api/partners/{partner_id}/chat/execute-stream -WS /ws/partners/{partner_id} -``` - -已认证用户可创建 Partner。资源路由检查 **use** 或 **manage** 权限;owner/admin 可管理,grant 可仅允许对话。Secret 默认打码,除非可管理调用方请求 `include_secrets=true`。 - -## Book Engine - -```text -GET /api/books -POST /api/books -GET /api/books/block-types 可生成的内容类型 -GET /api/books/{book_id} -GET /api/books/{book_id}/spine -GET /api/books/{book_id}/pages/{page_id} -DELETE /api/books/{book_id} -POST /api/books/confirm-proposal -POST /api/books/confirm-spine -POST /api/books/compile-page -POST /api/books/pause 先持久化、取消工作、保留已完成页 -POST /api/books/resume 只排入未完成页 -POST /api/books/{book_id}/refresh-fingerprints -WS /ws/books 订阅传 `after_seq`;可能先确认 reset -``` - -## 沉浸式阅读 - -```text -GET /api/reading/supported-formats 支持的扩展名、体积上限、可原样查看的格式 -GET /api/reading/materials 列出本账号的素材 -POST /api/reading/materials 上传文档(multipart) -GET /api/reading/materials/{material_id} 清单:单元类型、单元数量、大纲 -DELETE /api/reading/materials/{material_id} 忘掉某份素材 -GET /api/reading/materials/{material_id}/units/{locator} 单个单元的文本 -GET /api/reading/materials/{material_id}/revisions 之前不可变的 URL 快照 -GET /api/reading/materials/{material_id}/revisions/{revision}/units/{locator} -GET /api/reading/materials/{material_id}/raw 原始字节(PDF) -GET /api/reading/materials/{material_id}/assets/{asset_name} 经鉴权的快照图片 -GET /api/reading/materials/{material_id}/bookmarks 列出书签 -POST /api/reading/materials/{material_id}/bookmarks 保存书签 -DELETE /api/reading/materials/{material_id}/bookmarks/{bookmark_id} -GET /api/reading/materials/{material_id}/annotations 列出批注 -PUT /api/reading/materials/{material_id}/annotations 创建或更新一条;返回 AnnotationInfo -DELETE /api/reading/materials/{material_id}/annotations/{id} 删除一条 -GET /api/reading/materials/{material_id}/export?fmt=auto|pdf|markdown -``` - -素材以内容寻址:同样的字节上传两次会拿到同一个 `material_id`,上面已有的批注也都还在。`export?fmt=pdf` 返回写入了真正 PDF 批注的原文件,仅对保留了原始字节的素材可用。 - -URL 刷新会保留不可变的旧 revision。快照 asset 需要鉴权、经过 MIME sniff,并带 `nosniff` 返回,不会在阅读器中直接暴露实时第三方页面。 - -## 沉浸式观看 - -```text -GET /api/settings/video-learning -PUT /api/settings/video-learning -POST /api/settings/video-learning/test-invidious -POST /api/video-learning/materials/resolve -GET /api/video-learning/materials/{material_id} -PUT /api/video-learning/materials/{material_id}/progress -GET /api/video-learning/materials/{material_id}/subtitles.vtt -GET|HEAD /api/video-learning/materials/{material_id}/stream/{format_id} -``` - -这些兼容端点保留 YouTube 播放、转录字幕与独立于 provider 的进度。当前视频会话使用 Reading,旧 Watching 会话重开时迁移。Resolve 接收 URL 及可选语言 / provider;VTT 返回归一化字幕。 - -## 其余路由 - -上面并未逐一展开所有接口。以下这些同样存在、遵循同样的约定,其 schema 请查 `/openapi.json`: - -```text -/api/skills 技能库与 hub 安装 -/api/personas 人设预设 -/api/plugins 托管插件生命周期与审批 -/api/learning-journal 工作区目标、交接与已确认记录 -/api/documents 协同写作文档与编辑流 -/api/mastery-paths 掌握路径、目标与进度 -/api/subagents 已连接智能体的配置 -/api/imports Claude Code / Codex 对话导入 -/api/space/mcp 按账号的 MCP 服务与精选目录 -/api/space/cli-apps CLI 应用目录、安装与授权 -/api/voice 语音合成与语音识别 -/api/dashboard 最近活动、起始建议/刷新与活动详情 -``` - -## 输出和附件 - -产物通过认证路由提供: - -```text -GET /files/outputs/ -``` - -仅解析调用者或单个可见 Partner 的 allowlist 文件;非法、私有、穿越路径均失败。附件挂在: - -```text -GET /files/attachments/{session_id}/{attachment_id}/{filename} -``` - -## 生成 typed client - -```bash -curl http://localhost:8001/openapi.json > deeptutor.openapi.json - -# TypeScript client -npx openapi-typescript deeptutor.openapi.json -o deeptutor.d.ts - -# Python client -pip install openapi-python-client -openapi-python-client generate --path deeptutor.openapi.json -``` diff --git a/docs/src/content/docs/zh-cn/explore/subagents.md b/docs/src/content/docs/zh-cn/customize/agents.md similarity index 95% rename from docs/src/content/docs/zh-cn/explore/subagents.md rename to docs/src/content/docs/zh-cn/customize/agents.md index 071535d06..c92ffed9e 100644 --- a/docs/src/content/docs/zh-cn/explore/subagents.md +++ b/docs/src/content/docs/zh-cn/customize/agents.md @@ -70,6 +70,6 @@ quadrant: how-to ## 另见 -- [主页](/zh-cn/explore/chat-workspace/)——在这里咨询与引用智能体 -- [伙伴](/zh-cn/explore/partners/)——把一个伙伴连接成可咨询的智能体 -- [记忆](/zh-cn/explore/memory/)——导入的上下文如何与 DeepTutor 自己的声音保持区隔 +- [主页](/zh-cn/learning-workspace/chat/)——在这里咨询与引用智能体 +- [伙伴](/zh-cn/channels/)——把一个伙伴连接成可咨询的智能体 +- [记忆](/zh-cn/learning-workspace/memory/)——导入的上下文如何与 DeepTutor 自己的声音保持区隔 diff --git a/docs/src/content/docs/zh-cn/ecosystem/cli-apps.md b/docs/src/content/docs/zh-cn/customize/cli-apps.md similarity index 93% rename from docs/src/content/docs/zh-cn/ecosystem/cli-apps.md rename to docs/src/content/docs/zh-cn/customize/cli-apps.md index 48b24be68..66583f00c 100644 --- a/docs/src/content/docs/zh-cn/ecosystem/cli-apps.md +++ b/docs/src/content/docs/zh-cn/customize/cli-apps.md @@ -47,7 +47,7 @@ CLI App 让智能体调用真实命令行程序,却不授予通用主机 shell ## 另见 -- [MCP 扩展](/zh-cn/ecosystem/mcp/)——不安装主机代码也能连接远程工具 -- [主页](/zh-cn/explore/chat-workspace/)——获准 CLI App 作为工具被调用的位置 -- [多用户部署](/zh-cn/get-started/multi-user/)——把应用授权给账号 +- [MCP 扩展](/zh-cn/customize/mcp/)——不安装主机代码也能连接远程工具 +- [主页](/zh-cn/learning-workspace/chat/)——获准 CLI App 作为工具被调用的位置 +- [多用户部署](/zh-cn/self-hosting/multi-user/)——把应用授权给账号 diff --git a/docs/src/content/docs/zh-cn/ecosystem/eduhub.md b/docs/src/content/docs/zh-cn/customize/eduhub.md similarity index 90% rename from docs/src/content/docs/zh-cn/ecosystem/eduhub.md rename to docs/src/content/docs/zh-cn/customize/eduhub.md index f90c2f2b5..34c5b1971 100644 --- a/docs/src/content/docs/zh-cn/ecosystem/eduhub.md +++ b/docs/src/content/docs/zh-cn/customize/eduhub.md @@ -48,7 +48,7 @@ deeptutor skill install clawhub: ## 另见 -- [Skill 扩展](/zh-cn/ecosystem/skills/)——Skill 进入 DeepTutor 后如何工作 -- [CLI 命令](/zh-cn/cli/commands/)——完整 Skill 命令参考 -- [DeepTutor 生态](/zh-cn/ecosystem/)——比较 Skill、MCP 服务与 CLI App +- [Skill 扩展](/zh-cn/customize/skills/)——Skill 进入 DeepTutor 后如何工作 +- [CLI 命令](/zh-cn/developers/reference/cli/)——完整 Skill 命令参考 +- [DeepTutor 生态](/zh-cn/customize/)——比较 Skill、MCP 服务与 CLI App diff --git a/docs/src/content/docs/zh-cn/customize/index.md b/docs/src/content/docs/zh-cn/customize/index.md new file mode 100644 index 000000000..2222b9f2e --- /dev/null +++ b/docs/src/content/docs/zh-cn/customize/index.md @@ -0,0 +1,23 @@ +--- +title: 定制 +description: 账号级的人格、技能和连接,与工作区是什么关系。 +quadrant: explanation +--- + +**个性化**是账号这一层的架子。工作区放的是工作本身:对话、学习活动和材料。架子上是换工作区之后仍然带着的做法。工作区仍然决定一轮可以使用其中哪些资源,对话还可以再收窄。架子上的东西对另一个账号不可见。 + +| 放在这里 | 它是 | +| --- | --- | +| [人格](/zh-cn/customize/personas/) | 一轮对话的语气和回答策略 | +| [我的智能体](/zh-cn/customize/agents/) | 一个已连接的 harness,或一份可以咨询的导入记录 | +| [技能](/zh-cn/customize/skills/) | 任务需要时模型去读的可复用步骤 | +| [MCP 服务](/zh-cn/customize/mcp/) | 远程服务器上的工具,授权记在账号上 | +| [CLI 应用](/zh-cn/customize/cli-apps/) | 管理员安装的程序,在沙箱里运行 | +| [记忆](/zh-cn/learning-workspace/memory/) | 你可以打开并改正的偏好和摘要 | +| [EduHub](/zh-cn/customize/eduhub/) | 导入前先检查的社区技能 | + +检索不是这些账号对象之一。[RAG 集成](/zh-cn/customize/rag/)属于某个知识库,以及这个库索引的文件。 + +每条路径的信任边界不同。技能是说明文字。MCP 服务是远程工具边界。CLI 应用是宿主机上的代码。EduHub 分发技能,并不运行它们。工作区的分配引用账号目录,不复制凭据,也不绕过按用户的授权。 + +伙伴可以从一个人格开始,然后保有自己的灵魂、资料库和渠道。那是伙伴自己的身份,之后修改人格不会改写它。见[渠道](/zh-cn/channels/)。 diff --git a/docs/src/content/docs/zh-cn/ecosystem/mcp.md b/docs/src/content/docs/zh-cn/customize/mcp.md similarity index 94% rename from docs/src/content/docs/zh-cn/ecosystem/mcp.md rename to docs/src/content/docs/zh-cn/customize/mcp.md index 36e101001..571047c8c 100644 --- a/docs/src/content/docs/zh-cn/ecosystem/mcp.md +++ b/docs/src/content/docs/zh-cn/customize/mcp.md @@ -50,7 +50,7 @@ MCP 服务把 DeepTutor 之外的工具带进与内置工具相同的智能体 ## 另见 -- [Skill 扩展](/zh-cn/ecosystem/skills/)——只包含指令的工作流扩展 -- [CLI-App 扩展](/zh-cn/ecosystem/cli-apps/)——安装在部署上的沙箱化命令行工具 -- [多用户部署](/zh-cn/get-started/multi-user/)——编辑账号授权 +- [Skill 扩展](/zh-cn/customize/skills/)——只包含指令的工作流扩展 +- [CLI-App 扩展](/zh-cn/customize/cli-apps/)——安装在部署上的沙箱化命令行工具 +- [多用户部署](/zh-cn/self-hosting/multi-user/)——编辑账号授权 diff --git a/docs/src/content/docs/zh-cn/customize/personas.md b/docs/src/content/docs/zh-cn/customize/personas.md new file mode 100644 index 000000000..9ddbbf3f5 --- /dev/null +++ b/docs/src/content/docs/zh-cn/customize/personas.md @@ -0,0 +1,24 @@ +--- +title: 人格 +description: 创建一个人格,并在一轮对话里使用它。 +quadrant: how-to +--- + +人格是账号级预设:名称、一行描述,以及关于语气和教法的 Markdown 说明。你选的能力仍然决定任务。人格只改变这个任务怎么被完成。 + +## 创建一个并试一次 + +1. 打开 **个性化 → 人格**。 +2. 新建预设。写下名称、一行描述,以及你可以检验的行为。“给出解答之前,先问我下一步”是一条能用的说明。 +3. 保存。 +4. 在[对话](/zh-cn/learning-workspace/chat/)的输入框里选中这个人格,提一个短问题。 +5. 回复没有遵守说明时,改预设再问一次。不再需要时删除预设。 + +`Default` 是不加设定的助手。**peer**、**research-assistant**、**teacher** 这些内置人格在你创建自己的之前就可以用。共享部署里,部署预设对普通用户只读。你自己的同名人格优先。 + +同一个预设可以作为伙伴灵魂的起始文本。创建伙伴时会复制它。之后修改人格不会改变那个伙伴。在[渠道](/zh-cn/channels/)里连接伙伴。 + +## 另见 + +- [定制](/zh-cn/customize/) — 人格与技能、记忆的位置 +- [对话](/zh-cn/learning-workspace/chat/) — 输入框里的选择 diff --git a/docs/src/content/docs/zh-cn/ecosystem/rag-integration.md b/docs/src/content/docs/zh-cn/customize/rag.md similarity index 86% rename from docs/src/content/docs/zh-cn/ecosystem/rag-integration.md rename to docs/src/content/docs/zh-cn/customize/rag.md index ea91cc890..cf2e2e164 100644 --- a/docs/src/content/docs/zh-cn/ecosystem/rag-integration.md +++ b/docs/src/content/docs/zh-cn/customize/rag.md @@ -4,7 +4,7 @@ description: 选择 DeepTutor 如何从本地索引、智能体文档树、远 quadrant: how-to --- -DeepTutor 把检索当成一条生态边界,而不是写死成某一种向量库。[知识空间](/zh-cn/explore/knowledge/)里的知识库是用户看到的容器;背后的 **RAG 集成**决定材料如何建索引、查询、引用与同步。 +DeepTutor 把检索当成一条生态边界,而不是写死成某一种向量库。[知识空间](/zh-cn/learning-workspace/knowledge/)里的知识库是用户看到的容器;背后的 **RAG 集成**决定材料如何建索引、查询、引用与同步。 ## 可用集成 @@ -55,6 +55,6 @@ LightRAG extra 只安装受支持的 LightRAG SDK;文档解析仍是 **Setting ## 另见 -- [知识空间](/zh-cn/explore/knowledge/)——创建、版本化、同步和使用知识库 -- [沉浸式阅读](/zh-cn/explore/reading/)——直接阅读一个资料组,而不是给整个语料建索引 -- [设置](/zh-cn/explore/settings/)——配置 embedding 提供商与文档解析 +- [知识空间](/zh-cn/learning-workspace/knowledge/)——创建、版本化、同步和使用知识库 +- [沉浸式阅读](/zh-cn/learning-workspace/reading/)——直接阅读一个资料组,而不是给整个语料建索引 +- [设置](/zh-cn/self-hosting/settings/)——配置 embedding 提供商与文档解析 diff --git a/docs/src/content/docs/zh-cn/ecosystem/skills.md b/docs/src/content/docs/zh-cn/customize/skills.md similarity index 90% rename from docs/src/content/docs/zh-cn/ecosystem/skills.md rename to docs/src/content/docs/zh-cn/customize/skills.md index edd448cbd..a5903b098 100644 --- a/docs/src/content/docs/zh-cn/ecosystem/skills.md +++ b/docs/src/content/docs/zh-cn/customize/skills.md @@ -16,7 +16,7 @@ Skill 是模型按需读取的 **`SKILL.md` 工作手册**。它不用增加新 ## 从 EduHub 导入 -选择 **Import from EduHub**,可以直接浏览社区 Skill 并下载到自己的库里。导入内容通过安全闸门后才会可用。发现、审阅、安全检查、发布与版本管理详见 [EduHub](/zh-cn/ecosystem/eduhub/)。 +选择 **Import from EduHub**,可以直接浏览社区 Skill 并下载到自己的库里。导入内容通过安全闸门后才会可用。发现、审阅、安全检查、发布与版本管理详见 [EduHub](/zh-cn/customize/eduhub/)。 ## 从 CLI 安装与发布 @@ -48,7 +48,7 @@ deeptutor skill update ## 另见 -- [个性化](/zh-cn/explore/personalization/)——账号资源架与工作区选择 -- [EduHub](/zh-cn/ecosystem/eduhub/)——发现并发布社区 Skill -- [MCP 扩展](/zh-cn/ecosystem/mcp/)——连接运行在 DeepTutor 之外的工具 -- [CLI 命令](/zh-cn/cli/commands/)——完整命令参考 +- [个性化](/zh-cn/customize/)——账号资源架与工作区选择 +- [EduHub](/zh-cn/customize/eduhub/)——发现并发布社区 Skill +- [MCP 扩展](/zh-cn/customize/mcp/)——连接运行在 DeepTutor 之外的工具 +- [CLI 命令](/zh-cn/developers/reference/cli/)——完整命令参考 diff --git a/docs/src/content/docs/zh-cn/developers/architecture.md b/docs/src/content/docs/zh-cn/developers/architecture.md new file mode 100644 index 000000000..9ef7caf03 --- /dev/null +++ b/docs/src/content/docs/zh-cn/developers/architecture.md @@ -0,0 +1,23 @@ +--- +title: 架构 +description: 一次 turn 如何进入 DeepTutor,并到达工具或能力。 +quadrant: explanation +--- + +DeepTutor 有三个入口:CLI、WebSocket API 和 Python SDK。三者都进入 turn 应用服务。服务先把 turn 持久化,再由 turn 引擎把一份规范化的上下文交给选中的能力。默认能力是 `chat`。 + +```text +CLI | WebSocket /ws | Python SDK + | + Turn 应用服务 + | + Turn 引擎 + / \ + 工具注册表 能力注册表 +``` + +工具是模型在一轮里调用的单个函数。能力是接管这一轮的多阶段流程,例如 `deep_solve`、`deep_research` 和 `visualize`。已注册的名称、阶段和 CLI 别名在[能力参考](/zh-cn/developers/reference/capabilities/)。 + +正在运行的 turn 在 `WS /ws` 上使用 [Turn 协议](/zh-cn/developers/reference/turn-protocol/)。套接字以外的 HTTP 路由见 [HTTP API](/zh-cn/developers/reference/http-api/)。 + +实现布局、测试和模块归属留在仓库的[架构笔记](https://github.com/HKUDS/DeepTutor/blob/dev/docs-for-dev/ARCHITECTURE.md)。本站不发布那套内部文档。 diff --git a/docs/src/content/docs/zh-cn/cli/agent-handoff.md b/docs/src/content/docs/zh-cn/developers/guides/agent-handoff.md similarity index 97% rename from docs/src/content/docs/zh-cn/cli/agent-handoff.md rename to docs/src/content/docs/zh-cn/developers/guides/agent-handoff.md index f475395ee..7f453e03b 100644 --- a/docs/src/content/docs/zh-cn/cli/agent-handoff.md +++ b/docs/src/content/docs/zh-cn/developers/guides/agent-handoff.md @@ -254,6 +254,6 @@ DeepTutor 本地 CLI 命令不需要浏览器,但模型 / 搜索功能会去 ## 另见 -- [**命令参考**](/zh-cn/cli/commands/) —— 完整 CLI 参考 -- [**交互式 REPL**](/zh-cn/cli/chat-repl/) —— 人工驱动的会话 -- [**Memory**](/zh-cn/explore/memory/) —— 持久状态怎么在 session 之间流动 +- [**命令参考**](/zh-cn/developers/reference/cli/) —— 完整 CLI 参考 +- [**交互式 REPL**](/zh-cn/developers/guides/repl/) —— 人工驱动的会话 +- [**Memory**](/zh-cn/learning-workspace/memory/) —— 持久状态怎么在 session 之间流动 diff --git a/docs/src/content/docs/zh-cn/cli/index.md b/docs/src/content/docs/zh-cn/developers/guides/cli.md similarity index 91% rename from docs/src/content/docs/zh-cn/cli/index.md rename to docs/src/content/docs/zh-cn/developers/guides/cli.md index 0de80051b..ad73da0bf 100644 --- a/docs/src/content/docs/zh-cn/cli/index.md +++ b/docs/src/content/docs/zh-cn/developers/guides/cli.md @@ -8,10 +8,10 @@ DeepTutor 是围绕 **agent-native CLI** 设计的:核心运行时在终端里 本章节包括: -- [**命令参考**](/zh-cn/cli/commands/) —— 每个顶层命令和子命令的 flag、schema、示例 -- [**交互式 REPL**](/zh-cn/cli/chat-repl/) —— 在长会话里用 `/slash` 命令操作 -- [**代理交接**](/zh-cn/cli/agent-handoff/) —— 让 Claude Code / Codex / OpenCode / Hermes 来驱动 `deeptutor` -- [**服务端 API**](/zh-cn/cli/server-api/) —— `deeptutor serve` 暴露的 HTTP / WebSocket 表面 +- [**命令参考**](/zh-cn/developers/reference/cli/) —— 每个顶层命令和子命令的 flag、schema、示例 +- [**交互式 REPL**](/zh-cn/developers/guides/repl/) —— 在长会话里用 `/slash` 命令操作 +- [**代理交接**](/zh-cn/developers/guides/agent-handoff/) —— 让 Claude Code / Codex / OpenCode / Hermes 来驱动 `deeptutor` +- [**服务端 API**](/zh-cn/developers/reference/http-api/) —— `deeptutor serve` 暴露的 HTTP / WebSocket 表面 当前 dev 使用仓库根目录中的源码安装流程。使用 1.7.x 模块家族时,裸 `deeptutor` 提供 core 聊天和 SDK;其他命令需要对应功能模块或 `[full]`。运行前用 `deeptutor module list` 和 `deeptutor plugin list` 检查可用范围。 @@ -75,7 +75,7 @@ deeptutor memory show L3 | `deeptutor provider` | provider 认证流程 | `deeptutor provider login openai-codex` | | `deeptutor book` | Knowledge Books(引导式学习) | `deeptutor book list / health` | -完整参考见 [**命令参考**](/zh-cn/cli/commands/)。 +完整参考见 [**命令参考**](/zh-cn/developers/reference/cli/)。 ## 两种使用方式 @@ -92,7 +92,7 @@ $ deeptutor chat --kb physics You> 用一个具体例子讲一下链式法则 ``` -完整说明:[**交互式 REPL**](/zh-cn/cli/chat-repl/)。 +完整说明:[**交互式 REPL**](/zh-cn/developers/guides/repl/)。 ### 方式 2 —— Agent 风格单次执行 @@ -106,7 +106,7 @@ deeptutor run deep_solve "求 [[4,1],[2,3]] 的特征值" \ 每行 JSON 是一个事件 —— `stage_start`、`content`、`tool_call`、`tool_result`、`thinking`、`done`。可以管道给下游 agent,或者用 `jq` 提取最终答案。 -完整说明:[**代理交接**](/zh-cn/cli/agent-handoff/)。 +完整说明:[**代理交接**](/zh-cn/developers/guides/agent-handoff/)。 ## 状态存在哪里 diff --git a/docs/src/content/docs/zh-cn/contributing.md b/docs/src/content/docs/zh-cn/developers/guides/contributing.md similarity index 100% rename from docs/src/content/docs/zh-cn/contributing.md rename to docs/src/content/docs/zh-cn/developers/guides/contributing.md diff --git a/docs/src/content/docs/zh-cn/cli/chat-repl.md b/docs/src/content/docs/zh-cn/developers/guides/repl.md similarity index 97% rename from docs/src/content/docs/zh-cn/cli/chat-repl.md rename to docs/src/content/docs/zh-cn/developers/guides/repl.md index 1fce65e7b..db470ccdb 100644 --- a/docs/src/content/docs/zh-cn/cli/chat-repl.md +++ b/docs/src/content/docs/zh-cn/developers/guides/repl.md @@ -99,7 +99,7 @@ $ 合法名称:`chat`、`ask_questions`、`deep_solve`、`deep_question`、`deep_research`、`visualize`、`math_animator`、`mastery_path`、`immersive_reading`、`video_lesson`、`audio_overview`。CLI 别名也认——`ask`、`solve`、`quiz`、`research`、`viz`、`animate`、`mastery`、`reading` / `read`、`lesson`、`audio-overview` / `overview`。 -注意 `immersive_reading` 在 CLI 上跑的是没有阅读器的那套循环:CLI 既没有可滚动的视口,也没有可操作的选区,所以这个模式请在 Web 界面用(见[沉浸式阅读](/zh-cn/explore/reading/))。 +注意 `immersive_reading` 在 CLI 上跑的是没有阅读器的那套循环:CLI 既没有可滚动的视口,也没有可操作的选区,所以这个模式请在 Web 界面用(见[沉浸式阅读](/zh-cn/learning-workspace/reading/))。 ```text You> /cap deep_solve @@ -268,5 +268,5 @@ deeptutor notebook add-md my-answer.md --title "Chain rule explana ## 另见 -- [**命令参考**](/zh-cn/cli/commands/) —— `run`、`kb`、`partner` 等完整参考 -- [**代理交接**](/zh-cn/cli/agent-handoff/) —— 让 agent 替你来做这些 +- [**命令参考**](/zh-cn/developers/reference/cli/) —— `run`、`kb`、`partner` 等完整参考 +- [**代理交接**](/zh-cn/developers/guides/agent-handoff/) —— 让 agent 替你来做这些 diff --git a/docs/src/content/docs/zh-cn/cli/python-sdk.md b/docs/src/content/docs/zh-cn/developers/guides/sdk.md similarity index 91% rename from docs/src/content/docs/zh-cn/cli/python-sdk.md rename to docs/src/content/docs/zh-cn/developers/guides/sdk.md index 0ccfb92bf..c2022b48b 100644 --- a/docs/src/content/docs/zh-cn/cli/python-sdk.md +++ b/docs/src/content/docs/zh-cn/developers/guides/sdk.md @@ -68,6 +68,6 @@ Shell pipeline 与 agent 交接选 **CLI**,进程内异步集成选 **Python S ## 另见 -- [代理交接](/zh-cn/cli/agent-handoff/)——以 NDJSON 消费同一条事件流 -- [服务端 API](/zh-cn/cli/server-api/)——跨进程或网络连接 -- [命令参考](/zh-cn/cli/commands/)——配置并检查共享工作区 +- [代理交接](/zh-cn/developers/guides/agent-handoff/)——以 NDJSON 消费同一条事件流 +- [服务端 API](/zh-cn/developers/reference/http-api/)——跨进程或网络连接 +- [命令参考](/zh-cn/developers/reference/cli/)——配置并检查共享工作区 diff --git a/docs/src/content/docs/zh-cn/developers/reference/capabilities.md b/docs/src/content/docs/zh-cn/developers/reference/capabilities.md new file mode 100644 index 000000000..6baa23ac8 --- /dev/null +++ b/docs/src/content/docs/zh-cn/developers/reference/capabilities.md @@ -0,0 +1,21 @@ +--- +title: 能力 +description: 已注册能力的名称、阶段、所属模块和 CLI 别名。 +quadrant: reference +--- + +名称、阶段和 CLI 别名来自 `deeptutor/modules/manifests/*.json` 里每个能力的 `manifest`。描述保持清单中的英文原文。 + +| 能力 | 模块 | 阶段 | CLI | 说明 | +| --- | --- | --- | --- | --- | +| `audio_overview` | `audio-overview` | `retrieving`, `script_writing`, `voice_generation`, `publishing` | `audio-overview`, `overview` | Create a grounded two-voice audio overview and transcript from a knowledge base. | +| `chat` | `core` | `exploring`, `responding` | `chat` | Agentic chat: an exploring agent loop with tools, followed by a respond stage that streams the answer. | +| `ask_questions` | `core` | `responding` | `ask` | Ask the user high-value questions to fill in missing context, then complete the original request with their answers. | +| `mastery_path` | `mastery` | `responding` | `mastery` | Mastery-based tutoring: a dedicated agent loop drives an adaptive mastery path with a hard, per-type mastery gate and spaced review. | +| `deep_question` | `questions` | `ideation`, `generation` | `quiz` | Fast question generation (Template batches -> Generate). | +| `immersive_reading` | `reading` | `responding` | `reading`, `read` | Read a document alongside the assistant, which cites the exact page or section behind every claim. | +| `math_animator` | `renderer-manim` | `concept_analysis`, `concept_design`, `code_generation`, `code_retry`, `summary`, `render_output` | `animate` | Generate math animations or storyboard images with Manim. | +| `deep_research` | `research` | `rephrasing`, `decomposing`, `researching`, `reporting` | `research` | Agentic-loop deep research with iterative report generation. | +| `deep_solve` | `solve` | `responding` | `solve` | Multi-step problem solving driven by the chat agent loop. | +| `video_lesson` | `video-lesson` | `code_generation`, `render_check`, `render_output` | `lesson` | Generate an animated video lesson (Remotion) that plays in the browser. | +| `visualize` | `visualize` | `analyzing`, `generating`, `reviewing`, `concept_analysis`, `concept_design`, `code_generation`, `code_retry`, `summary`, `render_output` | `visualize`, `viz` | Generate a validated visualization with any installed visualizer type, or render a Manim animation/storyboard artifact. | diff --git a/docs/src/content/docs/zh-cn/cli/commands.md b/docs/src/content/docs/zh-cn/developers/reference/cli.md similarity index 96% rename from docs/src/content/docs/zh-cn/cli/commands.md rename to docs/src/content/docs/zh-cn/developers/reference/cli.md index b33117740..b3660bc97 100644 --- a/docs/src/content/docs/zh-cn/cli/commands.md +++ b/docs/src/content/docs/zh-cn/developers/reference/cli.md @@ -4,7 +4,7 @@ description: 常用 deeptutor 命令 —— flag、输出 schema、示例。 quadrant: reference --- -本页列出常用 `deeptutor` 子命令和 flag。交互式 REPL 用法见 [**交互式 REPL**](/zh-cn/cli/chat-repl/)。自动化模式见 [**代理交接**](/zh-cn/cli/agent-handoff/)。 +本页列出常用 `deeptutor` 子命令和 flag。交互式 REPL 用法见 [**交互式 REPL**](/zh-cn/developers/guides/repl/)。自动化模式见 [**代理交接**](/zh-cn/developers/guides/agent-handoff/)。 ## `deeptutor run` —— 单次 capability 执行 @@ -97,7 +97,7 @@ The derivative of sin(x²) is: deeptutor chat [options] ``` -flag 和 `run` 里塑形 turn 的那一组一样:`--session`、`--tool / -t`、`--capability / -c`、`--kb`、`--notebook-ref`、`--history-ref`、`--language / -l`、`--config`、`--config-json`。完整说明见 [**交互式 REPL**](/zh-cn/cli/chat-repl/)。 +flag 和 `run` 里塑形 turn 的那一组一样:`--session`、`--tool / -t`、`--capability / -c`、`--kb`、`--notebook-ref`、`--history-ref`、`--language / -l`、`--config`、`--config-json`。完整说明见 [**交互式 REPL**](/zh-cn/developers/guides/repl/)。 ## `deeptutor init` —— 引导式初始化向导 @@ -397,7 +397,7 @@ deeptutor notebook show --format json ## `deeptutor memory` —— 三层记忆 -DeepTutor 把用户记忆按三层存(深入说明见 [**Memory**](/zh-cn/explore/memory/)): +DeepTutor 把用户记忆按三层存(深入说明见 [**Memory**](/zh-cn/learning-workspace/memory/)): - **L1** —— 每个 surface(chat、notebook、quiz 等)的原始事件轨迹 - **L2** —— 每个 surface 整理过的 markdown 摘要 @@ -447,7 +447,7 @@ deeptutor partner start math-tutor 子命令:`list`、`create`、`start`、`stop`。`create` 会写入 partner config,并尝试启动该 partner。Web UI 是配置 channel schema、assets、tools 和 secrets 的推荐入口;CLI 适合列表、创建、启动和停止。 -Partner 运行在 `data/partners//workspace/` 作用域里。渠道接入说明见 [**Partners 伙伴与渠道**](/zh-cn/partners/)。 +Partner 运行在 `data/partners//workspace/` 作用域里。渠道接入说明见 [**Partners 伙伴与渠道**](/zh-cn/channels/)。 ## `deeptutor config show` @@ -572,7 +572,7 @@ deeptutor book health book_abc123 deeptutor book refresh-fingerprints book_abc123 ``` -Book 是 **Guided Learning** 学习路径的存储层。详见 [**交互式书本**](/zh-cn/explore/book/)。 +Book 是 **Guided Learning** 学习路径的存储层。详见 [**交互式书本**](/zh-cn/learning-workspace/books/)。 ## `deeptutor workspace` —— 内容工作区 @@ -587,7 +587,7 @@ deeptutor workspace set /absolute/path/to/my-folder deeptutor workspace reset ``` -内容工作区是智能体唯一可读的文件夹;它们创建的一切都落在其 `outputs/` 里。`show` 会打印路径、状态和输出安全级别——也就是把执行挡在文件夹其余部分之外的那道边界有多强。在 Docker 与服务器部署下,路径在启动时即固定,`set` 会被拒绝。详见 [**聊天工作区**](/zh-cn/explore/chat-workspace/)。 +内容工作区是智能体唯一可读的文件夹;它们创建的一切都落在其 `outputs/` 里。`show` 会打印路径、状态和输出安全级别——也就是把执行挡在文件夹其余部分之外的那道边界有多强。在 Docker 与服务器部署下,路径在启动时即固定,`set` 会被拒绝。详见 [**聊天工作区**](/zh-cn/learning-workspace/chat/)。 ## 常见输出 schema @@ -631,6 +631,6 @@ class TurnRequest(BaseModel): ## 另见 -- [**交互式 REPL**](/zh-cn/cli/chat-repl/) —— 日常使用 `deeptutor chat` -- [**代理交接**](/zh-cn/cli/agent-handoff/) —— 让 Claude Code / Codex 来驱动 CLI -- [**服务端 API**](/zh-cn/cli/server-api/) —— `deeptutor serve` 暴露的 HTTP / WebSocket 表面 +- [**交互式 REPL**](/zh-cn/developers/guides/repl/) —— 日常使用 `deeptutor chat` +- [**代理交接**](/zh-cn/developers/guides/agent-handoff/) —— 让 Claude Code / Codex 来驱动 CLI +- [**服务端 API**](/zh-cn/developers/reference/http-api/) —— `deeptutor serve` 暴露的 HTTP / WebSocket 表面 diff --git a/docs/src/content/docs/zh-cn/developers/reference/http-api.md b/docs/src/content/docs/zh-cn/developers/reference/http-api.md new file mode 100644 index 000000000..8a1ac4200 --- /dev/null +++ b/docs/src/content/docs/zh-cn/developers/reference/http-api.md @@ -0,0 +1,1404 @@ +--- +title: HTTP API +description: deeptutor serve 暴露的 HTTP 和 WebSocket 表面 —— 用于自定义前端和集成。 +quadrant: reference +--- + +`deeptutor serve` 在 `http://localhost:8001/` 上启动 FastAPI 后端(除非你改了后端端口)。本页是给自定义前端、移动 App 和服务间集成准备的高密度地图。Turn 命令和事件见 [Turn 协议](/zh-cn/developers/reference/turn-protocol/)。 + +要看穷尽且永远最新的 schema,启动服务后打开: + +```text +GET /openapi.json # 完整 OpenAPI 3.1 spec +GET /docs # 交互式 Swagger UI +GET /redoc # 备选的 ReDoc UI +``` + +## 启动服务 + +```bash +# 仅后端。端口取自 data/user/settings/system.json,默认 8001。 +deeptutor serve + +# 给本次进程指定自定义 host/port +deeptutor serve --host 127.0.0.1 --port 18001 + +# 开发模式:Python 文件变动时热重载 +deeptutor serve --reload +``` + +## 鉴权 + +开启鉴权后,多数路由要求 Bearer JWT 或 `dt_token` cookie。登录/初始化可公开,资料/管理受保护;`GET /api/settings/ui` 公开。MarginNote `/sync`、`/heartbeat` 使用 `Authorization: MarginNote :`。 + +```bash +# 登录 +curl -X POST http://localhost:8001/api/auth/login \ + -c cookies.txt \ + -H "Content-Type: application/json" \ + -d '{"username":"alice","password":"..."}' + +# 响应是用户元数据;JWT 写入 dt_token cookie。 + +# 复用 cookie +curl -b cookies.txt http://localhost:8001/api/sessions +``` + +如果鉴权没开,认证依赖就是 no-op,本地单用户请求不需要带 token。 + +## Turn 执行 WebSocket + +```text +WS /ws +``` + +这是 Web UI 在用的统一 turn WebSocket。它对所有 capability 一视同仁,输出的事件和 `deeptutor run --format json` 打印的是同一族。 + +发一个 `type: "start_turn"` 或 `type: "message"` 载荷启动 turn: + +```json +{ + "type": "start_turn", + "protocol_version": "2.0", + "content": "Find d/dx [sin(x^2)]", + "capability": "deep_solve", + "session_id": null, + "tools": ["reason"], + "knowledge_bases": ["math"], + "language": "en", + "config": {}, + "notebook_references": [], + "history_references": [], + "partner_group_references": [], + "attachments": [] +} +``` + +上面只是单轮 turn 的载荷本身。`/ws` 上的每个 client 帧都必须带 `"protocol_version": "2.0"`——`start_turn`、`subscribe_turn`、`cancel_turn`、`ping` 都一样。缺这个字段的帧会先收到 `protocol_error` 事件(`error_code: "unsupported_protocol_version"`),此时还不会对载荷做任何命令模型的校验。 + +`skills` 不是无效字段,而是用来收窄本轮的:它会和当前工作区允许的技能取交集,所以指定了 skill 的 turn 里,`read_skill` 只能看到这几个。省略该字段或传空数组表示继承工作区允许的全部可见 skill。turn 的选择永远不会超出工作区允许的范围。 + +其他 client 类型包括 `subscribe_turn`、`resume_from`、`cancel_turn`、`submit_user_reply`、`regenerate` 等;订阅按 `after_seq` 补帧,终态必收 `done`(失败先 `error`)。 + +典型收到的事件: + +```json +{"type":"stage_start","stage":"responding"} +{"type":"tool_call","content":"rag","metadata":{"args":{"query":"chain rule","kb_name":"math"}}} +{"type":"tool_result","content":"...","metadata":{"tool":"rag"}} +{"type":"content","content":"## Solution\n\nThe derivative..."} +{"type":"stage_end","stage":"responding"} +{"type":"done","session_id":"sess_abc123","turn_id":"turn_xyz789","metadata":{"status":"completed"}} +``` + +## WebSocket 接口 + +```text +WS /ws +WS /ws/books +WS /ws/questions/mimic +WS /ws/questions/generate +WS /ws/questions/judge +WS /ws/knowledge-bases/{kb_name}/progress +WS /ws/mastery-paths +WS /ws/partners/{partner_id} +WS /ws/partner-groups/{group_id} +``` + +旧的 `/api/v1/chat`、`/api/v1/ws` 与各功能的 API-prefixed socket 均已移除。上面是完整的规范 WebSocket namespace;`/ws` 统一处理所有 turn capability、回放、取消、重新生成与 `ask_user` 回复。 + +## Session + +```text +GET /api/sessions 列 session +GET /api/sessions/{session_id} 拿到一个 session + 消息 +PATCH /api/sessions/{session_id} 重命名(body: {"title":"..."}) +DELETE /api/sessions/{session_id} 删除 +PUT /api/sessions/{session_id}/branch-selection +DELETE /api/sessions/{session_id}/messages/{message_id} +POST /api/sessions/{session_id}/quiz-results +``` + +其他会话状态接口: + +```text +GET /api/sessions/{session_id}/ask-hint +PATCH /api/sessions/{session_id}/organization +``` + +## 知识库 + +```text +GET /api/knowledge-bases 列 KB +GET /api/knowledge-bases/{kb_name} KB 信息 +DELETE /api/knowledge-bases/{kb_name} 删除 +POST /api/knowledge-bases 创建 KB +POST /api/knowledge-bases/{kb_name}/upload 添加文档 +POST /api/knowledge-bases/{kb_name}/reindex 重新 embed 文档 +GET /api/knowledge-bases/default 获取默认 KB +PUT /api/knowledge-bases/default/{kb_name} 设置默认 KB +GET /api/knowledge-bases/supported-file-types 支持的上传格式 +GET /api/knowledge-bases/{kb_name}/files 列源文件 +GET /api/knowledge-bases/{kb_name}/files/{filename} 取单个源文件(预览/下载) +GET /api/knowledge-bases/{kb_name}/file-preview-text/{filename} 提取的纯文本预览 +GET /api/knowledge-bases/{kb_name}/progress 索引进度 +WS /ws/knowledge-bases/{kb_name}/progress `task_id` 回放终态;孤立任务 → `knowledge_task_interrupted` +``` + +临时的 KB 搜索目前是通过 RAG 运行时 / tool 路径暴露的,当前 API 里没有专门的 `POST /knowledge/{name}/search` 路由。从 CLI 走,用 `deeptutor kb search `。 + +## Notebook + +```text +GET /api/notebooks +GET /api/notebooks/statistics +POST /api/notebooks +GET /api/notebooks/{notebook_id} +PUT /api/notebooks/{notebook_id} +DELETE /api/notebooks/{notebook_id} +POST /api/notebooks/actions/add-record +POST /api/notebooks/actions/add-record-with-summary +DELETE /api/notebooks/{notebook_id}/records/{record_id} +PUT /api/notebooks/{notebook_id}/records/{record_id} +POST /api/notebooks/{notebook_id}/records/{record_id}/actions/copy +POST /api/notebooks/{notebook_id}/records/{record_id}/actions/move +GET /api/notebooks/{notebook_id}/export +``` + +## Memory + +```text +GET /api/memory/overview +GET /api/memory/doc/{layer}/{key} +PUT /api/memory/doc/{layer}/{key} +POST /api/memory/doc/{layer}/{key}/reset +POST /api/memory/doc/{layer}/{key}/update +POST /api/memory/doc/{layer}/{key}/audit +POST /api/memory/doc/{layer}/{key}/dedup +POST /api/memory/runs/start +GET /api/memory/runs +GET /api/memory/runs/{run_id} +GET /api/memory/runs/{run_id}/events?since=N 绝对 N = last_seen_seq + 1 +POST /api/memory/runs/{run_id}/cancel +POST /api/memory/runs/{run_id}/undo +GET /api/memory/trace/{surface} +DELETE /api/memory/trace/{surface} +GET /api/memory/settings +PUT /api/memory/settings +``` + +层级是 `L2` 和 `L3`;例:`/api/memory/doc/L3/profile` 和 `/api/memory/doc/L2/chat`。 + +## Settings、tools、visualizers 和 system + +```text +GET /api/settings +GET /api/settings/catalog +PUT /api/settings/catalog +POST /api/settings/apply +POST /api/settings/model-capabilities +PUT /api/settings/enabled-tools +GET /api/tools +GET /api/system/status +GET /api/system/memory +GET /api/system/runtime +GET /api/system/update +POST /api/system/update/check +PUT /api/system/update/settings +GET /api/system/update/job +POST /api/system/update +POST /api/system/test/llm +POST /api/system/test/embeddings +POST /api/system/test/search +GET /api/visualizers/list +POST /api/visualizers/bundled/{visualizer_id}/install +POST /api/visualizers/{visualizer_id}/enable +POST /api/visualizers/{visualizer_id}/disable +DELETE /api/visualizers/{visualizer_id} +POST /api/visualizers/import +GET /api/visualizers/{visualizer_id}/assets/{asset_path} +``` + +Provider profile 通过 catalog endpoint 编辑;当前 API 里没有单独的 `/settings/llm` 或 `/settings/embedding` 路由。Capability 走统一 WebSocket / CLI 合约。Visualizer 导入的是声明式浏览器包,不是可执行的后端插件。 + +## Partners Manager + +```text +GET /api/partners +POST /api/partners +GET /api/partners/recent +GET /api/channels/schema/schema +GET /api/partners/tool-options +GET /api/partners/souls +POST /api/partners/souls +GET /api/partners/soul-sources +GET /api/partners/{partner_id} +PATCH /api/partners/{partner_id} +POST /api/partners/{partner_id}/start +POST /api/partners/{partner_id}/stop +DELETE /api/partners/{partner_id} +POST /api/partners/{partner_id}/channels/reload +GET /api/partners/{partner_id}/channels/status +POST /api/partners/{partner_id}/channel-onboarding/start +GET /api/partners/{partner_id}/channel-onboarding/{session_id} +DELETE /api/partners/{partner_id}/channel-onboarding/{session_id} +POST /api/partners/{partner_id}/channel-onboarding/{session_id}/apply +GET /api/partners/{partner_id}/soul +PUT /api/partners/{partner_id}/soul +GET /api/partners/{partner_id}/assets +POST /api/partners/{partner_id}/assets +DELETE /api/partners/{partner_id}/assets/{asset_type}/{name} +GET /api/partners/{partner_id}/history +GET /api/partners/{partner_id}/sessions +POST /api/partners/{partner_id}/sessions/archive +POST /api/partners/{partner_id}/sessions/resume +POST /api/partners/{partner_id}/sessions/delete +POST /api/partners/{partner_id}/sessions/branch +POST /api/partners/{partner_id}/chat +POST /api/partners/{partner_id}/chat/execute-stream +WS /ws/partners/{partner_id} +``` + +已认证用户可创建 Partner。资源路由检查 **use** 或 **manage** 权限;owner/admin 可管理,grant 可仅允许对话。Secret 默认打码,除非可管理调用方请求 `include_secrets=true`。 + +## Book Engine + +```text +GET /api/books +POST /api/books +GET /api/books/block-types 可生成的内容类型 +GET /api/books/{book_id} +GET /api/books/{book_id}/spine +GET /api/books/{book_id}/pages/{page_id} +DELETE /api/books/{book_id} +POST /api/books/confirm-proposal +POST /api/books/confirm-spine +POST /api/books/compile-page +POST /api/books/pause 先持久化、取消工作、保留已完成页 +POST /api/books/resume 只排入未完成页 +POST /api/books/{book_id}/refresh-fingerprints +WS /ws/books 订阅传 `after_seq`;可能先确认 reset +``` + +## 沉浸式阅读 + +```text +GET /api/reading/supported-formats 支持的扩展名、体积上限、可原样查看的格式 +GET /api/reading/materials 列出本账号的素材 +POST /api/reading/materials 上传文档(multipart) +GET /api/reading/materials/{material_id} 清单:单元类型、单元数量、大纲 +DELETE /api/reading/materials/{material_id} 忘掉某份素材 +GET /api/reading/materials/{material_id}/units/{locator} 单个单元的文本 +GET /api/reading/materials/{material_id}/revisions 之前不可变的 URL 快照 +GET /api/reading/materials/{material_id}/revisions/{revision}/units/{locator} +GET /api/reading/materials/{material_id}/raw 原始字节(PDF) +GET /api/reading/materials/{material_id}/assets/{asset_name} 经鉴权的快照图片 +GET /api/reading/materials/{material_id}/bookmarks 列出书签 +POST /api/reading/materials/{material_id}/bookmarks 保存书签 +DELETE /api/reading/materials/{material_id}/bookmarks/{bookmark_id} +GET /api/reading/materials/{material_id}/annotations 列出批注 +PUT /api/reading/materials/{material_id}/annotations 创建或更新一条;返回 AnnotationInfo +DELETE /api/reading/materials/{material_id}/annotations/{id} 删除一条 +GET /api/reading/materials/{material_id}/export?fmt=auto|pdf|markdown +``` + +素材以内容寻址:同样的字节上传两次会拿到同一个 `material_id`,上面已有的批注也都还在。`export?fmt=pdf` 返回写入了真正 PDF 批注的原文件,仅对保留了原始字节的素材可用。 + +URL 刷新会保留不可变的旧 revision。快照 asset 需要鉴权、经过 MIME sniff,并带 `nosniff` 返回,不会在阅读器中直接暴露实时第三方页面。 + +## 沉浸式观看 + +```text +GET /api/settings/video-learning +PUT /api/settings/video-learning +POST /api/settings/video-learning/test-invidious +POST /api/video-learning/materials/resolve +GET /api/video-learning/materials/{material_id} +PUT /api/video-learning/materials/{material_id}/progress +GET /api/video-learning/materials/{material_id}/subtitles.vtt +GET|HEAD /api/video-learning/materials/{material_id}/stream/{format_id} +``` + +这些兼容端点保留 YouTube 播放、转录字幕与独立于 provider 的进度。当前视频会话使用 Reading,旧 Watching 会话重开时迁移。Resolve 接收 URL 及可选语言 / provider;VTT 返回归一化字幕。 + +## 其余路由 + +上面并未逐一展开所有接口。以下这些同样存在、遵循同样的约定,其 schema 请查 `/openapi.json`: + +```text +/api/skills 技能库与 hub 安装 +/api/personas 人设预设 +/api/plugins 托管插件生命周期与审批 +/api/learning-journal 工作区目标、交接与已确认记录 +/api/documents 协同写作文档与编辑流 +/api/mastery-paths 掌握路径、目标与进度 +/api/subagents 已连接智能体的配置 +/api/imports Claude Code / Codex 对话导入 +/api/space/mcp 按账号的 MCP 服务与精选目录 +/api/space/cli-apps CLI 应用目录、安装与授权 +/api/voice 语音合成与语音识别 +/api/dashboard 最近活动、起始建议/刷新与活动详情 +``` + +## 输出和附件 + +产物通过认证路由提供: + +```text +GET /files/outputs/ +``` + +仅解析调用者或单个可见 Partner 的 allowlist 文件;非法、私有、穿越路径均失败。附件挂在: + +```text +GET /files/attachments/{session_id}/{attachment_id}/{filename} +``` + +## 生成 typed client + +```bash +curl http://localhost:8001/openapi.json > deeptutor.openapi.json + +# TypeScript client +npx openapi-typescript deeptutor.openapi.json -o deeptutor.d.ts + +# Python client +pip install openapi-python-client +openapi-python-client generate --path deeptutor.openapi.json +``` + + + +## 路由索引 + +下面的表由 `deeptutor/modules/manifests/*.json` 与 `deeptutor/api/router_index.json` 生成。路径是挂载前缀加上路由模板。字段和请求体以运行中的 `GET /openapi.json` 为准。 + +### books + +#### `book:router` — `/api` · learning + +| 方法 | 路径 | +| --- | --- | +| `GET` | `/api/books/health` | +| `GET` | `/api/books/estimate-basis` | +| `GET` | `/api/books/block-types` | +| `GET` | `/api/books` | +| `GET` | `/api/books/{book_id}/learning-captures` | +| `POST` | `/api/books/{book_id}/learning-captures` | +| `PATCH` | `/api/books/{book_id}/learning-captures/{capture_id}` | +| `GET` | `/api/books/{book_id}` | +| `GET` | `/api/books/{book_id}/spine` | +| `GET` | `/api/books/{book_id}/pages/{page_id}` | +| `DELETE` | `/api/books/{book_id}` | +| `POST` | `/api/books` | +| `POST` | `/api/books/confirm-proposal` | +| `POST` | `/api/books/confirm-spine` | +| `POST` | `/api/books/compile-page` | +| `POST` | `/api/books/regenerate-block` | +| `POST` | `/api/books/insert-block` | +| `POST` | `/api/books/delete-block` | +| `POST` | `/api/books/move-block` | +| `POST` | `/api/books/change-block-type` | +| `POST` | `/api/books/{book_id}/chapters` | +| `PATCH` | `/api/books/{book_id}/chapters/{chapter_id}` | +| `DELETE` | `/api/books/{book_id}/chapters/{chapter_id}` | +| `POST` | `/api/books/{book_id}/chapters/{chapter_id}/move` | +| `POST` | `/api/books/deep-dive` | +| `POST` | `/api/books/quiz-attempt` | +| `POST` | `/api/books/update-block` | +| `POST` | `/api/books/progress/visit` | +| `POST` | `/api/books/progress/bookmark` | +| `GET` | `/api/books/{book_id}/export` | +| `GET` | `/api/books/{book_id}/health` | +| `POST` | `/api/books/{book_id}/refresh-fingerprints` | +| `POST` | `/api/books/supplement` | +| `POST` | `/api/books/page-chat-session` | +| `POST` | `/api/books/resume` | +| `POST` | `/api/books/pause` | +| `POST` | `/api/books/rebuild` | +| `POST` | `/api/books/{book_id}/edits/preview` | +| `GET` | `/api/books/{book_id}/edits` | +| `POST` | `/api/books/{book_id}/edits/{edit_id}/apply` | +| `POST` | `/api/books/{book_id}/edits/{edit_id}/undo` | + +#### `book:ws_router` — `/ws` · public + +| 方法 | 路径 | +| --- | --- | +| `WS` | `/ws/books` | + +### calendar + +#### `calendar:router` — `/api/calendar` · learning + +| 方法 | 路径 | +| --- | --- | +| `GET` | `/api/calendar/export.ics` | +| `GET` | `/api/calendar/calendars` | +| `POST` | `/api/calendar/calendars` | +| `PATCH` | `/api/calendar/calendars/{id}` | +| `DELETE` | `/api/calendar/calendars/{id}` | +| `GET` | `/api/calendar/events` | +| `POST` | `/api/calendar/events` | +| `PATCH` | `/api/calendar/events/{id}` | +| `DELETE` | `/api/calendar/events/{id}` | +| `POST` | `/api/calendar/undo/{token}` | +| `GET` | `/api/calendar/search` | +| `GET` | `/api/calendar/layers` | +| `DELETE` | `/api/calendar/automations/{job_id}` | +| `GET` | `/api/calendar/stream` | +| `GET` | `/api/calendar/task-blocks` | + +### co-writer + +#### `co_writer:router` — `/api` · learning + +| 方法 | 路径 | +| --- | --- | +| `POST` | `/api/documents/actions/edit` | +| `POST` | `/api/documents/actions/edit-react` | +| `POST` | `/api/documents/actions/edit-react/stream` | +| `POST` | `/api/documents/actions/automark` | +| `GET` | `/api/documents/history` | +| `GET` | `/api/documents/history/{operation_id}` | +| `GET` | `/api/documents/tool-calls/{operation_id}` | +| `GET` | `/api/documents` | +| `POST` | `/api/documents` | +| `POST` | `/api/documents/import/docx` | +| `POST` | `/api/documents/export/docx` | +| `GET` | `/api/documents/flashcards/export` | +| `GET` | `/api/documents/{doc_id}` | +| `PUT` | `/api/documents/{doc_id}` | +| `DELETE` | `/api/documents/{doc_id}` | +| `GET` | `/api/documents/{doc_id}/suggestions` | +| `POST` | `/api/documents/{doc_id}/suggestions/{suggestion_id}` | +| `GET` | `/api/documents/{doc_id}/backlinks` | +| `POST` | `/api/documents/{doc_id}/assets` | +| `GET` | `/api/documents/{doc_id}/assets/{name}` | +| `POST` | `/api/documents/{doc_id}/clips` | +| `GET` | `/api/documents/review/due` | +| `GET` | `/api/documents/{doc_id}/flashcards/export` | +| `POST` | `/api/documents/{doc_id}/review` | +| `POST` | `/api/documents/{doc_id}/suggestions` | +| `GET` | `/api/documents/{doc_id}/threads` | +| `POST` | `/api/documents/{doc_id}/threads` | +| `DELETE` | `/api/documents/{doc_id}/threads/{session_id}` | + +### knowledge + +#### `knowledge:router` — `/api` · learning + +| 方法 | 路径 | +| --- | --- | +| `GET` | `/api/knowledge-bases/health` | +| `GET` | `/api/knowledge-bases/rag-providers` | +| `PUT` | `/api/knowledge-bases/rag-providers/{provider}/mode` | +| `GET` | `/api/knowledge-bases/rag-pipelines/pageindex/config` | +| `PUT` | `/api/knowledge-bases/rag-pipelines/pageindex/config` | +| `GET` | `/api/knowledge-bases/rag-pipelines/ima/config` | +| `PUT` | `/api/knowledge-bases/rag-pipelines/ima/config` | +| `GET` | `/api/knowledge-bases/rag-pipelines/llamaindex/config` | +| `PUT` | `/api/knowledge-bases/rag-pipelines/llamaindex/config` | +| `GET` | `/api/knowledge-bases/rag-pipelines/graphrag/config` | +| `PUT` | `/api/knowledge-bases/rag-pipelines/graphrag/config` | +| `GET` | `/api/knowledge-bases/rag-pipelines/lightrag/config` | +| `GET` | `/api/knowledge-bases/rag-pipelines/lightrag/model-options` | +| `PUT` | `/api/knowledge-bases/rag-pipelines/lightrag/config` | +| `GET` | `/api/knowledge-bases/rag-pipelines/lightrag-server/config` | +| `PUT` | `/api/knowledge-bases/rag-pipelines/lightrag-server/config` | +| `GET` | `/api/knowledge-bases/rag-pipelines/{provider}/preflight` | +| `GET` | `/api/knowledge-bases/rag-pipelines/model-options` | +| `GET` | `/api/knowledge-bases/embedding-usage` | +| `POST` | `/api/knowledge-bases/rag-pipelines/graphrag/model-compatibility` | +| `PUT` | `/api/knowledge-bases/rag-pipelines/active-model` | +| `GET` | `/api/knowledge-bases/supported-file-types` | +| `GET` | `/api/knowledge-bases/configs` | +| `GET` | `/api/knowledge-bases/{kb_name}/config` | +| `PUT` | `/api/knowledge-bases/{kb_name}/config` | +| `POST` | `/api/knowledge-bases/configs/sync` | +| `GET` | `/api/knowledge-bases/default` | +| `PUT` | `/api/knowledge-bases/default/{kb_name}` | +| `POST` | `/api/knowledge-bases/connect-obsidian` | +| `POST` | `/api/knowledge-bases/connect-marginnote4` | +| `POST` | `/api/knowledge-bases/probe-folder` | +| `POST` | `/api/knowledge-bases/connect-folder` | +| `POST` | `/api/knowledge-bases/probe-lightrag-server` | +| `POST` | `/api/knowledge-bases/connect-lightrag-server` | +| `POST` | `/api/knowledge-bases/probe-weknora` | +| `POST` | `/api/knowledge-bases/connect-weknora` | +| `POST` | `/api/knowledge-bases/list-ima` | +| `GET` | `/api/knowledge-bases/kiwix-catalog` | +| `POST` | `/api/knowledge-bases/probe-kiwix` | +| `POST` | `/api/knowledge-bases/connect-kiwix` | +| `GET` | `/api/knowledge-bases/kiwix-articles` | +| `POST` | `/api/knowledge-bases/probe-ima` | +| `POST` | `/api/knowledge-bases/connect-ima` | +| `GET` | `/api/knowledge-bases` | +| `GET` | `/api/knowledge-bases/list` | +| `GET` | `/api/knowledge-bases/{kb_name}` | +| `GET` | `/api/knowledge-bases/{kb_name}/files` | +| `POST` | `/api/knowledge-bases/{kb_name}/folders` | +| `POST` | `/api/knowledge-bases/{kb_name}/files/move` | +| `GET` | `/api/knowledge-bases/{kb_name}/file-preview-text/{filename:path}` | +| `GET` | `/api/knowledge-bases/{kb_name}/files/{filename:path}` | +| `GET` | `/api/knowledge-bases/{kb_name}/visual-assets/{asset_id}` | +| `GET` | `/api/knowledge-bases/{kb_name}/visual-coverage` | +| `GET` | `/api/knowledge-bases/{kb_name}/source-page` | +| `DELETE` | `/api/knowledge-bases/{kb_name}/files/{filename:path}` | +| `POST` | `/api/knowledge-bases/delete` | +| `DELETE` | `/api/knowledge-bases/{kb_name}` | +| `GET` | `/api/knowledge-bases/tasks/{task_id}/stream` | +| `POST` | `/api/knowledge-bases/{kb_name}/upload` | +| `POST` | `/api/knowledge-bases` | +| `GET` | `/api/knowledge-bases/{kb_name}/reindex-config` | +| `POST` | `/api/knowledge-bases/{kb_name}/reindex` | +| `PUT` | `/api/knowledge-bases/{kb_name}/indexing-policy` | +| `POST` | `/api/knowledge-bases/{kb_name}/retry` | +| `GET` | `/api/knowledge-bases/{kb_name}/indexing-run` | +| `POST` | `/api/knowledge-bases/{kb_name}/indexing-run/{task_id}/cancel` | +| `GET` | `/api/knowledge-bases/{kb_name}/indexing-readiness` | +| `GET` | `/api/knowledge-bases/{kb_name}/progress` | +| `POST` | `/api/knowledge-bases/{kb_name}/progress/clear` | +| `POST` | `/api/knowledge-bases/{kb_name}/link-folder` | +| `GET` | `/api/knowledge-bases/{kb_name}/linked-folders` | +| `DELETE` | `/api/knowledge-bases/{kb_name}/linked-folders/{folder_id}` | +| `POST` | `/api/knowledge-bases/{kb_name}/sync-folder/{folder_id}` | +| `POST` | `/api/knowledge-bases/{kb_name}/github-source` | +| `GET` | `/api/knowledge-bases/{kb_name}/github-sources` | +| `DELETE` | `/api/knowledge-bases/{kb_name}/github-source/{source_id}` | +| `POST` | `/api/knowledge-bases/{kb_name}/sync-github` | +| `POST` | `/api/knowledge-bases/{kb_name}/web-source` | +| `GET` | `/api/knowledge-bases/{kb_name}/web-sources` | +| `DELETE` | `/api/knowledge-bases/{kb_name}/web-source/{source_id}` | +| `GET` | `/api/knowledge-bases/{kb_name}/web-source-sync` | +| `GET` | `/api/knowledge-bases/{kb_name}/web-source/{source_id}/pairings` | +| `PUT` | `/api/knowledge-bases/{kb_name}/web-source/{source_id}/schedule` | +| `POST` | `/api/knowledge-bases/{kb_name}/web-source/{source_id}/cancel` | +| `POST` | `/api/knowledge-bases/{kb_name}/web-source/{source_id}/retry` | +| `POST` | `/api/knowledge-bases/{kb_name}/sync-web` | + +#### `marginnote4:router` — `/api/marginnote4` · public + +| 方法 | 路径 | +| --- | --- | +| `POST` | `/api/marginnote4/pair` | +| `GET` | `/api/marginnote4/devices` | +| `DELETE` | `/api/marginnote4/devices/{device_id}` | +| `GET` | `/api/marginnote4/status` | +| `POST` | `/api/marginnote4/sync` | +| `POST` | `/api/marginnote4/heartbeat` | + +#### `knowledge:ws_router` — `/ws` · public + +| 方法 | 路径 | +| --- | --- | +| `WS` | `/ws/knowledge-bases/{kb_name}/progress` | + +### mastery + +#### `mastery_path:router` — `/api/mastery-paths` · learning + +| 方法 | 路径 | +| --- | --- | +| `GET` | `/api/mastery-paths/topics` | +| `GET` | `/api/mastery-paths/topics/index` | +| `GET` | `/api/mastery-paths/reading/records` | +| `POST` | `/api/mastery-paths/topics/draft` | +| `POST` | `/api/mastery-paths/topics` | +| `GET` | `/api/mastery-paths/topics/{path_id}` | +| `GET` | `/api/mastery-paths/topics/{path_id}/review-settings` | +| `PUT` | `/api/mastery-paths/topics/{path_id}/review-settings` | +| `GET` | `/api/mastery-paths/review-strategies` | +| `POST` | `/api/mastery-paths/review-strategies` | +| `GET` | `/api/mastery-paths/review-strategies/{template_id}` | +| `PUT` | `/api/mastery-paths/review-strategies/{template_id}` | +| `POST` | `/api/mastery-paths/review-strategies/{template_id}/duplicate` | +| `DELETE` | `/api/mastery-paths/review-strategies/{template_id}` | +| `PUT` | `/api/mastery-paths/topics/{path_id}/review-strategy` | +| `PUT` | `/api/mastery-paths/topics/{path_id}/map` | +| `POST` | `/api/mastery-paths/topics/{path_id}/objectives/{kp_id}/override` | +| `GET` | `/api/mastery-paths/topics/{path_id}/sessions` | +| `PUT` | `/api/mastery-paths/topics/{path_id}/sessions/{session_id}/mode` | +| `GET` | `/api/mastery-paths/topics/{path_id}/ask-hint` | +| `GET` | `/api/mastery-paths/progress` | +| `GET` | `/api/mastery-paths/progress/{book_id}` | +| `GET` | `/api/mastery-paths/progress/{book_id}/map` | +| `GET` | `/api/mastery-paths/progress/{book_id}/board` | +| `GET` | `/api/mastery-paths/progress/{book_id}/objectives/{kp_id}` | +| `GET` | `/api/mastery-paths/progress/{book_id}/events` | +| `GET` | `/api/mastery-paths/progress/{book_id}/sessions` | +| `POST` | `/api/mastery-paths/progress/{book_id}/init-modules` | +| `POST` | `/api/mastery-paths/progress/{book_id}/import-from-book` | +| `PATCH` | `/api/mastery-paths/progress/{book_id}` | +| `DELETE` | `/api/mastery-paths/progress/{book_id}` | +| `POST` | `/api/mastery-paths/progress/{book_id}/skip-question` | +| `POST` | `/api/mastery-paths/progress/{book_id}/redo` | +| `POST` | `/api/mastery-paths/progress/{book_id}/generate-from-notebook` | +| `POST` | `/api/mastery-paths/progress/{book_id}/generate-from-reading` | + +#### `mastery_path:ws_router` — `/ws` · public + +| 方法 | 路径 | +| --- | --- | +| `WS` | `/ws/mastery-paths` | + +### memory + +#### `memory:router` — `/api/memory` · learning + +| 方法 | 路径 | +| --- | --- | +| `GET` | `/api/memory/overview` | +| `GET` | `/api/memory/resolve_entry/{entry_id}` | +| `GET` | `/api/memory/backup` | +| `GET` | `/api/memory/doc/{layer}/{key}` | +| `PUT` | `/api/memory/doc/{layer}/{key}` | +| `DELETE` | `/api/memory/doc/{layer}/{key}/entry/{entry_id}` | +| `POST` | `/api/memory/doc/{layer}/{key}/reset` | +| `POST` | `/api/memory/runs/start` | +| `GET` | `/api/memory/runs/{run_id}` | +| `POST` | `/api/memory/runs/{run_id}/cancel` | +| `POST` | `/api/memory/runs/{run_id}/undo` | +| `GET` | `/api/memory/runs` | +| `GET` | `/api/memory/runs/{run_id}/events` | +| `POST` | `/api/memory/doc/{layer}/{key}/update` | +| `POST` | `/api/memory/doc/{layer}/{key}/audit` | +| `POST` | `/api/memory/doc/{layer}/{key}/dedup` | +| `GET` | `/api/memory/doc/{layer}/{key}/lines` | +| `GET` | `/api/memory/settings` | +| `PUT` | `/api/memory/settings` | +| `POST` | `/api/memory/doc/{layer}/{key}/apply` | +| `GET` | `/api/memory/trace/{surface}` | +| `DELETE` | `/api/memory/trace/{surface}` | +| `DELETE` | `/api/memory/trace/{surface}/day/{day}` | +| `GET` | `/api/memory/snapshot/{surface}` | +| `POST` | `/api/memory/snapshot/{surface}/refresh` | +| `GET` | `/api/memory/snapshot/{surface}/changes` | +| `DELETE` | `/api/memory/snapshot/{surface}/changes` | + +### notebook + +#### `notebook:router` — `/api` · learning + +| 方法 | 路径 | +| --- | --- | +| `GET` | `/api/notebooks/health` | +| `GET` | `/api/notebooks` | +| `GET` | `/api/notebooks/statistics` | +| `POST` | `/api/notebooks` | +| `GET` | `/api/notebooks/{notebook_id}` | +| `PUT` | `/api/notebooks/{notebook_id}` | +| `DELETE` | `/api/notebooks/{notebook_id}` | +| `POST` | `/api/notebooks/actions/add-record` | +| `POST` | `/api/notebooks/actions/add-record-with-summary` | +| `DELETE` | `/api/notebooks/{notebook_id}/records/{record_id}` | +| `GET` | `/api/notebooks/records/{record_id}/location` | +| `PUT` | `/api/notebooks/{notebook_id}/records/{record_id}` | +| `POST` | `/api/notebooks/{notebook_id}/records/{record_id}/actions/copy` | +| `POST` | `/api/notebooks/{notebook_id}/records/{record_id}/actions/move` | +| `GET` | `/api/notebooks/{notebook_id}/export` | + +### partners + +#### `partner_groups:router` — `/api/partner-groups` · learning + +| 方法 | 路径 | +| --- | --- | +| `GET` | `/api/partner-groups` | +| `GET` | `/api/partner-groups/discussion-modes` | +| `GET` | `/api/partner-groups/shared-memory-types` | +| `POST` | `/api/partner-groups` | +| `GET` | `/api/partner-groups/{group_id}` | +| `PATCH` | `/api/partner-groups/{group_id}` | +| `DELETE` | `/api/partner-groups/{group_id}` | +| `GET` | `/api/partner-groups/{group_id}/history` | +| `GET` | `/api/partner-groups/{group_id}/sessions` | +| `POST` | `/api/partner-groups/{group_id}/sessions` | +| `DELETE` | `/api/partner-groups/{group_id}/sessions/{session_key}` | +| `GET` | `/api/partner-groups/{group_id}/whiteboard` | +| `POST` | `/api/partner-groups/{group_id}/whiteboard/pins` | +| `DELETE` | `/api/partner-groups/{group_id}/whiteboard/pins/{event_id}` | +| `GET` | `/api/partner-groups/{group_id}/invocations` | +| `POST` | `/api/partner-groups/{group_id}/invocations` | +| `POST` | `/api/partner-groups/{group_id}/messages` | +| `POST` | `/api/partner-groups/{group_id}/turns/{turn_id}/partners/{partner_id}/retry` | +| `POST` | `/api/partner-groups/{group_id}/rounds/{turn_id}/summary` | +| `POST` | `/api/partner-groups/{group_id}/invocations/{invocation_id}/approve` | +| `POST` | `/api/partner-groups/{group_id}/invocations/{invocation_id}/reject` | + +#### `partners:router` — `/api/partners` · learning + +| 方法 | 路径 | +| --- | --- | +| `GET` | `/api/partners/souls` | +| `POST` | `/api/partners/souls` | +| `GET` | `/api/partners/souls/{soul_id}` | +| `PUT` | `/api/partners/souls/{soul_id}` | +| `DELETE` | `/api/partners/souls/{soul_id}` | +| `GET` | `/api/partners/soul-sources` | +| `GET` | `/api/partners` | +| `GET` | `/api/partners/navigation` | +| `GET` | `/api/partners/consultation-session` | +| `GET` | `/api/partners/recent` | +| `GET` | `/api/partners/channels/schema` | +| `POST` | `/api/partners/{partner_id}/channels/weixin/qr` | +| `GET` | `/api/partners/{partner_id}/channels/weixin/qr/{session_id}` | +| `GET` | `/api/partners/tool-options` | +| `POST` | `/api/partners` | +| `GET` | `/api/partners/drafts/{draft_id}` | +| `POST` | `/api/partners/drafts/{draft_id}/confirm` | +| `GET` | `/api/partners/{partner_id}` | +| `PATCH` | `/api/partners/{partner_id}` | +| `POST` | `/api/partners/{partner_id}/start` | +| `POST` | `/api/partners/{partner_id}/stop` | +| `DELETE` | `/api/partners/{partner_id}` | +| `POST` | `/api/partners/{partner_id}/channels/reload` | +| `GET` | `/api/partners/{partner_id}/channels/status` | +| `POST` | `/api/partners/{partner_id}/channel-onboarding/start` | +| `GET` | `/api/partners/{partner_id}/channel-onboarding/{session_id}` | +| `DELETE` | `/api/partners/{partner_id}/channel-onboarding/{session_id}` | +| `POST` | `/api/partners/{partner_id}/channel-onboarding/{session_id}/apply` | +| `GET` | `/api/partners/{partner_id}/soul` | +| `PUT` | `/api/partners/{partner_id}/soul` | +| `GET` | `/api/partners/{partner_id}/workspaces` | +| `GET` | `/api/partners/{partner_id}/assets` | +| `POST` | `/api/partners/{partner_id}/assets` | +| `DELETE` | `/api/partners/{partner_id}/assets/{asset_type}/{name}` | +| `POST` | `/api/partners/{partner_id}/links/code` | +| `GET` | `/api/partners/{partner_id}/links` | +| `DELETE` | `/api/partners/{partner_id}/links/{key:path}` | +| `GET` | `/api/partners/{partner_id}/history` | +| `GET` | `/api/partners/{partner_id}/history/page` | +| `GET` | `/api/partners/{partner_id}/web-continuity` | +| `PUT` | `/api/partners/{partner_id}/web-continuity` | +| `GET` | `/api/partners/{partner_id}/sessions` | +| `POST` | `/api/partners/{partner_id}/sessions/archive` | +| `POST` | `/api/partners/{partner_id}/sessions/resume` | +| `POST` | `/api/partners/{partner_id}/sessions/delete` | +| `POST` | `/api/partners/{partner_id}/sessions/branch` | +| `GET` | `/api/partners/commands/palette` | +| `POST` | `/api/partners/{partner_id}/chat` | +| `POST` | `/api/partners/{partner_id}/chat/execute-stream` | + +#### `partner_groups:ws_router` — `/ws/partner-groups` · public + +| 方法 | 路径 | +| --- | --- | +| `WS` | `/ws/partner-groups/{group_id}` | + +#### `partners:ws_router` — `/ws/partners` · public + +| 方法 | 路径 | +| --- | --- | +| `WS` | `/ws/partners/{partner_id}` | + +### questions + +#### `question:router` — `/api/question` · learning + +| 方法 | 路径 | +| --- | --- | + +#### `question_notebook:router` — `/api/question-notebook` · learning + +| 方法 | 路径 | +| --- | --- | +| `POST` | `/api/question-notebook/entries/upsert` | +| `GET` | `/api/question-notebook/entries` | +| `GET` | `/api/question-notebook/entries/lookup/by-question` | +| `GET` | `/api/question-notebook/entries/{entry_id}` | +| `PATCH` | `/api/question-notebook/entries/{entry_id}` | +| `DELETE` | `/api/question-notebook/entries/{entry_id}` | +| `POST` | `/api/question-notebook/entries/categories/bulk` | +| `POST` | `/api/question-notebook/entries/{entry_id}/categories` | +| `DELETE` | `/api/question-notebook/entries/{entry_id}/categories/{category_id}` | +| `GET` | `/api/question-notebook/stats` | +| `GET` | `/api/question-notebook/materials` | +| `GET` | `/api/question-notebook/categories` | +| `POST` | `/api/question-notebook/categories` | +| `PATCH` | `/api/question-notebook/categories/{category_id}` | +| `DELETE` | `/api/question-notebook/categories/{category_id}` | + +#### `practice:router` — `/api/question-notebook/practice` · learning + +| 方法 | 路径 | +| --- | --- | +| `GET` | `/api/question-notebook/practice/summary` | +| `GET` | `/api/question-notebook/practice/queue` | +| `GET` | `/api/question-notebook/practice/analytics` | +| `GET` | `/api/question-notebook/practice/questions/{entry_id}` | +| `POST` | `/api/question-notebook/practice/questions/{entry_id}/check` | +| `POST` | `/api/question-notebook/practice/questions/{entry_id}/review` | +| `GET` | `/api/question-notebook/practice/import/template` | +| `POST` | `/api/question-notebook/practice/import/preview` | +| `POST` | `/api/question-notebook/practice/import/commit` | + +#### `question:ws_router` — `/ws/questions` · public + +| 方法 | 路径 | +| --- | --- | +| `WS` | `/ws/questions/mimic` | +| `WS` | `/ws/questions/generate` | + +### reading + +#### `reading:router` — `/api/reading` · learning + +| 方法 | 路径 | +| --- | --- | +| `GET` | `/api/reading/library/materials` | +| `POST` | `/api/reading/library/duplicate-check` | +| `POST` | `/api/reading/library/import-urls` | +| `POST` | `/api/reading/library/import-zim-article` | +| `POST` | `/api/reading/materials/{material_id}/retry` | +| `GET` | `/api/reading/workspaces` | +| `GET` | `/api/reading/workspaces/index` | +| `POST` | `/api/reading/workspaces` | +| `GET` | `/api/reading/workspaces/{workspace_id}` | +| `GET` | `/api/reading/workspaces/{workspace_id}/ask-hint` | +| `PATCH` | `/api/reading/workspaces/{workspace_id}` | +| `DELETE` | `/api/reading/workspaces/{workspace_id}` | +| `POST` | `/api/reading/workspaces/{workspace_id}/materials` | +| `PUT` | `/api/reading/workspaces/{workspace_id}/materials/order` | +| `PUT` | `/api/reading/workspaces/{workspace_id}/materials/{material_id}/active` | +| `DELETE` | `/api/reading/workspaces/{workspace_id}/materials/{material_id}` | +| `GET` | `/api/reading/workspaces/{workspace_id}/sessions` | +| `POST` | `/api/reading/workspaces/{workspace_id}/sessions` | +| `PATCH` | `/api/reading/workspaces/{workspace_id}/sessions/{session_id}` | +| `DELETE` | `/api/reading/workspaces/{workspace_id}/sessions/{session_id}` | +| `POST` | `/api/reading/workspaces/{workspace_id}/sessions/{session_id}/links` | +| `DELETE` | `/api/reading/workspaces/{workspace_id}/sessions/{session_id}/links/{target_session_id}` | +| `POST` | `/api/reading/workspaces/{workspace_id}/notes/organize` | +| `POST` | `/api/reading/workspaces/{workspace_id}/notebook` | +| `GET` | `/api/reading/supported-formats` | +| `GET` | `/api/reading/materials` | +| `POST` | `/api/reading/materials` | +| `GET` | `/api/reading/materials/{material_id}` | +| `GET` | `/api/reading/materials/{material_id}/epub-pairing-candidates` | +| `GET` | `/api/reading/epub-pairings` | +| `POST` | `/api/reading/epub-pairings` | +| `DELETE` | `/api/reading/epub-pairings/{pairing_id}` | +| `DELETE` | `/api/reading/materials/{material_id}` | +| `GET` | `/api/reading/materials/{material_id}/transcript` | +| `GET` | `/api/reading/materials/{material_id}/units/{locator}` | +| `GET` | `/api/reading/materials/{material_id}/revisions` | +| `GET` | `/api/reading/materials/{material_id}/revisions/{revision}/units/{locator}` | +| `GET` | `/api/reading/materials/{material_id}/raw` | +| `GET` | `/api/reading/materials/{material_id}/render` | +| `GET` | `/api/reading/materials/{material_id}/assets/{asset_name}` | +| `GET` | `/api/reading/materials/{material_id}/media` | +| `GET` | `/api/reading/materials/{material_id}/media/{name}` | +| `GET` | `/api/reading/materials/{material_id}/annotations` | +| `GET` | `/api/reading/materials/{material_id}/position` | +| `PUT` | `/api/reading/materials/{material_id}/position` | +| `GET` | `/api/reading/materials/{material_id}/bookmarks` | +| `POST` | `/api/reading/materials/{material_id}/bookmarks` | +| `DELETE` | `/api/reading/materials/{material_id}/bookmarks/{bookmark_id}` | +| `PUT` | `/api/reading/materials/{material_id}/annotations` | +| `DELETE` | `/api/reading/materials/{material_id}/annotations/{annotation_id}` | +| `GET` | `/api/reading/materials/{material_id}/export` | + +#### `reading_extensions:router` — `/api/reading` · learning + +| 方法 | 路径 | +| --- | --- | +| `GET` | `/api/reading/extensions` | +| `POST` | `/api/reading/materials/{material_id}/read-aloud` | +| `POST` | `/api/reading/materials/{material_id}/extensions/{extension_id}/actions/{action}` | +| `POST` | `/api/reading/materials/{material_id}/extensions/quiz/answers` | +| `GET` | `/api/reading/materials/{material_id}/quiz/rewards` | + +#### `video_learning:settings_router` — `/api/settings/video-learning` · admin + +| 方法 | 路径 | +| --- | --- | +| `GET` | `/api/settings/video-learning` | +| `PUT` | `/api/settings/video-learning` | +| `POST` | `/api/settings/video-learning/test-invidious` | + +#### `video_learning:router` — `/api/video-learning` · learning + +| 方法 | 路径 | +| --- | --- | +| `POST` | `/api/video-learning/invidious/account/authorize` | +| `GET` | `/api/video-learning/invidious/account/callback` | +| `GET` | `/api/video-learning/invidious/browse/{kind}` | +| `GET` | `/api/video-learning/invidious/account/status` | +| `POST` | `/api/video-learning/invidious/account/disconnect` | +| `POST` | `/api/video-learning/materials/resolve` | +| `GET` | `/api/video-learning/materials/{material_id}` | +| `POST` | `/api/video-learning/materials/{material_id}/transcript/refresh` | +| `PUT` | `/api/video-learning/materials/{material_id}/progress` | +| `GET` | `/api/video-learning/materials/{material_id}/notes` | +| `GET` | `/api/video-learning/materials/{material_id}/notes.md` | +| `POST` | `/api/video-learning/materials/{material_id}/notes` | +| `PUT` | `/api/video-learning/materials/{material_id}/notes/{note_id}` | +| `DELETE` | `/api/video-learning/materials/{material_id}/notes/{note_id}` | +| `GET` | `/api/video-learning/materials/{material_id}/marks` | +| `GET` | `/api/video-learning/materials/{material_id}/marks/{mark_id}` | +| `POST` | `/api/video-learning/materials/{material_id}/marks` | +| `PATCH` | `/api/video-learning/materials/{material_id}/marks/{mark_id}` | +| `DELETE` | `/api/video-learning/materials/{material_id}/marks/{mark_id}` | +| `POST` | `/api/video-learning/materials/{material_id}/mark-suggestions` | +| `GET` | `/api/video-learning/materials/{material_id}/subtitles.vtt` | +| `HEAD` | `/api/video-learning/materials/{material_id}/stream/{format_id}` | +| `GET` | `/api/video-learning/materials/{material_id}/stream/{format_id}` | + +#### `voice:router` — `/api/voice` · learning + +| 方法 | 路径 | +| --- | --- | +| `POST` | `/api/voice/tts` | +| `POST` | `/api/voice/stt` | + +### server + +#### `unified_ws:router` — `/` · public + +| 方法 | 路径 | +| --- | --- | +| `WS` | `/ws` | + +#### `personas:router` — `/api` · learning + +| 方法 | 路径 | +| --- | --- | +| `GET` | `/api/personas` | +| `GET` | `/api/personas/{name}` | +| `POST` | `/api/personas` | +| `PUT` | `/api/personas/{name}` | +| `DELETE` | `/api/personas/{name}` | + +#### `agent_config:router` — `/api/agent-config` · learning + +| 方法 | 路径 | +| --- | --- | +| `GET` | `/api/agent-config/agents` | +| `GET` | `/api/agent-config/agents/{agent_type}` | + +#### `auth:router` — `/api/auth` · public + +| 方法 | 路径 | +| --- | --- | +| `GET` | `/api/auth/openai-codex/callback` | +| `GET` | `/api/auth/status` | +| `POST` | `/api/auth/login` | +| `POST` | `/api/auth/device-login` | +| `POST` | `/api/auth/session-handoff` | +| `POST` | `/api/auth/session-handoff/exchange` | +| `POST` | `/api/auth/session-handoff/complete` | +| `POST` | `/api/auth/device/heartbeat` | +| `POST` | `/api/auth/logout` | +| `POST` | `/api/auth/register` | +| `GET` | `/api/auth/is_first_user` | +| `GET` | `/api/auth/profile` | +| `PUT` | `/api/auth/profile` | +| `PUT` | `/api/auth/profile/avatar` | +| `DELETE` | `/api/auth/profile/avatar` | +| `GET` | `/api/auth/avatar/{user_id}` | +| `PUT` | `/api/auth/profile/password` | +| `GET` | `/api/auth/devices` | +| `POST` | `/api/auth/devices` | +| `DELETE` | `/api/auth/devices/{device_credential_id}` | +| `GET` | `/api/auth/users` | +| `GET` | `/api/auth/profile/learner-profile` | +| `PUT` | `/api/auth/profile/learner-profile` | +| `GET` | `/api/auth/users/{username}/learner-profile` | +| `PUT` | `/api/auth/users/{username}/learner-profile` | +| `POST` | `/api/auth/users` | +| `POST` | `/api/auth/users/import` | +| `DELETE` | `/api/auth/users/{username}` | +| `POST` | `/api/auth/users/batch-delete` | +| `PUT` | `/api/auth/users/{username}/role` | +| `PUT` | `/api/auth/users/{username}/password` | + +#### `capabilities:router` — `/api/capabilities` · learning + +| 方法 | 路径 | +| --- | --- | +| `GET` | `/api/capabilities/registered` | + +#### `capabilities_settings:router` — `/api/capabilities` · learning + +| 方法 | 路径 | +| --- | --- | +| `GET` | `/api/capabilities/settings` | +| `PUT` | `/api/capabilities/settings` | + +#### `creations:router` — `/api/creations` · learning + +| 方法 | 路径 | +| --- | --- | +| `GET` | `/api/creations/drafts/{draft_id}` | +| `POST` | `/api/creations/drafts/{draft_id}/approve` | + +#### `dashboard:router` — `/api/dashboard` · learning + +| 方法 | 路径 | +| --- | --- | +| `GET` | `/api/dashboard/recent` | +| `GET` | `/api/dashboard/suggestions` | +| `POST` | `/api/dashboard/suggestions/refresh` | +| `GET` | `/api/dashboard/learning-index` | +| `GET` | `/api/dashboard/source-library/{kind}` | +| `GET` | `/api/dashboard/learning-library/{kind}` | +| `GET` | `/api/dashboard/{entry_id}` | + +#### `file_preview:router` — `/api/file-preview` · authenticated + +| 方法 | 路径 | +| --- | --- | +| `GET` | `/api/file-preview/pdf` | +| `POST` | `/api/file-preview/pdf` | + +#### `imports:router` — `/api/imports` · learning + +| 方法 | 路径 | +| --- | --- | +| `POST` | `/api/imports/chat-history` | +| `GET` | `/api/imports/chat-history` | + +#### `learning_journal:router` — `/api/learning-journal` · learning + +| 方法 | 路径 | +| --- | --- | +| `GET` | `/api/learning-journal` | + +#### `modules:router` — `/api/modules` · authenticated + +| 方法 | 路径 | +| --- | --- | +| `GET` | `/api/modules` | + +#### `multi_user:router` — `/api/multi-user` · learning + +| 方法 | 路径 | +| --- | --- | +| `GET` | `/api/multi-user/admin/resources` | +| `GET` | `/api/multi-user/admin/books` | +| `GET` | `/api/multi-user/guardians` | +| `POST` | `/api/multi-user/guardians` | +| `DELETE` | `/api/multi-user/guardians/{relationship_id}` | +| `GET` | `/api/multi-user/me/guardianships` | +| `DELETE` | `/api/multi-user/me/guardianships/{relationship_id}` | +| `GET` | `/api/multi-user/learners/{learner_user_id}/guardian-report` | +| `GET` | `/api/multi-user/learners/{learner_user_id}/materials` | +| `PUT` | `/api/multi-user/learners/{learner_user_id}/materials` | +| `GET` | `/api/multi-user/learners/{learner_user_id}/restrictions` | +| `PUT` | `/api/multi-user/learners/{learner_user_id}/restrictions` | +| `POST` | `/api/multi-user/learners/{learner_user_id}/credentials/reset` | +| `GET` | `/api/multi-user/users/{user_id}/grants` | +| `PUT` | `/api/multi-user/users/{user_id}/grants` | +| `GET` | `/api/multi-user/users/{user_id}/book-permission` | +| `PUT` | `/api/multi-user/users/{user_id}/book-permission` | +| `POST` | `/api/multi-user/admin/skills/install` | +| `GET` | `/api/multi-user/users` | + +#### `plugins:router` — `/api/plugins` · public + +| 方法 | 路径 | +| --- | --- | +| `GET` | `/api/plugins/extensions` | +| `GET` | `/api/plugins/{plugin_id}/pages/{extension_id}` | +| `GET` | `/api/plugins/{plugin_id}/pages/{extension_id}/` | +| `GET` | `/api/plugins/{plugin_id}/pages/{extension_id}/assets/{asset_path:path}` | +| `GET` | `/api/plugins/catalog` | +| `GET` | `/api/plugins/state` | +| `GET` | `/api/plugins/{plugin_id}/info` | +| `POST` | `/api/plugins/{plugin_id}/approve` | +| `POST` | `/api/plugins/{plugin_id}/enable` | +| `POST` | `/api/plugins/{plugin_id}/disable` | +| `POST` | `/api/plugins/{plugin_id}/install` | +| `POST` | `/api/plugins/{plugin_id}/rollback` | +| `DELETE` | `/api/plugins/{plugin_id}/installation` | +| `GET` | `/api/plugins/{plugin_id}/{plugin_path:path}` | +| `POST` | `/api/plugins/{plugin_id}/{plugin_path:path}` | +| `PUT` | `/api/plugins/{plugin_id}/{plugin_path:path}` | +| `PATCH` | `/api/plugins/{plugin_id}/{plugin_path:path}` | +| `DELETE` | `/api/plugins/{plugin_id}/{plugin_path:path}` | + +#### `sessions:router` — `/api/sessions` · learning + +| 方法 | 路径 | +| --- | --- | +| `GET` | `/api/sessions/capabilities` | +| `POST` | `/api/sessions/submission-replacement` | +| `GET` | `/api/sessions` | +| `GET` | `/api/sessions/search` | +| `GET` | `/api/sessions/recycle-bin` | +| `POST` | `/api/sessions/{session_id}/migrate-watching` | +| `GET` | `/api/sessions/{session_id}` | +| `GET` | `/api/sessions/{session_id}/organization` | +| `GET` | `/api/sessions/{session_id}/threads` | +| `GET` | `/api/sessions/{session_id}/messages/{message_id}/events` | +| `GET` | `/api/sessions/{session_id}/ask-hint` | +| `PATCH` | `/api/sessions/{session_id}` | +| `PATCH` | `/api/sessions/{session_id}/reply-language` | +| `PATCH` | `/api/sessions/{session_id}/organization` | +| `DELETE` | `/api/sessions/{session_id}` | +| `POST` | `/api/sessions/{session_id}/restore` | +| `DELETE` | `/api/sessions/{session_id}/purge` | +| `PUT` | `/api/sessions/{session_id}/branch-selection` | +| `DELETE` | `/api/sessions/{session_id}/messages/{message_id}` | +| `POST` | `/api/sessions/{session_id}/quiz-results` | + +#### `settings:public_router` — `/api/settings` · public + +| 方法 | 路径 | +| --- | --- | +| `GET` | `/api/settings/ui` | + +#### `settings:router` — `/api/settings` · learning + +| 方法 | 路径 | +| --- | --- | +| `GET` | `/api/settings` | +| `POST` | `/api/settings/providers/openai-codex/oauth/start` | +| `GET` | `/api/settings/providers/openai-codex/oauth/status` | +| `POST` | `/api/settings/providers/openai-codex/oauth/complete` | +| `POST` | `/api/settings/providers/openai-codex/oauth/cancel` | +| `POST` | `/api/settings/providers/openai-codex/oauth/logout` | +| `POST` | `/api/settings/providers/openai-codex/models/refresh` | +| `GET` | `/api/settings/providers/codebuddy/auth/status` | +| `POST` | `/api/settings/providers/codebuddy/auth/start` | +| `POST` | `/api/settings/providers/codebuddy/auth/cancel` | +| `POST` | `/api/settings/providers/codebuddy/auth/logout` | +| `POST` | `/api/settings/providers/openai-codex/models/reasoning-effort` | +| `GET` | `/api/settings/catalog` | +| `GET` | `/api/settings/network` | +| `PUT` | `/api/settings/network` | +| `GET` | `/api/settings/web-fetch` | +| `PUT` | `/api/settings/web-fetch` | +| `GET` | `/api/settings/chat-attachments` | +| `GET` | `/api/settings/chat-starters` | +| `PUT` | `/api/settings/chat-starters` | +| `PUT` | `/api/settings/chat-attachments` | +| `GET` | `/api/settings/mineru` | +| `PUT` | `/api/settings/mineru` | +| `GET` | `/api/settings/document-parsing` | +| `GET` | `/api/settings/readiness` | +| `GET` | `/api/settings/profile` | +| `POST` | `/api/settings/profile/diff` | +| `GET` | `/api/settings/presets` | +| `POST` | `/api/settings/presets/{preset_id}/draft` | +| `PUT` | `/api/settings/document-parsing` | +| `POST` | `/api/settings/document-parsing/test` | +| `POST` | `/api/settings/document-parsing/docling/test` | +| `POST` | `/api/settings/document-parsing/tika/test` | +| `POST` | `/api/settings/document-parsing/install` | +| `POST` | `/api/settings/document-parsing/models/download` | +| `GET` | `/api/settings/document-parsing/job/status` | +| `POST` | `/api/settings/document-parsing/job/cancel` | +| `POST` | `/api/settings/mineru/models/download` | +| `GET` | `/api/settings/mineru/models/download/status` | +| `POST` | `/api/settings/mineru/models/download/cancel` | +| `POST` | `/api/settings/mineru/test` | +| `GET` | `/api/settings/llm-options` | +| `PUT` | `/api/settings/catalog` | +| `POST` | `/api/settings/apply/registry` | +| `POST` | `/api/settings/apply/provider` | +| `POST` | `/api/settings/apply/service` | +| `GET` | `/api/settings/draft` | +| `PUT` | `/api/settings/draft` | +| `DELETE` | `/api/settings/draft` | +| `POST` | `/api/settings/apply` | +| `POST` | `/api/settings/test-provider` | +| `POST` | `/api/settings/fetch-models` | +| `POST` | `/api/settings/model-capabilities` | +| `PUT` | `/api/settings/theme` | +| `PUT` | `/api/settings/language` | +| `PUT` | `/api/settings/voice-autoplay` | +| `PUT` | `/api/settings/voice-math-speak` | +| `PUT` | `/api/settings/chat-response-timeout` | +| `GET` | `/api/settings/page-customization` | +| `PUT` | `/api/settings/page-customization/chat` | +| `PUT` | `/api/settings/page-customization/learning` | +| `GET` | `/api/settings/display` | +| `PUT` | `/api/settings/ui` | +| `POST` | `/api/settings/reset` | +| `GET` | `/api/settings/themes` | +| `GET` | `/api/settings/sidebar` | +| `PUT` | `/api/settings/sidebar/description` | +| `PUT` | `/api/settings/sidebar/nav-order` | +| `PUT` | `/api/settings/enabled-tools` | +| `POST` | `/api/settings/voice/voices` | +| `POST` | `/api/settings/voice/preview` | +| `POST` | `/api/settings/services/{service}/preview` | +| `POST` | `/api/settings/tests/{service}/start` | +| `GET` | `/api/settings/tests/{service}/{run_id}/events` | +| `POST` | `/api/settings/tests/{service}/{run_id}/cancel` | +| `GET` | `/api/settings/tour/status` | +| `POST` | `/api/settings/tour/complete` | +| `POST` | `/api/settings/tour/reopen` | +| `GET` | `/api/settings/usage` | + +#### `mcp_settings:router` — `/api/settings/mcp` · learning + +| 方法 | 路径 | +| --- | --- | +| `GET` | `/api/settings/mcp` | +| `PUT` | `/api/settings/mcp` | +| `PUT` | `/api/settings/mcp/servers/{name}` | +| `DELETE` | `/api/settings/mcp/servers/{name}` | +| `POST` | `/api/settings/mcp/test` | + +#### `workspace:settings_router` — `/api/settings/workspace` · learning + +| 方法 | 路径 | +| --- | --- | +| `GET` | `/api/settings/workspace/folders` | +| `POST` | `/api/settings/workspace/knowledge-bases/preview-move` | +| `POST` | `/api/settings/workspace/knowledge-bases/move` | +| `GET` | `/api/settings/workspace/data/discover` | +| `POST` | `/api/settings/workspace/data/preview` | +| `POST` | `/api/settings/workspace/data/migrate` | +| `POST` | `/api/settings/workspace/data/export` | +| `GET` | `/api/settings/workspace/data/operations` | +| `POST` | `/api/settings/workspace/data/operations/{operation_id}/recover` | +| `GET` | `/api/settings/workspace/data/exports/{operation_id}` | +| `GET` | `/api/settings/workspace/registrations` | +| `POST` | `/api/settings/workspace/registrations/migrate-root` | +| `POST` | `/api/settings/workspace/registrations/{workspace_id}/migrate` | +| `POST` | `/api/settings/workspace/registrations/system-snapshot` | +| `GET` | `/api/settings/workspace/registrations/system-snapshot` | +| `GET` | `/api/settings/workspace/resource-usage` | +| `GET` | `/api/settings/workspace/resources` | +| `POST` | `/api/settings/workspace/registrations` | +| `PATCH` | `/api/settings/workspace/registrations/{workspace_id}` | +| `GET` | `/api/settings/workspace` | +| `POST` | `/api/settings/workspace/validate` | +| `PUT` | `/api/settings/workspace` | + +#### `skills:router` — `/api/skills` · learning + +| 方法 | 路径 | +| --- | --- | +| `GET` | `/api/skills/tags/list` | +| `POST` | `/api/skills/tags/create` | +| `PUT` | `/api/skills/tags/{tag}` | +| `DELETE` | `/api/skills/tags/{tag}` | +| `GET` | `/api/skills/list` | +| `GET` | `/api/skills/hub/catalog` | +| `GET` | `/api/skills/hub/detail` | +| `GET` | `/api/skills/{name}` | +| `POST` | `/api/skills/create` | +| `POST` | `/api/skills/install` | +| `PUT` | `/api/skills/{name}` | +| `DELETE` | `/api/skills/{name}` | + +#### `space_cli_apps:router` — `/api/space/cli-apps` · learning + +| 方法 | 路径 | +| --- | --- | +| `GET` | `/api/space/cli-apps/apps` | +| `PUT` | `/api/space/cli-apps/apps/{app_id}/enabled` | +| `GET` | `/api/space/cli-apps/catalog` | +| `POST` | `/api/space/cli-apps/catalog/{app_id}/install` | +| `DELETE` | `/api/space/cli-apps/apps/{app_id}` | + +#### `space_mcp:router` — `/api/space/mcp` · learning + +| 方法 | 路径 | +| --- | --- | +| `GET` | `/api/space/mcp/servers` | +| `PUT` | `/api/space/mcp/servers/{name}` | +| `DELETE` | `/api/space/mcp/servers/{name}` | +| `POST` | `/api/space/mcp/servers/{name}/authorize` | +| `GET` | `/api/space/mcp/oauth/callback` | +| `POST` | `/api/space/mcp/servers/{name}/test` | +| `GET` | `/api/space/mcp/catalog` | +| `POST` | `/api/space/mcp/catalog/{entry_id}/install` | + +#### `subagents:router` — `/api/subagents` · learning + +| 方法 | 路径 | +| --- | --- | +| `GET` | `/api/subagents/detect` | +| `GET` | `/api/subagents/backends/options` | +| `POST` | `/api/subagents/backends/{kind}/sync` | +| `GET` | `/api/subagents/connections` | +| `POST` | `/api/subagents/connections` | +| `DELETE` | `/api/subagents/connections/{name}` | +| `POST` | `/api/subagents/connections/{name}/message` | +| `GET` | `/api/subagents/settings` | +| `PUT` | `/api/subagents/settings` | + +#### `system:router` — `/api/system` · learning + +| 方法 | 路径 | +| --- | --- | +| `GET` | `/api/system/runtime` | +| `GET` | `/api/system/update` | +| `POST` | `/api/system/update/check` | +| `PUT` | `/api/system/update/settings` | +| `GET` | `/api/system/update/job` | +| `POST` | `/api/system/update` | +| `GET` | `/api/system/status` | +| `GET` | `/api/system/memory` | +| `POST` | `/api/system/test/llm` | +| `POST` | `/api/system/test/embeddings` | +| `POST` | `/api/system/test/search` | + +#### `task_board:router` — `/api/task-board` · learning + +| 方法 | 路径 | +| --- | --- | +| `GET` | `/api/task-board` | +| `GET` | `/api/task-board/events` | +| `POST` | `/api/task-board/cards` | +| `PATCH` | `/api/task-board/cards/{card_id}` | +| `PUT` | `/api/task-board/colors` | +| `PUT` | `/api/task-board/sessions/{session_id}` | +| `PATCH` | `/api/task-board/sessions/{session_id}/status` | + +#### `tools:router` — `/api/tools` · learning + +| 方法 | 路径 | +| --- | --- | +| `GET` | `/api/tools` | + +#### `attachments:router` — `/files/attachments` · learning + +| 方法 | 路径 | +| --- | --- | +| `GET` | `/files/attachments/{session_id}/{attachment_id}/{filename:path}` | + +#### `file_library:router` — `/files/library` · learning + +| 方法 | 路径 | +| --- | --- | +| `GET` | `/files/library/` | +| `POST` | `/files/library/` | +| `GET` | `/files/library/search` | +| `GET` | `/files/library/{file_id}` | +| `GET` | `/files/library/{file_id}/download` | +| `HEAD` | `/files/library/{file_id}/download` | +| `DELETE` | `/files/library/{file_id}` | +| `POST` | `/files/library/{file_id}/restore` | + +#### `outputs:router` — `/files/outputs` · public + +| 方法 | 路径 | +| --- | --- | +| `HEAD` | `/files/outputs/{output_path:path}` | +| `GET` | `/files/outputs/{output_path:path}` | + +#### `quiz_judge:router` — `/ws` · public + +| 方法 | 路径 | +| --- | --- | +| `WS` | `/ws/questions/judge` | + +### visualize + +#### `visualizers:router` — `/api/visualizers` · learning + +| 方法 | 路径 | +| --- | --- | +| `GET` | `/api/visualizers/list` | +| `POST` | `/api/visualizers/bundled/{visualizer_id}/install` | +| `POST` | `/api/visualizers/{visualizer_id}/enable` | +| `POST` | `/api/visualizers/{visualizer_id}/disable` | +| `DELETE` | `/api/visualizers/{visualizer_id}` | +| `POST` | `/api/visualizers/import` | +| `GET` | `/api/visualizers/{visualizer_id}/assets/{asset_path:path}` | diff --git a/docs/src/content/docs/zh-cn/developers/reference/turn-protocol.md b/docs/src/content/docs/zh-cn/developers/reference/turn-protocol.md new file mode 100644 index 000000000..6f33f3519 --- /dev/null +++ b/docs/src/content/docs/zh-cn/developers/reference/turn-protocol.md @@ -0,0 +1,35 @@ +--- +title: Turn 协议 +description: 统一 turn WebSocket 上的客户端命令和服务端事件。 +quadrant: reference +--- + +Web 界面和 `deeptutor run --format json` 共用同一个套接字: + +```text +WS /ws +``` + +命令和事件是 `deeptutor/api/contracts/turn_protocol.py` 里的模型。多余字段会被拒绝。当前命令的 `protocol_version` 为 `"2.0"`。如何打开套接字和完成认证,写在 [HTTP API](/zh-cn/developers/reference/http-api/)。 + +## 命令 + +| `type` | 必填字段 | +| --- | --- | +| `start_turn` 或 `message` | Turn 请求:`content`,以及可选的 `capability`、`session_id`、`tools`、`knowledge_bases`、`language`、`config`、`skills`、引用和 `attachments`。`skills` 会与当前工作区允许的技能取交集来收窄 `read_skill` 可见范围(省略或传 `[]` 继承工作区全部可见技能)。 | +| `subscribe_turn` | `turn_id`,可选 `after_seq` | +| `subscribe_session` | `session_id`,可选 `after_seq` | +| `resume_from` | `turn_id`,可选 `seq` | +| `unsubscribe` | `turn_id` 或 `session_id` | +| `cancel_turn` | `turn_id`、`command_id` | +| `regenerate` | `session_id`,可选 `overrides` | +| `submit_user_reply` | `SubmitUserReplyCommand` 上定义的回复 | +| `ping` | 无 | + +订阅会在 `after_seq` 之后重放事件。结束的 turn 以 `done` 收尾。失败的 turn 会先发出 `error`。 + +## 事件 + +`stage_start`、`stage_end`、`thinking`、`observation`、`content`、`tool_call`、`tool_result`、`progress`、`sources`、`result`、`error`、`session`、`session_meta`、`wait_for_input`、`done`。 + +同一套接字上的控制消息还有 `pong`、命令确认和协议错误。字段以 `turn_protocol.py` 里对应的模型为准。 diff --git a/docs/src/content/docs/zh-cn/ecosystem/index.md b/docs/src/content/docs/zh-cn/ecosystem/index.md deleted file mode 100644 index 6897803bb..000000000 --- a/docs/src/content/docs/zh-cn/ecosystem/index.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -title: DeepTutor 生态 -description: 通过 RAG 集成、可复用 Skill、远程 MCP 服务、沙箱化 CLI App 与 EduHub 扩展 DeepTutor。 -quadrant: explanation ---- - -DeepTutor 的内置学习界面覆盖日常使用;**生态**则让你在不修改核心代码的前提下增加行为与工具:连接检索引擎、教模型一套工作流、连接外部服务、安装命令行应用,或发现社区 Skill。 - -![个性化与可复用的账户资源](/screenshots/dev/personalization.png) - -## 五条扩展路径 - -| 扩展 | 增加什么 | 由谁管理 | -|---|---|---| -| [**Skill**](/zh-cn/ecosystem/skills/) | 模型在需要某套流程时读取的 `SKILL.md` 手册 | 内置、本地、ClawHub 或 EduHub | -| [**MCP 服务**](/zh-cn/ecosystem/mcp/) | 托管或部署级 MCP 服务器暴露的工具 | 远程服务按账号;部署注册表由管理员管理 | -| [**CLI App**](/zh-cn/ecosystem/cli-apps/) | 安装在服务器、以沙箱工具形式进入对话的命令行程序 | 管理员安装和授权;获准账号运行 | -| [**RAG 集成**](/zh-cn/ecosystem/rag-integration/) | 知识库背后的本地、智能体式、远程或实时资料库检索 | 部署配置 + 每个 KB 的选择 | -| [**EduHub**](/zh-cn/ecosystem/eduhub/) | 面向 Skill 的社区发现、版本、导入与发布 | 社区作者发布;用户审阅并导入 | - -每条路径的信任边界不同。RAG 集成负责检索,Skill 是指令,MCP 服务是远程工具边界,CLI App 则是在主机安装的代码;EduHub 分发 Skill,但不成为它的运行时。因此 DeepTutor 为各条路径分别设计配置、安装、凭据、沙箱与授权模型。 - -## 它们在产品里的位置 - -知识引擎从**知识中心**选择;Skill、MCP 服务和 CLI App 从**个性化**管理,EduHub 则嵌在 Skill 导入器里。启用后,工具通过与内置工具相同的发现流程进入主页智能体。 - -## 从工作区任务出发 - -在当前工作区的**资源**中保留课程或项目文件,在**学习**中学习材料,在**主页**提出问题或生成成果。[个性化](/zh-cn/explore/personalization/)则是账号的人格、技能、智能体和连接资源架,切换工作区后仍然存在。 - -技能和 MCP 服务先在设置的工作区 **Assigned resources(分配资源)**中配置,再按需缩小当前对话范围。分配引用账号资源库,不复制凭据,也不绕过用户授权。CLI 应用另有管理员安装与授权规则。RAG 则关联知识库及其检索材料。 - -## 下一步 - -检索本身是扩展点时,先看 [RAG 集成](/zh-cn/ecosystem/rag-integration/);要教模型一套可复用流程时看 [Skill 扩展](/zh-cn/ecosystem/skills/),连接账号型在线服务时看 [MCP 扩展](/zh-cn/ecosystem/mcp/),需要真实命令行程序时看 [CLI-App 扩展](/zh-cn/ecosystem/cli-apps/)。发现或发布社区 Skill 则进入 [EduHub](/zh-cn/ecosystem/eduhub/)。 diff --git a/docs/src/content/docs/zh-cn/explore/chat-workspace.md b/docs/src/content/docs/zh-cn/explore/chat-workspace.md deleted file mode 100644 index 8e396cbfa..000000000 --- a/docs/src/content/docs/zh-cn/explore/chat-workspace.md +++ /dev/null @@ -1,205 +0,0 @@ ---- -title: 对话 -description: "DeepTutor 的默认智能体循环——能力、会话上下文、可复用引用、工具、活动面板,以及驱动这一切的模型。" -quadrant: how-to ---- - -主页是 DeepTutor 的核心。它不是一个普通的输入框,而是**默认的智能体循环**(agent loop):它能调用工具、阅读你的资料、检索知识库、记笔记、生成图片、咨询其他智能体、在需要时反问你,并切换到更深的能力——这一切都在同一个对话里完成。 - -## 它在哪里 - -先选择[工作区](/zh-cn/explore/workspaces/),再打开**主页 → 聊天**(`/chat`)。主页还包含[任务看板](/zh-cn/explore/task-board/)、[学习笔记本](/zh-cn/explore/co-writer/)和[日历](/zh-cn/explore/calendar/)。聊天、任务与笔记页面随工作区变化;日历事件属于账号级,并叠加工作区学习信息。 - -![主页与对话输入框](/screenshots/dev/overview.png) - -界面分为三个区域: - -| 区域 | 作用 | -| --- | --- | -| **左侧栏** | 顶部为工作区菜单,下方是**主页、学习、资料**。**伙伴**与**个性化**属于账号级。对话会恢复所属学习上下文;工作区菜单可进入设置与工作区管理。经典布局的导航排列有所不同。 | -| **输入框** | 消息框。**左下角**决定这一轮是哪种「能力」,并用 `+` 加入引用;**右下角**提供连接智能体、知识库、人设与模型选择器。麦克风只转写当前消息。 | -| **活动面板**(右上角切换) | 当前会话用到的工具调用、引用、生成的文件、附件与预览,并能快速打开一个 URL 或本地文件。 | - -启用身份认证后,已登录用户还会在侧栏看到 **My profile**。这里显示不可编辑的用户名、角色与加入日期;你可以上传头像,或选择图标和颜色,也可以退出登录。 - -对话上方的右上角图标分别用于:**把有用内容存到收藏夹**、**把整段会话导出为 Markdown**、**展开/收起活动面板**。 - -## 完成第一段有用的对话 - -1. 选中项目工作区,新建聊天。 -2. 用资料控件加入 PDF 或某条保存记录;需要跨资料库检索时挂载知识库。 -3. 说明结果与限制,例如:“基于这份讲义解释采样定理,再给我两道题。先让我尝试,不要直接展示答案。” -4. 在活动面板查看工具进度,打开引用来源或生成文件核对依据。 -5. 将有用结果存到[收藏夹](/zh-cn/explore/favorites/),或到[学习笔记本](/zh-cn/explore/co-writer/)写自己的理解。之后可从资料 → 聊天历史重开会话。 - -选择连接的智能体默认会作为会话偏好保留;导入旧智能体记录则是在引用材料。同样,附件默认提供当前轮次资料,工作区指令与会话偏好影响后续轮次。回答似乎引用了错误来源或人设时,发送前检查可见的选择标签。 - -## 起始建议 - -空白输入框下方提供解释、解题、练习、规划和研究等起始提示。独立的一条个性化建议取自记忆与近期活动;**换一批**会替换它。选择提示或建议后,内容先进入输入框,供你检查再发送。通过**自定义页面 → 起始提示**可修改常用标题与请求。 - -**Settings → Conversation** 决定喂给它们多少历史:把活动条数调高,建议的取材面更广;调低,则更贴近你刚才在做的事。 - - -## 智能体循环(它是怎么「想」的) - -DeepTutor 聊天运行的是单一智能体循环,因此一条消息在你看到答复前,内部可能要走好几轮: - -1. 模型读取你的消息与已挂载的上下文,然后直接作答,或规划一次工具调用。 -2. 若需要工具,DeepTutor 派发工具并把观测结果追加进来(可在活动面板里实时看到)。 -3. 模型带着更充分的证据继续——阅读资料、检索知识库、运行代码、抓取网页。 -4. 一条不再调用工具的最终消息,结束这一轮。 - -`ask_user` 很特殊:与其瞎猜,智能体可以**暂停这一轮**,向你提出结构化的澄清问题,待你回答后再继续。 - -## 选择一种能力 - -输入框左下角的选择器(现代布局默认显示 **Auto**,经典布局显示 **Chat**)决定由哪种 capability 处理这一轮。各能力共享编排与会话上下文;有些复用 Chat 循环,有些运行专用 pipeline。 - -能力菜单可选择 **Ask Questions**、**Quiz**、**Visualize** 与 **Video Lesson** 等专用模式;**Research** 和 **Solve** 收在 *More Capabilities* 弹出层里。**Mastery Path** 与 **Immersive Reading** 位于**学习**下,与书籍和练习并列,不属于 Home 模式。这个分组只关乎呈现,并不代表各模式如何运行。 - -| 能力 | 适用于 | -| --- | --- | -| **Chat** | 可用任意工具的灵活对话——开放式问答、轻量工具使用,日常默认。 | -| **Ask Questions** | 先用一张结合上下文的提问卡补齐信息,再依据你的回答完成原请求。 | -| **Quiz** | 自动校验的出题:练习题、仿真题、从你的资料出题。 | -| **Visualize** | 图表、示意图、可交互 HTML、SVG、Mermaid 与 Manim,由可扩展的 visualizer 目录选择。 | -| **Video Lesson** | 生成在浏览器播放的课程,含字幕与可选旁白(使用设置的 TTS 提供方或 Edge);后端需要 Node.js 22+ 和 npm。 | -| **Immersive Reading**(学习活动) | 在文档、音频和视频旁依据来源学习;媒体转录使用时间戳引用。 | -| **Research**(在 *More Capabilities* 下) | 全面的多智能体研究:子话题分解、RAG / 网络 / arXiv 检索、带引用的报告。 | -| **Solve**(在 *More Capabilities* 下) | 多步推理与解题,带验证和完整解答过程。 | - - -视频学习现与文档、音频一起进入**沉浸式阅读**合集。YouTube 使用原生播放器;设置负责字幕来源与可选的 Invidious 浏览。助手按转录时间戳引用,无法看到视频画面;没有转录仍可播放。重新打开旧 Watching 会话时,会把保留的素材和笔记迁到 Reading;素材缺失时,对话仍作为 Chat 保留。 - - -Visualize 的渲染模式现在来自目录。SVG、Mermaid、Mermaid 思维导图、Chart.js、可交互 HTML、Manim 动画与分镜是核心类型;GeoGebra 是可选的内置安装项。你也能导入包含 `visualizer.json` 与浏览器资产的 ZIP;导入的 renderer 在沙箱 iframe 中运行,不含后端 Python,并可按用户启用、停用或移除。 - - -### Little Tutor——追问一段选区 - -选中对话中的文字并打开 **Little Tutor**,即可启动一条独立、以来源内容为依据的侧栏线程。它嵌套在来源对话下,并使用自己的聚焦上下文而不加载全局记忆或通用工具,因此精读追问不会打断主线程。 - -## 黏性上下文 vs. 一次性引用 - -DeepTutor 把上下文分成两类,输入框也把它们放在两个不同的位置——这是这一页最关键的一个概念。 - -**黏性会话上下文**会跨轮持续生效,直到你手动更改:能力、工作区或课程绑定、工具、**知识库**、**人设**、**模型**以及 Reading / Mastery 状态。右侧提供相关选择器;通过 Agent 胶囊或 `@` 选中的智能体默认会留在本会话里,而麦克风只填入当前草稿。 - -**引用**位于左侧的 **`+` 按钮**后面,默认只用于*当前这一轮*;可通过复用控件让支持的引用在后续每一轮继续使用。 - - -| `+` 引用 | 拉进什么 | -| --- | --- | -| **Attach files** | 一份 PDF、图片、Office 文档、Markdown 或数据文件,交给智能体阅读。 | -| **Chat History** | 把过去的某段会话作为背景资料。 | -| **My Agents** | 一份导入的 Claude Code / Codex / ChatGPT 对话记录供探查——见[我的智能体](/zh-cn/explore/subagents/)。 | -| **Books / Reading / Notebooks / Question Bank** | 一本已编译的书、一个阅读片段、一个已保存的笔记本,或[资料](/zh-cn/explore/space/)里的练习题。题目可按材料或分类筛选,**Select all** 会保留先前选择。 | -| **Memory** | 某一份具体的记忆文档——当你希望智能体依据一条你指得出来的事实工作,而不是依据召回碰巧捞上来的东西。 | - -在主 Chat 输入框里键入 **`@`**,会筛选与 Agent 胶囊相同的连接智能体列表,并默认把选中项保留在本会话中。没有实时智能体选择器的跟进界面,则继续用 `@` 打开 Space 引用菜单。 - -### 知识库——把答案锚定到你的资料 - -**数据库图标**打开知识库选择器。未手动选择的对话继承工作区已就绪的指定知识库或默认库;显式选择(包括不选)会持续保留,直到修改。问题需要依据时,智能体从这些库检索。 - -具体怎么检索,取决于这个库绑定的引擎——回答让你意外的时候,这个区别很值得知道。大多数库——LlamaIndex、GraphRAG、LightRAG、链接的现成索引、远端 LightRAG Server、腾讯 IMA 库——由 `rag` 工具服务。**PageIndex OSS** 与 **PageIndex Cloud** 不是:它们的检索本身是 agentic 的,阅读循环会遍历本地或托管文档树,因此这些库被有意排除在 `rag` 列表之外。**Obsidian** 库压根没有索引,会被路由给 Obsidian 能力,由它直接浏览实时文件;**MarginNote 4** 库是同一种形态,由它自己的一组工具来走。 - - -### 人设——设定语气与立场 - -**人物图标**用于选择人设。`Default` 是朴素的助手;内置的 **peer**(同伴)、**research-assistant**(研究助理)、**teacher**(老师)等会改变语气与教学风格。人设在**个性化 → 人设**中管理,并可被伙伴复用。 - - -### 模型——逐轮切换 - -**模型胶囊**决定这一轮用哪个模型。你在设置里配好的每个模型都会列在这里,并标注提供商与上下文窗口,默认模型有标记。处理大文档时切到长上下文模型,闲聊时切到更便宜更快的模型——会话中途即可切换,不丢上下文。 - - -## 活动面板 - -右上角的面板切换按钮会打开 **Activity**(活动)——当前会话用过的工具、引用与文件的实时记录,生成的文件排在你上传的之上,外加一个 **Open** 框,可把 URL 或本地文件拉进应用内的查看器。 - -![对话与活动控制](/screenshots/dev/chat.png) - -一轮进行时,每次工具调用都会折叠成一个紧凑的标题(例如 `Done · 21s`),展开即可查看输入与输出——对话保持清爽,完整轨迹依然可审计。 - -## 知道窗口有多满 - -输入框上有一个胶囊,报告这一轮实际占用了模型上下文窗口的多少、以及是什么在占——提示词块、工具 schema、消息列表。它是从已经拼装好的提示词上量出来的,不是事后重新推算的,所以这个读数不可能和真正发出去的内容对不上。点开看明细,再决定要不要换一个长上下文模型,或者干脆开一段新会话。 - -长对话还会在正文左侧空白处长出一条刻度轨,你每问一次就多一格,用来在历史里跳来跳去而不必滚动。 - -## 工具——也包括生成 - -工具分三类,区别在于由谁来决定。 - -**由你决定**的是 **Settings → Tools** 里那些体验增强工具:`brainstorm`、`web_search`、`paper_search`、`zotero_search`、`reason` 与 `geogebra_analysis`——配好相应的生成模型后,还会有 `imagegen` 与 `videogen`。 - -**由上下文决定**的是其余那些:它们在有用时自动挂载,从输入框的角度看是常开的——`rag`、`kb_files`、`knowledge_frontier`、`read_source`、`read_memory`、`write_memory`、`read_skill`、`list_favorites`、`save_favorite`、`question_bank`、`web_fetch`、`github`、`preprint`、`research_audit`、`research_lit`、`learning_status`、`learning_update`、`ask_user`、`load_tools`、`cron`、`mastery_topics`、`mastery_sessions`、`mastery_open_session`、`mastery_new_session`,以及唯一的代码路径 `exec`(python、c、cpp 或 shell)。能力还会在此之上追加自己的:八个阅读工具、精通之路的教学工具、`consult_subagent` 等等。还有一类谁也管不着:工作区基础工具包含文件工具及 `write_note`、`search_notes`;`workspace_export` 要经你批准才能把文件移出 `outputs/`。(伙伴是例外:可以逐个禁用受上下文门控的工具——见[伙伴](/zh-cn/explore/partners/)。) - -### 把事情排到以后做 - -`cron` 让一个回合可以把活儿排期而不是当场干完:**在**某个时刻、**每隔** N 秒,或者按一条带时区的 **cron 表达式**。任务到点时,它的消息会作为一条新指令**在同一段对话里**执行,回复也落在这里——所以「工作日每天早上九点就这一章考我」是一句话,而不是一个设置页面。同一个工具还能列出本对话的任务、取消其中一个。对伙伴而言,到点的任务会顺着它所连接的 IM 渠道发回去。 - -在设置里配好一个**图像生成**(或视频生成)模型,它也会变成聊天工具——用自然语言提出需求,智能体便会调用它,并把结果内联预览、附上可下载的文件。 - -## 内容工作区 - -**内容工作区**是绑定到对话的文件夹。未绑定的会话使用通用工作区,也可为不同项目创建自建工作区。系统工作区保存共享技能和脱敏配置快照;私有运行设置、API key、数据库与记忆仍不属于对话的文件访问范围。 - -在 **Settings → Workspace** 管理根目录、工作区和 **Workspace instructions**。指令从下一轮起对支持的能力生效,但不包括 Deep Research、Quiz 和 Manim;能力规则与权限仍然适用。内置及托管的自建目录默认位于 `/data/user/workspaces`。命令行仍可管理原有内容文件夹绑定: - -```bash -deeptutor workspace show -deeptutor workspace set /absolute/path/to/my-folder -deeptutor workspace reset -``` - -读是自由的,写不是。一个回合产生的一切——下载、生成的文件、代码输出、渲染出的素材——都落在按回合隔离的 `outputs////` 目录下。文件夹的其余部分对执行是只读的;要把生成的文件从 `outputs/` 复制到你自己的材料里,必须经过一次点名了具体来源与去向的 **Allow once** 确认。 - -模型永远看不到绝对路径,只看得到 `outputs/report.docx` 这样的相对路径。它调用 `workspace_present` 时,界面会渲染一份带鉴权、可打开的快照;同一个相对路径也可以直接写进普通的 Markdown 链接或图片。之后再改源文件,不会改变已经呈现出去的快照。 - -在 Docker 与服务器部署下,托管工作区的存储范围由部署文件夹约束——见 [Docker](/zh-cn/get-started/docker/)。 - -## 配置聊天能用到的东西 - -输入框工具栏里的一切,最终都对应到 **Settings**(设置)里的配置。 - -**Settings → Models & services** 是模型所在之处:LLM、Task Models、Embedding、Search、文本转语音(TTS)、语音转文本(STT)、图像生成与视频生成。**Task Models** 负责标题、建议和阅读辅助,并可按任务单独选择模型;TTS 驱动朗读,STT 驱动麦克风,图像/视频模型则成为聊天工具。 - -![设置中的提供方连接](/screenshots/dev/providers.png) - -独立的 **Settings** 页面提供五项控制:**Video Learning**(字幕来源与可选的 Invidious 浏览设置)、**Tools**、**Capabilities**(各能力的 LLM 参数与运行时旋钮)、**Starting points**,以及 **Attachments**(上传上限与文本提取预算)。MCP 服务不再在这里配置——它和 CLI App 一起归到账号级个性化,详见 [DeepTutor 生态](/zh-cn/ecosystem/)。 - - -完整的控制面板见[设置](/zh-cn/explore/settings/)。 - -## 在手机上 - -窄于平板宽度时,工作区会收成单栏加一个抽屉式侧边栏,于是同一段对话在手机上是能用的,而不是把一个三栏桌面布局渲染到视口之外。 - -## 实用示例 - -```text -挂载一个知识库 + 提问:「讲讲第 4 章,并就我薄弱的点考我。」 -``` - -```text -附加一份 PDF + 提问:「抽取其中的假设,并把最终摘要存进我的笔记本。」 -``` - -```bash -deeptutor run chat "讲讲傅里叶变换" --kb signals -deeptutor chat --capability deep_research --kb papers -``` - -## 另见 - -- [沉浸式阅读](/zh-cn/explore/reading/)——同一个循环,旁边打开文档或媒体 -- [DeepTutor 生态](/zh-cn/ecosystem/)——智能体可调用的 Skill、MCP 服务与 CLI App -- [伙伴](/zh-cn/explore/partners/)——同一个循环,运行在 IM 伙伴里 -- [我的智能体](/zh-cn/explore/subagents/)——在一轮聊天里咨询 Claude Code、Codex 或某个伙伴 -- [知识中心](/zh-cn/explore/knowledge/)——构建你在这里挂载的 RAG 库 -- [记忆](/zh-cn/explore/memory/)——循环读写的个性化记忆 -- [设置](/zh-cn/explore/settings/)——模型、工具、能力与运行时控制 diff --git a/docs/src/content/docs/zh-cn/explore/index.md b/docs/src/content/docs/zh-cn/explore/index.md deleted file mode 100644 index f22f66c70..000000000 --- a/docs/src/content/docs/zh-cn/explore/index.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -title: 串起一次完整学习 -description: 从工作区出发,让主页、学习、资料与账户级的伙伴、个性化协作。 -quadrant: tutorial ---- - -侧栏说明的是**内容属于哪里**。先选择工作区,再在其中的对话、学习活动与来源材料之间切换;你的账户则提供可带入这些工作的伙伴和个性化能力。 - -## 两种范围,五个入口 - -| 入口 | 范围 | 用途 | -| --- | --- | --- | -| [对话](/zh-cn/explore/chat-workspace/) | 工作区 | 对话、任务看板、学习笔记本 | -| [学习](/zh-cn/explore/learning/) | 工作区 | 书籍、精通之路、阅读集合、练习 | -| [资料](/zh-cn/explore/space/) | 工作区 | 聊天记录、收藏夹、题库、学习日志、知识库 | -| [伙伴](/zh-cn/explore/partners/) | 账户 | 持久伙伴的指令、资源访问与渠道 | -| [个性化](/zh-cn/explore/personalization/) | 账户 | 角色、技能、外部智能体、MCP、CLI 应用与记忆控制 | - -**日历是主页中的一个例外**:它提供跨工作区的账户视图,[日历指南](/zh-cn/explore/calendar/)会说明如何辨认事件的来源工作区。伙伴也有明确的工作上下文:身份属于账户,不代表任意对话都能读取所有工作区。 - -## 1. 给项目一个独立工作区 - -为“信号与采样”建立或选择工作区,把讲义和练习与“学术写作”等项目分开。添加材料、开始学习活动前,先检查当前工作区。切换后,前三个入口的内容随之变化,伙伴与个性化库仍然可用。详见[工作区与切换](/zh-cn/explore/workspaces/)。 - -## 2. 先带入来源,再提出具体问题 - -把可复用材料加入[知识库](/zh-cn/explore/knowledge/);如果想对照原文学习,也可以在[阅读](/zh-cn/explore/reading/)中打开具体文档。回到主页附加相关上下文,提出明确问题,例如:“结合这份讲义说明,为什么采样率过低会让两个不同的信号看起来相同?请给出来源。” - -保存过的资产不会自动进入每一次模型请求。应主动附加来源或选择支持的学习上下文,并在继续推导前核对引用段落。 - -## 3. 将证据与自己的理解分开保存 - -把有用的原文保存到[收藏夹](/zh-cn/explore/favorites/),再在[学习笔记本](/zh-cn/explore/co-writer/)中写出自己的解释,按需插入引用。笔记本用于发展理解,收藏夹用于保留以后还能复用的来源。对某个结论有疑问时回到原文;需要改进段落时,在旁边调用 Dito 讨论。 - -## 4. 选择适合目标的学习方式 - -- [书籍](/zh-cn/explore/book/):按页面和交互块组织系统内容。 -- [精通之路](/zh-cn/explore/mastery-path/):将目标拆成主题,并沿路径学习。 -- [阅读](/zh-cn/explore/reading/):围绕原文或媒体时间点提问。 -- [练习](/zh-cn/explore/practice/):作答、检查反馈、复习薄弱环节。 - -它们是不同的学习方式,不是必须依次完成的步骤。从一种开始,使用界面支持的保存与附加操作,把产出带入下一次活动。 - -## 5. 复用助手,不混合项目 - -选择一个要求你解释推理的角色;需要固定方法时,附加相关技能;需要第二种视角时连接外部智能体,或为伙伴设定角色与资源范围。这些账户资产可在另一个工作区继续使用,而每个工作区保留自己的材料与学习记录。 - -## 下次从哪里继续 - -用主页的[任务看板](/zh-cn/explore/task-board/)记录下一步,到[资料](/zh-cn/explore/space/)查找证据与历史,在学习列表中重新打开活动。切换科目时,不必重新安装应用或再创建一遍伙伴。 diff --git a/docs/src/content/docs/zh-cn/explore/learning.md b/docs/src/content/docs/zh-cn/explore/learning.md deleted file mode 100644 index 8a8cf4ded..000000000 --- a/docs/src/content/docs/zh-cn/explore/learning.md +++ /dev/null @@ -1,39 +0,0 @@ ---- -title: 学习 -description: 选择学习方式、继续已有记录,把阅读、结构化学习与每日练习连起来。 -quadrant: explanation ---- - -**学习**是当前工作区的学习区域。从侧栏进入,可新建学习活动、搜索已有记录或接着上次的位置继续。经典布局中该区域称为**个性化学习**。 - -![一个工作区中的学习活动](/screenshots/dev/learning.png) - -## 选择学习方式 - -| 活动 | 从什么开始 | 保留什么 | -| --- | --- | --- | -| [书籍](/zh-cn/explore/book/) | 一个主题和可选来源材料 | 可修改的章节计划、生成页面、阅读位置与页面对话 | -| [精通之路](/zh-cn/explore/mastery-path/) | 描述目标能力的学习目标 | 知识点地图、主题对话与掌握依据 | -| [练习](/zh-cn/explore/practice/) | 已收集或导入的题目 | 作答、错题、回忆评级与下次复习日期 | -| [沉浸式阅读](/zh-cn/explore/reading/) | 文档、网页、视频或音频 | 材料合集、来源关联对话、高亮与笔记 | - -书籍提供连贯读物;精通之路跟踪能力;练习训练回忆;沉浸式阅读紧贴已有来源。先选择适合眼前任务的方式,再按需要衔接其他功能。 - -## 开始与继续 - -1. 检查当前[工作区](/zh-cn/explore/workspaces/)。 -2. 使用学习页的新建控件或侧栏的新建学习入口,选择方式并填写主题、目标或材料。 -3. 从**全部学习**或对应功能资料库重开生成的记录。 -4. 记录增多后,按活动类型筛选或按标题搜索;**显示更多**可展开更早记录。 - -概览按最近更新排列活动。书籍展示阅读进度,路径展示已掌握知识点。**需要你关注的事项**列出到期的路径复习,以及编译中或暂停的书籍;暂停的书籍需要检查,不能当成已完成。一类记录加载失败时可重试,概览不完整不代表记录已删除。 - -## 从一个章节走向长期掌握 - -准备概率论考试时,将课件 PDF 导入阅读,询问难懂证明;再用明确后的目标创建精通之路。把精炼解释存到收藏夹,插入学习笔记本,并写上自己的例题。第二天到练习复习收集的题目。如果需要整门课的连贯讲解,也可生成一本书。 - -[资料](/zh-cn/explore/space/)保存可复用输入与学习结果;**学习日志**记录当前目标、上次会话交接和已确认学习记录,与各项活动自身的进度互补。 - -## 权限与范围 - -可用活动取决于部署中安装的模块、配置的模型以及账号权限。被锁定或缺失的功能可能需要管理员授权或安装模块。学习记录属于当前工作区,切换后资料库会变化;伙伴与个性化可跨工作区使用。共享部署由管理员管理模型目录,用户授权决定模型访问范围。 diff --git a/docs/src/content/docs/zh-cn/explore/partners.md b/docs/src/content/docs/zh-cn/explore/partners.md deleted file mode 100644 index 5b5df0ea6..000000000 --- a/docs/src/content/docs/zh-cn/explore/partners.md +++ /dev/null @@ -1,103 +0,0 @@ ---- -title: 伙伴 -description: 与 DeepTutor 聊天共用同一智能体循环、可接入 IM 渠道的持久学习伙伴——拥有自己的灵魂、资料库、记忆与渠道。 -quadrant: how-to ---- - -伙伴(Partners)是持久的学习伙伴,拥有自己的身份、灵魂(soul)、模型策略、资料库、记忆与渠道配置。它不是另一套机器人引擎:每一条进来的消息——无论来自网页还是 IM 应用——都走**同一个** `ChatOrchestrator → AgenticChatPipeline` 循环,也就是驱动[主页](/zh-cn/explore/chat-workspace/)的那一个。可以把伙伴理解成「一段有了人格、还带了手机号的聊天」。 - -## 它在哪里 - -点击左侧栏的 **Partners**(伙伴)。页面会列出你拥有的伙伴和管理员分配给你的伙伴,包括头像、状态、描述与已连接渠道;下方还会显示 Partner Groups,并提供 **New partner**(新建伙伴)按钮。 - -![伙伴列表](/screenshots/dev/partners.png) - -## 账号伙伴与工作区资源 - -**伙伴属于账号。** 切换工作区后,仍然能看到同一批伙伴与伙伴群组。伙伴的身份、渠道和关系历史,不会因为你从课程切换到研究项目而消失。 - -在 **Configure → Workspace(配置 → 工作区)**中,为资料选择两种方式之一: - -| 方式 | 伙伴使用什么 | 适用场景 | -| --- | --- | --- | -| **Partner private workspace(伙伴私有工作区)** | 自己的资料库;把知识库、技能、收藏夹集合复制进来 | 专职伙伴,需要稳定且独立演进的材料 | -| **现有工作区** | 该工作区最新的文件、知识库、技能和收藏夹集合;生成文件进入它的 outputs 文件夹 | 课程或项目伙伴,需要与实际工作保持同步 | - -选择器列出伙伴所有者的工作区。绑定不会转移所有权,也不会授予其他账号资源的访问权;资源选择及所有者的模型、工具授权仍然约束每一轮。修改绑定从下一条消息生效,不会把旧伙伴会话搬到主页。 - -私有模式中,普通知识库、技能和收藏夹集合在分配时复制,之后修改原始内容不会更新副本。连接型知识库没有可复制的目录,因此受支持的连接保留实时源指针。绑定模式中,请在对应工作区的**资源**中管理共同材料,在**学习**中学习同一批来源;无需再向伙伴复制私有 Library。 - -两种模式都保留伙伴自己的灵魂与关系状态。渠道运行状态在 `data/partners//channels//` 下。已认证非管理员用户的会话与关系记忆按用户隔离在 `users//` 中,伙伴也可以读取该用户自己的共享记忆。管理员及尚未归属账号的渠道消息回退到伙伴顶层历史与记忆。共享材料不会合并这些私有关系。 - -## 所有权与共享访问 - -Partner 已不再是管理员专属资源。任何已认证用户都可以创建 Partner,并自动成为所有者;所有者和管理员可以配置它的灵魂、资料库、渠道、工具、模型与生命周期。管理员也可以把 Partner 分配给其他用户,让对方能够聊天,但看不到也不能修改内部配置。 - -共享 Partner 时,这层分工很重要:身份和知识资产保持一致,每个人的会话与关系记忆仍然私有。外部 IM 账号在私聊中执行 `/link ` 后,也可以进入该用户对应的同一份私有作用域。 - -## 创建一个伙伴 - -点击 **New partner**,走完向导: - -1. **Identity**(身份)——名字、头像、描述、默认回复语言。 -2. **Soul**(灵魂)——伙伴的角色与沟通风格,会落成它的 `SOUL.md`。 -3. **Mind**(心智)——模型选择、启用的系统工具、MCP 工具、投递偏好。 -4. **Library**(资料库)——选择私有工作区并复制获准资产,或绑定现有工作区共享实时资源。私有复制不支持 Obsidian、MarginNote 与 subagent 知识库。 -5. **Review**(确认)——检查身份、模型、工作区与资产后创建伙伴。渠道可以稍后添加,也可以只在网页使用。 - -这里选的一切,之后都能在伙伴详情页里继续修改。 - -## 与伙伴对话 - -打开一个伙伴会进入它的 **Chat** 标签页——一个完整的对话视图,表现得就像主工作台,只是换成了那个伙伴。顶部的标签依次是 **Chat**、**Configure**、**Channels**、**Archive**。 - - -因为伙伴有记忆,它会随时间积累对你的认识。问它「你了解我什么?」,你会看到一个 `Recalling memory` 步骤——伙伴先读取自己的记忆层,再用它的灵魂作答。**Configure** 标签页涵盖身份、灵魂、心智与资料库。**Archive** 是软归档:Resume 会重开同一 session key,Branch 会复制完整历史并归档来源,只有 Delete 才会永久删除。 - -## Partner Groups - -**Partner Group(伙伴群组)**会把两个或更多 Partner 带进同一段共享对话。选好成员、讨论模式和共享记忆模式后,可以让所有成员回答,也可以只 @ 指定成员。每个 Partner 的回复占据独立 seat,因此即使围绕同一段公开讨论推理,各自的观点仍清楚分开。 - -群组拥有自己的会话与持久历史。某个 seat 失败时,可以只重试该成员,而不用让已经完成的回答重跑。Partner Groups 显示在 Partners 页面上各个伙伴卡片的下方;至少要有两个可访问的 Partner 才能组建群组。 - -## 渠道 - -渠道是围绕同一个伙伴大脑的投递适配器。**Channels** 标签页在左侧列出所有支持的应用;选中一个,在右侧配置凭据与行为,然后 **Save** 并启用。页面会轮询正在运行的 Partner,显示连接成功、连接中、listener 正在运行、等待扫码、缺少配置、不可用、连接失败或尚未连接。 - -![伙伴渠道配置](/screenshots/dev/partners-channels.png) - -大多数渠道卡片共用几个开关: - -| 字段 | 含义 | -| --- | --- | -| **Enabled** | 为该伙伴启动这个渠道。收集凭据期间先关着。 | -| **Send Progress** | 为耗时较长的轮次投递叙述/进度。在 IM 里,沉默 60 秒会让人以为坏了,这时很有用。 | -| **Send Tool Hints** | 投递一行式的工具调用提示,如 `rag(query=…)`。生产环境想安静些就关掉。 | -| **Allow From** | 允许的用户 id、群 id、邮箱或 `*`(每行一个)。留空通常拒绝一切;`*` 则完全开放。 | - -每张卡片的其余部分因渠道而异(base URL、token、轮询等)。完整的应用清单与各渠道的配置步骤见[**渠道矩阵**](/zh-cn/partners/channels/)——可以先从[**个人微信**](/zh-cn/partners/weixin/)、[**企业微信**](/zh-cn/partners/wecom/)或 [**QQ / NapCat**](/zh-cn/partners/qq/)开始。 - -需要扫码的渠道也留在浏览器里完成。WeChat/WeCom onboarding 与 WhatsApp bridge 都能把服务端生成的二维码显示在卡片中;在那里扫码或刷新,再观察同一面板从 **Waiting for scan** 进入已连接状态。只有状态详情仍解释不了故障时才需要查日志。 - - -## 把伙伴当作可咨询的智能体 - -伙伴也可以被**连接为智能体**,在普通的一轮聊天里被咨询——DeepTutor 把你的问题送进伙伴自己的会话,再把它的答复收拢回来。详见[我的智能体](/zh-cn/explore/subagents/)。 - -## CLI 对应命令 - -```bash -deeptutor partner list -deeptutor partner create math-tutor --soul "Socratic math tutor" -deeptutor partner start math-tutor -deeptutor partner stop math-tutor -``` - -CLI 适合做冒烟测试,但配置渠道还是推荐用网页 UI——它会对密钥打码,就地展示字段结构,并给出实时配置/运行状态。 - -## 另见 - -- [主页](/zh-cn/explore/chat-workspace/)——同一个循环,只是没有人格与渠道 -- [我的智能体](/zh-cn/explore/subagents/)——在聊天里咨询某个伙伴 -- [伙伴与渠道](/zh-cn/partners/)——完整的渠道配置指南 -- [记忆](/zh-cn/explore/memory/)——伙伴的记忆与你的记忆如何关联 diff --git a/docs/src/content/docs/zh-cn/explore/personalization.md b/docs/src/content/docs/zh-cn/explore/personalization.md deleted file mode 100644 index bcec403fb..000000000 --- a/docs/src/content/docs/zh-cn/explore/personalization.md +++ /dev/null @@ -1,56 +0,0 @@ ---- -title: 个性化 -description: 管理随账号跨工作区复用的子智能体、人格、技能、MCP 服务、CLI 应用和记忆。 -quadrant: how-to ---- - -**个性化(Personalization)**是账号的行为预设与连接资源架。从侧栏进入,可以打开**子智能体、Personas、技能、MCP 服务、CLI 应用、记忆**。从课程工作区切换到研究工作区后,这些入口仍然存在;每个工作区再决定自己的对话可以使用哪些资源。 - -![个性化](/screenshots/dev/personalization.png) - -## 账号资源架与工作区上下文 - -工作区组织实际的工作:**主页**承载对话,**学习**承载阅读与练习,**资源**承载材料。个性化提供处理这些材料的方式。例如,同一个耐心教学人格可以用于微积分和外语课程;两个课程仍分别保留自己的文件、阅读进度与学习主题。 - -| 放在这里的内容 | 用途 | 需要记住的范围 | -| --- | --- | --- | -| **子智能体** | 请教连接的 agent 或 Partner;导入过去的 agent 会话 | 连接属于账号;本机 agent 使用自己配置的工作目录 | -| **Personas** | 复用语气、教学方式、回答规则 | 账号级行为预设,在对话中选择 | -| **技能** | 复用工作流及配套说明 | 账号共享技能库,或明确选择的工作区技能库 | -| **MCP 服务** | 授权外部服务并发现其工具 | 账号连接,以及获准使用的部署级服务 | -| **CLI 应用** | 通过工具运行已安装的命令行程序 | 管理员安装,账号授权决定使用范围 | -| **记忆** | 查看保留的偏好与学习经历 | 个人记忆随学习者保留;Partner 关系记忆另行管理 | - -进入资源库不等于在所有工作区自动获得使用权限。在**设置 → 工作区**中配置允许的技能、MCP 服务和知识库;对话还可以在输入框中进一步缩小技能与 MCP 服务范围。这些选择与当前用户的授权取交集,不会授予其他账号资源的访问权。输入框未做选择时继承工作区设置。配置见[设置](/zh-cn/explore/settings/),材料管理见[资源](/zh-cn/explore/space/)。 - -## 创建并使用人格 - -打开**个性化 → Personas**,创建预设,填写名字、简短说明和 Markdown 指令。尽量描述具体行为,例如「先问学习者的下一步思路,再揭示解法」。保存后在聊天输入框的人格控件中选中,用一个简短问题测试。 - -人格影响回答方式;当前能力仍决定任务与阶段。教师人格可以引导解释,研究助手人格可以引导文献讨论,而不替代能力本身的流程。风格需要调整时编辑自己的预设;不再需要时删除。普通用户看到的部署预设只读;自己的同名人格优先于部署预设。 - -创建 Partner 时,也可以用人格作为灵魂的起点。向导会复制内容,形成 Partner 自己的身份;以后修改原人格,不会自动改写这个 Partner。需要持续陪伴、渠道与关系记忆时,使用[伙伴](/zh-cn/explore/partners/)。 - -## 建立可复用技能库 - -打开**个性化 → 技能**,在创建或导入前先确认 **Skill library(技能库)**。**Account shared skills(账号共享技能)**可以分配给多个工作区;选择某个工作区后,管理的是该工作区的本地技能。启用的工作区同名技能优先于共享版本,因此课程专用流程可以独立演进。 - -适合做成技能的任务包括按评分表审阅作文、把实验记录整理成报告等重复流程。写清触发条件、输入、步骤、输出要求。通过 EduHub 导入社区技能后,先检查指令,再用一个小型真实案例测试。账号版本保留通用流程,课程有不同评分表时再写工作区覆盖版本。详见[技能](/zh-cn/ecosystem/skills/)。 - -## 连接服务与应用 - -需要远程服务时使用 **MCP 服务**。从商店连接,或添加服务器 URL,完成 API key / OAuth 流程,确认连接成功;再把它加入目标工作区的允许范围,按需在对话中选中。如果状态变为 **needs auth**,从 Installed 重新授权。删除连接后工具不可用,也应检查仍引用它的工作区。凭据跟随账号连接保存,不放进工作区文件。 - -需要程序处理文件时使用 **CLI 应用**。管理员安装应用并授予使用权,智能体在沙箱中运行它。技能可以说明何时、如何使用应用,但导入技能不会安装程序,也不会获得程序的执行授权。详见 [MCP 服务](/zh-cn/ecosystem/mcp/)和 [CLI 应用](/zh-cn/ecosystem/cli-apps/)。 - -## 组合使用 - -做文献项目时,在项目**资源**中保留 PDF 与笔记,在**学习**中阅读和标注,再回到**主页**选择研究人格与允许使用的引用技能。任务需要实时查询时,再加入已连接的服务。生成内容与会话上下文仍关联当前工作的工作区。 - -准备考试时,用课程工作区的材料和学习主题搭配教学人格。把通用复习规划技能放在账号共享库,把课程评分规则放在工作区技能库。辅导风格不再适合你时,也可以到**记忆**检查保存了哪些偏好。 - -需要在 IM 中随时联系同伴时,创建账号级 Partner,并选择私有复制资料库或绑定实时工作区。还可以通过子智能体从主页请教它。渠道、资料范围和会话连续性是不同的设置,分别控制在哪里联系、能看到什么、继续哪一段对话。 - -## 找不到资源时 - -先检查账号库,再检查工作区允许范围,最后检查对话选择。共享部署还需要检查用户授权。技能可能存在但被工作区过滤;MCP 服务可能已选中但需要重新授权;CLI 应用可能列在目录里却尚未安装、启用或分配。**设置 → 运行状态**可以帮助区分模块、模型缺失与资源选择问题。 diff --git a/docs/src/content/docs/zh-cn/get-started/desktop.md b/docs/src/content/docs/zh-cn/get-started/desktop.md index f712e384d..38d81875a 100644 --- a/docs/src/content/docs/zh-cn/get-started/desktop.md +++ b/docs/src/content/docs/zh-cn/get-started/desktop.md @@ -48,5 +48,5 @@ Windows 便携 ZIP 在[同一个 Release](https://github.com/HKUDS/DeepTutor/rel ## 下一步 -- [串起一次完整学习](/zh-cn/explore/) — 一个主题、一份材料、一个问题。 +- [串起一次完整学习](/zh-cn/learning-workspace/) — 一个主题、一份材料、一个问题。 - [更新日志](/zh-cn/get-started/changelog/) — 替换旧版桌面应用前先看这里。v1.7.4 更换了运行时签名密钥,需要安装这个版本的应用本身,而不是把更新导入旧版本。 diff --git a/docs/src/content/docs/zh-cn/get-started/docker.md b/docs/src/content/docs/zh-cn/get-started/docker.md index 3b20a64b6..8e66afa92 100644 --- a/docs/src/content/docs/zh-cn/get-started/docker.md +++ b/docs/src/content/docs/zh-cn/get-started/docker.md @@ -22,168 +22,8 @@ docker run --rm --name deeptutor \ 打开 。容器首次启动时会创建 `/app/data/user/settings/*.json`;从 Web 的设置页面里配置模型 provider。配置、API key、日志、默认内容工作区、记忆、知识库、Partner 工作区(`data/partners//`)全部持久化在 `deeptutor-data` volume 里。可选依赖声明在部署上,别钻进容器里装:设好 `DEEPTUTOR_EXTRAS`(系统库用 `DEEPTUTOR_APT_PACKAGES`),每个容器启动时自动补齐。 -## 选择宿主机上的内容工作区 - -默认情况下,内容工作区的存储位于 `deeptutor-data` volume 内部。想改用宿主机上的文件夹,就把它挂到固定的容器路径 `/workspace`,并把 DeepTutor 锁到该路径: - -```bash -mkdir -p "$PWD/deeptutor-workspace/outputs" -docker run --rm --name deeptutor \ - -p 127.0.0.1:3782:3782 \ - -v deeptutor-data:/app/data \ - -v "$PWD/deeptutor-workspace:/workspace" \ - -e DEEPTUTOR_WORKSPACE_ROOT=/workspace \ - -e DEEPTUTOR_WORKSPACE_ALLOWED_ROOTS=/workspace \ - ghcr.io/hkuds/deeptutor:latest -``` - -首次运行前请自己建好 `outputs/`——否则 Docker 会以 root 身份创建这个挂载源,非特权的应用进程写不进去。 - -容器看到的始终是 `/workspace`,因此路径在宿主机间保持可移植。该部署根目录约束所有账号;托管工作区使用 `outputs/.deeptutor/chat/` 下按账号隔离的目录。**Settings → Workspace** 管理各工作区与存储,不会暴露私有运行设置。 - -用 Compose 时,在 `python scripts/docker_compose.py up -d` 之前设好 `DEEPTUTOR_WORKSPACE_HOST=/absolute/host/folder`;辅助脚本会替你建好该文件夹及其 `outputs/`。不设则继续使用 `./data/user/workspace`。 - -## 后台模式 - -加 `-d` 让它在后台跑: - -```bash -docker run -d --name deeptutor \ - -p 127.0.0.1:3782:3782 \ - -v deeptutor-data:/app/data \ - ghcr.io/hkuds/deeptutor:latest - -docker logs -f deeptutor # 跟踪日志 -docker stop deeptutor # 停止 -docker rm deeptutor # 删除(volume 仍保留) -``` - -`deeptutor-data` volume 会在 `stop` / `rm` 之间保留设置和默认内容工作区。如果真要从头来:`docker volume rm deeptutor-data`。 - -## 远程 Docker / 反向代理 - -浏览器始终只跟前端 origin(`:3782`)通信;容器里的 Next.js 中间件会在服务端把 `/api/*` 和 `/ws/*` 转发给 `localhost:8001` 上的后端。所以常见的**单容器**场景下,你完全**不需要**配置任何 API base —— 把反向代理 / TLS 终止器指向发布出来的 `:3782` 即可: - -```text -deeptutor.example.com { - reverse_proxy localhost:3782 -} -``` - -只有**拆分部署**(后端跑在另一个容器或主机上)才需要设置 API base。在挂载 volume 里的 `data/user/settings/system.json` 中,把它设成**前端服务器**用来访问后端的内网地址 —— 这个值由代理在服务端读取,不会发给浏览器: - -```json -{ - "next_public_api_base": "http://backend:8001" -} -``` - -`next_public_api_base_external`(及其别名 `public_api_base`)作为更低优先级的回退被接受,保存时会归一化。 - -CORS 只在开启 auth 且前端跨 origin 时才有意义:`cors_origins` 列出哪些前端页面 origin 可以调用后端。未开启 auth 时,DeepTutor 默认允许正常 HTTP/HTTPS 浏览器 origin。 - -```json -{ - "cors_origins": ["https://deeptutor.example.com"] -} -``` - -## 改宿主机端口 - -改 `-p host:container` 映射的左边即可: - -```bash -docker run --rm --name deeptutor \ - -p 127.0.0.1:8088:3782 \ - -v deeptutor-data:/app/data \ - ghcr.io/hkuds/deeptutor:latest -``` - -如果还想把 API 暴露到宿主机,再加 `-p 127.0.0.1:8089:8001`。如果你在 `/app/data/user/settings/system.json` 里改了容器侧端口,重启并把每条映射右侧同步改掉。 - -## 连本地 LLM(Ollama / LM Studio / llama.cpp / vLLM) - -Docker 里的 `localhost` 指的是容器本身,不是宿主机。要访问宿主机上跑的模型服务,用 host gateway: - -```bash -docker run --rm --name deeptutor \ - -p 127.0.0.1:3782:3782 \ - --add-host=host.docker.internal:host-gateway \ - -v deeptutor-data:/app/data \ - ghcr.io/hkuds/deeptutor:latest -``` - -然后在 **设置 → LLM**(或 **Embedding**)里,把 provider Base URL 指到 `host.docker.internal`: - -| 服务 | Base URL | -|------|----------| -| Ollama LLM | `http://host.docker.internal:11434/v1` | -| Ollama embedding | `http://host.docker.internal:11434/api/embed` | -| LM Studio | `http://host.docker.internal:1234/v1` | -| llama.cpp | `http://host.docker.internal:8080/v1` | - -Docker Desktop(macOS / Windows)通常**不需要** `--add-host` 就能解析 `host.docker.internal`。Linux 上,这个 flag 是在现代 Docker Engine 上创建这个 hostname 的可移植方式。 - -### Linux 替代方案 —— host networking - -加 `--network=host`,去掉 `-p` flags: - -```bash -docker run --rm --name deeptutor \ - --network=host \ - -v deeptutor-data:/app/data \ - ghcr.io/hkuds/deeptutor:latest -``` - -容器直接共享宿主机网络,所以打开 (或 `system.json` 里的 `frontend_port`),宿主机服务也能用普通的 localhost URL 访问,比如 `http://127.0.0.1:11434/v1`。 - -> Host networking 把容器端口直接暴露在宿主机上,可能跟已有服务冲突。 - -## 升级 - -```bash -docker pull ghcr.io/hkuds/deeptutor:latest -docker rm -f deeptutor 2>/dev/null -docker run --rm --name deeptutor \ - -p 127.0.0.1:3782:3782 \ - -v deeptutor-data:/app/data \ - ghcr.io/hkuds/deeptutor:latest -``` - -volume 会保留 —— 你的设置、KB、记忆都能撑过升级。 - -**设置 → 关于** 会识别 Docker 镜像并检查是否有新版本,但替换容器仍属于部署操作:按上面的步骤拉取新镜像并重建容器。DeepTutor 不会在运行中的容器里原地升级包。 - -## 常见错误 - -### `Bind for 0.0.0.0:3782 failed: port is already allocated` - -```bash -lsof -i :3782 # macOS -ss -ltnp | grep :3782 # Linux -``` - -干掉冲突进程,或者在 `-p` 映射里换一个宿主机端口。 - -### 容器立刻退出 - -```bash -docker logs deeptutor | tail -30 -``` - -无效的 LLM 凭据会被捕获并记为 warning,**不会**让后端启动失败。如果容器已经退出,请从日志中寻找其他致命错误。Web UI 可用后,到 **设置 → 模型与服务** 修正凭据即可。 - -### 前端能加载但 API 调用失败(拆分部署) - -用单容器镜像时不该出现这种情况 —— 容器内的代理会自动把 `/api/*` 转发给后端。如果你跑的是**拆分部署**(后端在另一个容器或主机上),在 volume 里的 `data/user/settings/system.json` 把 `next_public_api_base` 设成前端服务器访问后端用的内网地址,然后重启。 - -### Docker 里的多用户模式 - -直接在 volume 的 `data/user/settings/auth.json` 里把 auth 开关打开(`"enabled": true`),然后重启。容器会自动 pick up。完整配置见 [**多用户部署**](/zh-cn/get-started/multi-user/)。 - -更多:[**故障排查**](/zh-cn/get-started/troubleshooting/)。 - ## 下一步 -- [**多用户部署**](/zh-cn/get-started/multi-user/) —— 团队配置 -- [**探索 DeepTutor**](/zh-cn/explore/) —— 看看跑起来的应用 +宿主机目录、后台运行、反向代理、本地模型和升级写在 [Docker 运维](/zh-cn/self-hosting/docker/)。 + +- [**探索 DeepTutor**](/zh-cn/learning-workspace/) diff --git a/docs/src/content/docs/zh-cn/get-started/index.md b/docs/src/content/docs/zh-cn/get-started/index.md index feba6357d..7a2498284 100644 --- a/docs/src/content/docs/zh-cn/get-started/index.md +++ b/docs/src/content/docs/zh-cn/get-started/index.md @@ -12,10 +12,10 @@ DeepTutor 提供 **四种安装路径**,全部使用相同的运行数据目 | 方式 | 适用场景 | 页面 | |------|---------|------| -| **PyPI** | 已发布安装包;1.7.x 完整应用使用 [full] | [**PyPI 安装**](/zh-cn/get-started/pypi/) | -| **源码** | 当前 dev、源码开发与可选热重载 | [**源码安装**](/zh-cn/get-started/from-source/) | +| **PyPI** | 已发布安装包;1.7.x 完整应用使用 [full] | [**PyPI 安装**](/zh-cn/self-hosting/pypi/) | +| **源码** | 当前 dev、源码开发与可选热重载 | [**源码安装**](/zh-cn/self-hosting/source/) | | **Docker** | 生产部署、托管主机、需要持久化卷 | [**Docker**](/zh-cn/get-started/docker/) | -| **纯 CLI** | 无界面服务器、被其他 agent 调度、不需要 Web UI | [**纯 CLI 安装**](/zh-cn/get-started/cli-only/) | +| **纯 CLI** | 无界面服务器、被其他 agent 调度、不需要 Web UI | [**纯 CLI 安装**](/zh-cn/self-hosting/cli-only/) | > **1.7.x 安装:** `deeptutor[full]` 安装完整 Web 应用,裸 `deeptutor` 安装最小 CLI/SDK。修改模块前停止应用,功能 wheel 与 core 保持同版本。开发时使用源码安装,或[构建本地 wheels](https://github.com/HKUDS/DeepTutor/blob/dev/docs-for-dev/MODULES.md);升级旧环境前请备份运行目录。 @@ -45,9 +45,9 @@ DeepTutor 提供 **四种安装路径**,全部使用相同的运行数据目 只要你能打开 `http://localhost:3782/`: -- [**探索 DeepTutor**](/zh-cn/explore/) —— 从工作区出发,串起主页、学习、资料、伙伴与个性化 -- [**DeepTutor CLI**](/zh-cn/cli/) —— 在终端里驱动核心运行时与工作区操作 -- [**伙伴:渠道**](/zh-cn/partners/) —— 把持久化的 AI 导师连到 WeChat、WeCom、QQ、Telegram、Slack、飞书等渠道 -- [**多用户部署**](/zh-cn/get-started/multi-user/) —— 部署给一个团队 +- [**探索 DeepTutor**](/zh-cn/learning-workspace/) —— 从工作区出发,串起主页、学习、资料、伙伴与个性化 +- [**DeepTutor CLI**](/zh-cn/developers/guides/cli/) —— 在终端里驱动核心运行时与工作区操作 +- [**伙伴:渠道**](/zh-cn/channels/) —— 把持久化的 AI 导师连到 WeChat、WeCom、QQ、Telegram、Slack、飞书等渠道 +- [**多用户部署**](/zh-cn/self-hosting/multi-user/) —— 部署给一个团队 -如果遇到问题,跳到 [**故障排查**](/zh-cn/get-started/troubleshooting/)。 +如果遇到问题,跳到 [**故障排查**](/zh-cn/self-hosting/troubleshooting/)。 diff --git a/docs/src/content/docs/zh-cn/index.mdx b/docs/src/content/docs/zh-cn/index.mdx index 78e472899..10514fdbb 100644 --- a/docs/src/content/docs/zh-cn/index.mdx +++ b/docs/src/content/docs/zh-cn/index.mdx @@ -1,66 +1,9 @@ --- title: 首页 -description: 开源学习工作区:对话、练习、研究,以及它们共用的材料。 +description: 开源的 agent-native 学习伴侣。主页、学习和资料跟随工作区;伙伴与个性化属于账户。 template: splash -hero: - title: DeepTutor - tagline: 把对话、原始材料、练习和可复用的协助放在同一个工作区里。 - actions: - - text: 桌面端快速上手 - link: /zh-cn/get-started/desktop/ - icon: right-arrow - - text: Docker 快速上手 - link: /zh-cn/get-started/docker/ - icon: rocket - variant: minimal --- -import { CardGrid, LinkCard } from '@astrojs/starlight/components'; +import HomeLanding from '../../../components/HomeLanding.astro'; -## 从这里开始 - - - - - - - - -## 你可以用 DeepTutor 做什么 - - - - - - - - - - -## 支持的能力 - -能力名、模块 id 和依赖来自 `deeptutor/modules/manifests/`。「做什么」是对该声明的简短说明。可选模块写在句子里,不放进**还需要**列。 - -| 能力 | 模块 | 还需要 | 做什么 | 阅读 | -| --- | --- | --- | --- | --- | -| `chat` | `core` | — | 带工具的日常智能体循环 | [对话](/zh-cn/explore/chat-workspace/) | -| `ask_questions` | `core` | — | 先补齐缺失上下文,再完成原来的请求 | [对话](/zh-cn/explore/chat-workspace/) | -| `deep_solve` | `solve` | — | 多步解答,包括从图片解题 | [对话](/zh-cn/explore/chat-workspace/) | -| `deep_question` | `questions` | `parsing` | 按主题或材料生成练习 | [练习](/zh-cn/explore/practice/) | -| `deep_research` | `research` | — | 带引用的研究报告。知识库模块可选 | [对话](/zh-cn/explore/chat-workspace/) | -| `visualize` | `visualize` | — | SVG、Mermaid、Chart.js 或 HTML。Manim 渲染器可选 | [对话](/zh-cn/explore/chat-workspace/) | -| `math_animator` | `renderer-manim` | — | Manim 数学视频或分镜 | [对话](/zh-cn/explore/chat-workspace/) | -| `mastery_path` | `mastery` | `knowledge` | 带掌握度门槛的自适应路径 | [精通之路](/zh-cn/explore/mastery-path/) | -| `immersive_reading` | `reading` | `knowledge`、`parsing`、`mastery`、`notebook` | 在线程旁边阅读,并把引用指回来源 | [阅读](/zh-cn/explore/reading/) | -| `video_lesson` | `video-lesson` | — | 在浏览器播放的课程,带字幕和可选旁白 | [对话](/zh-cn/explore/chat-workspace/) | - -## 更多资源 - - - - - - - - - + diff --git a/docs/src/content/docs/zh-cn/learning-workspace/agent-loop.md b/docs/src/content/docs/zh-cn/learning-workspace/agent-loop.md new file mode 100644 index 000000000..9fc247a34 --- /dev/null +++ b/docs/src/content/docs/zh-cn/learning-workspace/agent-loop.md @@ -0,0 +1,44 @@ +--- +title: 智能体循环是怎么工作的 +description: 一轮对话如何规划、调用工具、观察结果并结束。 +quadrant: explanation +--- + +对话的一轮不是一次补全。模型可以先调用工具、读到观察,再决定是继续还是回答。操作步骤在[对话](/zh-cn/learning-workspace/chat/)。 + +### Little Tutor——追问一段选区 + +选中对话中的文字并打开 **Little Tutor**,即可启动一条独立、以来源内容为依据的侧栏线程。它嵌套在来源对话下,并使用自己的聚焦上下文而不加载全局记忆或通用工具,因此精读追问不会打断主线程。 + + +## 智能体循环(它是怎么「想」的) + +DeepTutor 聊天运行的是单一智能体循环,因此一条消息在你看到答复前,内部可能要走好几轮: + +1. 模型读取你的消息与已挂载的上下文,然后直接作答,或规划一次工具调用。 +2. 若需要工具,DeepTutor 派发工具并把观测结果追加进来(可在活动面板里实时看到)。 +3. 模型带着更充分的证据继续——阅读资料、检索知识库、运行代码、抓取网页。 +4. 一条不再调用工具的最终消息,结束这一轮。 + +`ask_user` 很特殊:与其瞎猜,智能体可以**暂停这一轮**,向你提出结构化的澄清问题,待你回答后再继续。 + +## 知道窗口有多满 + +输入框上有一个胶囊,报告这一轮实际占用了模型上下文窗口的多少、以及是什么在占——提示词块、工具 schema、消息列表。它是从已经拼装好的提示词上量出来的,不是事后重新推算的,所以这个读数不可能和真正发出去的内容对不上。点开看明细,再决定要不要换一个长上下文模型,或者干脆开一段新会话。 + +长对话还会在正文左侧空白处长出一条刻度轨,你每问一次就多一格,用来在历史里跳来跳去而不必滚动。 + +## 工具——也包括生成 + +工具分三类,区别在于由谁来决定。 + +**由你决定**的是 **Settings → Tools** 里那些体验增强工具:`brainstorm`、`web_search`、`paper_search`、`zotero_search`、`reason` 与 `geogebra_analysis`——配好相应的生成模型后,还会有 `imagegen` 与 `videogen`。 + +**由上下文决定**的是其余那些:它们在有用时自动挂载,从输入框的角度看是常开的——`rag`、`kb_files`、`knowledge_frontier`、`read_source`、`read_memory`、`write_memory`、`read_skill`、`list_favorites`、`save_favorite`、`question_bank`、`web_fetch`、`github`、`preprint`、`research_audit`、`research_lit`、`learning_status`、`learning_update`、`ask_user`、`load_tools`、`cron`、`mastery_topics`、`mastery_sessions`、`mastery_open_session`、`mastery_new_session`,以及唯一的代码路径 `exec`(python、c、cpp 或 shell)。能力还会在此之上追加自己的:八个阅读工具、精通之路的教学工具、`consult_subagent` 等等。还有一类谁也管不着:工作区基础工具包含文件工具及 `write_note`、`search_notes`;`workspace_export` 要经你批准才能把文件移出 `outputs/`。(伙伴是例外:可以逐个禁用受上下文门控的工具——见[伙伴](/zh-cn/channels/)。) + +### 把事情排到以后做 + +`cron` 让一个回合可以把活儿排期而不是当场干完:**在**某个时刻、**每隔** N 秒,或者按一条带时区的 **cron 表达式**。任务到点时,它的消息会作为一条新指令**在同一段对话里**执行,回复也落在这里——所以「工作日每天早上九点就这一章考我」是一句话,而不是一个设置页面。同一个工具还能列出本对话的任务、取消其中一个。对伙伴而言,到点的任务会顺着它所连接的 IM 渠道发回去。 + +在设置里配好一个**图像生成**(或视频生成)模型,它也会变成聊天工具——用自然语言提出需求,智能体便会调用它,并把结果内联预览、附上可下载的文件。 + diff --git a/docs/src/content/docs/zh-cn/explore/book.md b/docs/src/content/docs/zh-cn/learning-workspace/books.md similarity index 95% rename from docs/src/content/docs/zh-cn/explore/book.md rename to docs/src/content/docs/zh-cn/learning-workspace/books.md index 079ae787a..d44e13797 100644 --- a/docs/src/content/docs/zh-cn/explore/book.md +++ b/docs/src/content/docs/zh-cn/learning-workspace/books.md @@ -75,9 +75,9 @@ deeptutor book refresh-fingerprints ## 另见 -- [知识中心](/zh-cn/explore/knowledge/)——构建书所编译自的文档库 -- [主页](/zh-cn/explore/chat-workspace/)——结合上下文讨论书页 -- [CLI 命令](/zh-cn/cli/commands/)——书的维护命令 +- [知识中心](/zh-cn/learning-workspace/knowledge/)——构建书所编译自的文档库 +- [主页](/zh-cn/learning-workspace/chat/)——结合上下文讨论书页 +- [CLI 命令](/zh-cn/developers/reference/cli/)——书的维护命令 ## 工作区与第一本书 diff --git a/docs/src/content/docs/zh-cn/explore/calendar.md b/docs/src/content/docs/zh-cn/learning-workspace/calendar.md similarity index 91% rename from docs/src/content/docs/zh-cn/explore/calendar.md rename to docs/src/content/docs/zh-cn/learning-workspace/calendar.md index 71f3379eb..652c81165 100644 --- a/docs/src/content/docs/zh-cn/explore/calendar.md +++ b/docs/src/content/docs/zh-cn/learning-workspace/calendar.md @@ -32,4 +32,4 @@ quadrant: how-to 将课程存入账号日历。在 `概率论` 工作区添加周五到期的任务,为周三预留学习事件,并在选时段前查看到期复习层。切换到另一个工作区后,周三事件仍可见,任务与学习图层则转为那个项目的内容。 -参见[任务看板](/zh-cn/explore/task-board/)、[练习](/zh-cn/explore/practice/)与[工作区](/zh-cn/explore/workspaces/)。 +参见[任务看板](/zh-cn/learning-workspace/task-board/)、[练习](/zh-cn/learning-workspace/questions/)与[工作区](/zh-cn/learning-workspace/workspaces/)。 diff --git a/docs/src/content/docs/zh-cn/learning-workspace/chat.md b/docs/src/content/docs/zh-cn/learning-workspace/chat.md new file mode 100644 index 000000000..345161f65 --- /dev/null +++ b/docs/src/content/docs/zh-cn/learning-workspace/chat.md @@ -0,0 +1,137 @@ +--- +title: 对话 +description: 发出一轮有用的对话:选工作区、附上材料、看活动面板里的结果。 +quadrant: how-to +--- + +主页是一轮对话发生的地方。这一页只讲怎么发出一轮有用的对话。一轮如何规划、调用工具并停下来,见[智能体循环是怎么工作的](/zh-cn/learning-workspace/agent-loop/)。 + +## 它在哪里 + +先选择[工作区](/zh-cn/learning-workspace/workspaces/),再打开**主页 → 聊天**(`/chat`)。主页还包含[任务看板](/zh-cn/learning-workspace/task-board/)、[学习笔记本](/zh-cn/learning-workspace/notebook/)和[日历](/zh-cn/learning-workspace/calendar/)。聊天、任务与笔记页面随工作区变化;日历事件属于账号级,并叠加工作区学习信息。 + +![主页与对话输入框](/screenshots/dev/overview.png) + +界面分为三个区域: + +| 区域 | 作用 | +| --- | --- | +| **左侧栏** | 顶部为工作区菜单,下方是**主页、学习、资料**。**伙伴**与**个性化**属于账号级。对话会恢复所属学习上下文;工作区菜单可进入设置与工作区管理。经典布局的导航排列有所不同。 | +| **输入框** | 消息框。**左下角**决定这一轮是哪种「能力」,并用 `+` 加入引用;**右下角**提供连接智能体、知识库、人设与模型选择器。麦克风只转写当前消息。 | +| **活动面板**(右上角切换) | 当前会话用到的工具调用、引用、生成的文件、附件与预览,并能快速打开一个 URL 或本地文件。 | + +启用身份认证后,已登录用户还会在侧栏看到 **My profile**。这里显示不可编辑的用户名、角色与加入日期;你可以上传头像,或选择图标和颜色,也可以退出登录。 + +对话上方的右上角图标分别用于:**把有用内容存到收藏夹**、**把整段会话导出为 Markdown**、**展开/收起活动面板**。 + +## 完成第一段有用的对话 + +1. 选中项目工作区,新建聊天。 +2. 用资料控件加入 PDF 或某条保存记录;需要跨资料库检索时挂载知识库。 +3. 说明结果与限制,例如:“基于这份讲义解释采样定理,再给我两道题。先让我尝试,不要直接展示答案。” +4. 在活动面板查看工具进度,打开引用来源或生成文件核对依据。 +5. 将有用结果存到[收藏夹](/zh-cn/learning-workspace/favorites/),或到[学习笔记本](/zh-cn/learning-workspace/notebook/)写自己的理解。之后可从资料 → 聊天历史重开会话。 + +选择连接的智能体默认会作为会话偏好保留;导入旧智能体记录则是在引用材料。同样,附件默认提供当前轮次资料,工作区指令与会话偏好影响后续轮次。回答似乎引用了错误来源或人设时,发送前检查可见的选择标签。 + +## 起始建议 + +空白输入框下方提供解释、解题、练习、规划和研究等起始提示。独立的一条个性化建议取自记忆与近期活动;**换一批**会替换它。选择提示或建议后,内容先进入输入框,供你检查再发送。通过**自定义页面 → 起始提示**可修改常用标题与请求。 + +**Settings → Conversation** 决定喂给它们多少历史:把活动条数调高,建议的取材面更广;调低,则更贴近你刚才在做的事。 + + +## 黏性上下文 vs. 一次性引用 + +DeepTutor 把上下文分成两类,输入框也把它们放在两个不同的位置——这是这一页最关键的一个概念。 + +**黏性会话上下文**会跨轮持续生效,直到你手动更改:能力、工作区或课程绑定、工具、**知识库**、**人设**、**模型**以及 Reading / Mastery 状态。右侧提供相关选择器;通过 Agent 胶囊或 `@` 选中的智能体默认会留在本会话里,而麦克风只填入当前草稿。 + +**引用**位于左侧的 **`+` 按钮**后面,默认只用于*当前这一轮*;可通过复用控件让支持的引用在后续每一轮继续使用。 + + +| `+` 引用 | 拉进什么 | +| --- | --- | +| **Attach files** | 一份 PDF、图片、Office 文档、Markdown 或数据文件,交给智能体阅读。 | +| **Chat History** | 把过去的某段会话作为背景资料。 | +| **My Agents** | 一份导入的 Claude Code / Codex / ChatGPT 对话记录供探查——见[我的智能体](/zh-cn/customize/agents/)。 | +| **Books / Reading / Notebooks / Question Bank** | 一本已编译的书、一个阅读片段、一个已保存的笔记本,或[资料](/zh-cn/learning-workspace/resources/)里的练习题。题目可按材料或分类筛选,**Select all** 会保留先前选择。 | +| **Memory** | 某一份具体的记忆文档——当你希望智能体依据一条你指得出来的事实工作,而不是依据召回碰巧捞上来的东西。 | + +在主 Chat 输入框里键入 **`@`**,会筛选与 Agent 胶囊相同的连接智能体列表,并默认把选中项保留在本会话中。没有实时智能体选择器的跟进界面,则继续用 `@` 打开 Space 引用菜单。 + +### 知识库——把答案锚定到你的资料 + +**数据库图标**打开知识库选择器。未手动选择的对话继承工作区已就绪的指定知识库或默认库;显式选择(包括不选)会持续保留,直到修改。问题需要依据时,智能体从这些库检索。 + +具体怎么检索,取决于这个库绑定的引擎——回答让你意外的时候,这个区别很值得知道。大多数库——LlamaIndex、GraphRAG、LightRAG、链接的现成索引、远端 LightRAG Server、腾讯 IMA 库——由 `rag` 工具服务。**PageIndex OSS** 与 **PageIndex Cloud** 不是:它们的检索本身是 agentic 的,阅读循环会遍历本地或托管文档树,因此这些库被有意排除在 `rag` 列表之外。**Obsidian** 库压根没有索引,会被路由给 Obsidian 能力,由它直接浏览实时文件;**MarginNote 4** 库是同一种形态,由它自己的一组工具来走。 + + +### 人设——设定语气与立场 + +**人物图标**用于选择人设。`Default` 是朴素的助手;内置的 **peer**(同伴)、**research-assistant**(研究助理)、**teacher**(老师)等会改变语气与教学风格。人设在**个性化 → 人设**中管理,并可被伙伴复用。 + + +### 模型——逐轮切换 + +**模型胶囊**决定这一轮用哪个模型。你在设置里配好的每个模型都会列在这里,并标注提供商与上下文窗口,默认模型有标记。处理大文档时切到长上下文模型,闲聊时切到更便宜更快的模型——会话中途即可切换,不丢上下文。 + + +## 活动面板 + +右上角的面板切换按钮会打开 **Activity**(活动)——当前会话用过的工具、引用与文件的实时记录,生成的文件排在你上传的之上,外加一个 **Open** 框,可把 URL 或本地文件拉进应用内的查看器。 + +![对话与活动控制](/screenshots/dev/chat.png) + +一轮进行时,每次工具调用都会折叠成一个紧凑的标题(例如 `Done · 21s`),展开即可查看输入与输出——对话保持清爽,完整轨迹依然可审计。 + +## 内容工作区 + +**内容工作区**是绑定到对话的文件夹。未绑定的会话使用通用工作区,也可为不同项目创建自建工作区。系统工作区保存共享技能和脱敏配置快照;私有运行设置、API key、数据库与记忆仍不属于对话的文件访问范围。 + +在 **Settings → Workspace** 管理根目录、工作区和 **Workspace instructions**。指令从下一轮起对支持的能力生效,但不包括 Deep Research、Quiz 和 Manim;能力规则与权限仍然适用。内置及托管的自建目录默认位于 `/data/user/workspaces`。命令行仍可管理原有内容文件夹绑定: + +```bash +deeptutor workspace show +deeptutor workspace set /absolute/path/to/my-folder +deeptutor workspace reset +``` + +读是自由的,写不是。一个回合产生的一切——下载、生成的文件、代码输出、渲染出的素材——都落在按回合隔离的 `outputs////` 目录下。文件夹的其余部分对执行是只读的;要把生成的文件从 `outputs/` 复制到你自己的材料里,必须经过一次点名了具体来源与去向的 **Allow once** 确认。 + +模型永远看不到绝对路径,只看得到 `outputs/report.docx` 这样的相对路径。它调用 `workspace_present` 时,界面会渲染一份带鉴权、可打开的快照;同一个相对路径也可以直接写进普通的 Markdown 链接或图片。之后再改源文件,不会改变已经呈现出去的快照。 + +在 Docker 与服务器部署下,托管工作区的存储范围由部署文件夹约束——见 [Docker](/zh-cn/get-started/docker/)。 + +## 在手机上 + +窄于平板宽度时,工作区会收成单栏加一个抽屉式侧边栏,于是同一段对话在手机上是能用的,而不是把一个三栏桌面布局渲染到视口之外。 + +## 实用示例 + +```text +挂载一个知识库 + 提问:「讲讲第 4 章,并就我薄弱的点考我。」 +``` + +```text +附加一份 PDF + 提问:「抽取其中的假设,并把最终摘要存进我的笔记本。」 +``` + +```bash +deeptutor run chat "讲讲傅里叶变换" --kb signals +deeptutor chat --capability deep_research --kb papers +``` + +## 另见 + +- [沉浸式阅读](/zh-cn/learning-workspace/reading/)——同一个循环,旁边打开文档或媒体 +- [DeepTutor 生态](/zh-cn/customize/)——智能体可调用的 Skill、MCP 服务与 CLI App +- [伙伴](/zh-cn/channels/)——同一个循环,运行在 IM 伙伴里 +- [我的智能体](/zh-cn/customize/agents/)——在一轮聊天里咨询 Claude Code、Codex 或某个伙伴 +- [知识中心](/zh-cn/learning-workspace/knowledge/)——构建你在这里挂载的 RAG 库 +- [记忆](/zh-cn/learning-workspace/memory/)——循环读写的个性化记忆 +- [设置](/zh-cn/self-hosting/settings/)——模型、工具、能力与运行时控制 +- [智能体循环是怎么工作的](/zh-cn/learning-workspace/agent-loop/) +- [视觉解题](/zh-cn/learning-workspace/vision-solver/) +- [深度研究](/zh-cn/learning-workspace/research/) +- [多模态工作室](/zh-cn/multimodal-studio/) diff --git a/docs/src/content/docs/zh-cn/explore/favorites.md b/docs/src/content/docs/zh-cn/learning-workspace/favorites.md similarity index 90% rename from docs/src/content/docs/zh-cn/explore/favorites.md rename to docs/src/content/docs/zh-cn/learning-workspace/favorites.md index cf4f6179b..e3cd685c6 100644 --- a/docs/src/content/docs/zh-cn/explore/favorites.md +++ b/docs/src/content/docs/zh-cn/learning-workspace/favorites.md @@ -21,7 +21,7 @@ quadrant: how-to ## 在笔记页面中使用收藏 -1. 打开一个[学习笔记本](/zh-cn/explore/co-writer/)页面。 +1. 打开一个[学习笔记本](/zh-cn/learning-workspace/notebook/)页面。 2. 从页面菜单选择**插入收藏**。 3. 搜索**全部收藏**,或按集合和内容类型缩小范围。 4. 预览并选择一条或多条记录,插入顺序与选择顺序一致。 @@ -35,4 +35,4 @@ quadrant: how-to 收藏夹属于当前工作区的资料。它不会自动变成知识库索引或全局记忆。可在提供该入口的工作流中挂载保存内容、将其插入笔记页面,或在创建支持的学习活动时明确选作来源。 -相关流程参见[资料](/zh-cn/explore/space/)、[学习笔记本](/zh-cn/explore/co-writer/)与[知识中心](/zh-cn/explore/knowledge/)。 +相关流程参见[资料](/zh-cn/learning-workspace/resources/)、[学习笔记本](/zh-cn/learning-workspace/notebook/)与[知识中心](/zh-cn/learning-workspace/knowledge/)。 diff --git a/docs/src/content/docs/zh-cn/learning-workspace/index.md b/docs/src/content/docs/zh-cn/learning-workspace/index.md new file mode 100644 index 000000000..ff6f9ab57 --- /dev/null +++ b/docs/src/content/docs/zh-cn/learning-workspace/index.md @@ -0,0 +1,50 @@ +--- +title: 串起一次完整学习 +description: 从工作区出发,让主页、学习、资料与账户级的伙伴、个性化协作。 +quadrant: tutorial +--- + +侧栏说明的是**内容属于哪里**。先选择工作区,再在其中的对话、学习活动与来源材料之间切换;你的账户则提供可带入这些工作的伙伴和个性化能力。 + +## 两种范围,五个入口 + +| 入口 | 范围 | 用途 | +| --- | --- | --- | +| [对话](/zh-cn/learning-workspace/chat/) | 工作区 | 对话、任务看板、学习笔记本 | +| [书籍](/zh-cn/learning-workspace/books/) | 工作区 | 书籍、精通之路、阅读集合、练习 | +| [资料](/zh-cn/learning-workspace/resources/) | 工作区 | 聊天记录、收藏夹、题库、学习日志、知识库 | +| [伙伴](/zh-cn/channels/) | 账户 | 持久伙伴的指令、资源访问与渠道 | +| [个性化](/zh-cn/customize/) | 账户 | 角色、技能、外部智能体、MCP、CLI 应用与记忆控制 | + +**日历是主页中的一个例外**:它提供跨工作区的账户视图,[日历指南](/zh-cn/learning-workspace/calendar/)会说明如何辨认事件的来源工作区。伙伴也有明确的工作上下文:身份属于账户,不代表任意对话都能读取所有工作区。 + +## 1. 给项目一个独立工作区 + +为“信号与采样”建立或选择工作区,把讲义和练习与“学术写作”等项目分开。添加材料、开始学习活动前,先检查当前工作区。切换后,前三个入口的内容随之变化,伙伴与个性化库仍然可用。详见[工作区与切换](/zh-cn/learning-workspace/workspaces/)。 + +## 2. 先带入来源,再提出具体问题 + +把可复用材料加入[知识库](/zh-cn/learning-workspace/knowledge/);如果想对照原文学习,也可以在[阅读](/zh-cn/learning-workspace/reading/)中打开具体文档。回到主页附加相关上下文,提出明确问题,例如:“结合这份讲义说明,为什么采样率过低会让两个不同的信号看起来相同?请给出来源。” + +保存过的资产不会自动进入每一次模型请求。应主动附加来源或选择支持的学习上下文,并在继续推导前核对引用段落。 + +## 3. 将证据与自己的理解分开保存 + +把有用的原文保存到[收藏夹](/zh-cn/learning-workspace/favorites/),再在[学习笔记本](/zh-cn/learning-workspace/notebook/)中写出自己的解释,按需插入引用。笔记本用于发展理解,收藏夹用于保留以后还能复用的来源。对某个结论有疑问时回到原文;需要改进段落时,在旁边调用 Dito 讨论。 + +## 4. 选择适合目标的学习方式 + +- [书籍](/zh-cn/learning-workspace/books/):按页面和交互块组织系统内容。 +- [精通之路](/zh-cn/learning-workspace/mastery/):将目标拆成主题,并沿路径学习。 +- [阅读](/zh-cn/learning-workspace/reading/):围绕原文或媒体时间点提问。 +- [练习](/zh-cn/learning-workspace/questions/):作答、检查反馈、复习薄弱环节。 + +它们是不同的学习方式,不是必须依次完成的步骤。从一种开始,使用界面支持的保存与附加操作,把产出带入下一次活动。 + +## 5. 复用助手,不混合项目 + +选择一个要求你解释推理的角色;需要固定方法时,附加相关技能;需要第二种视角时连接外部智能体,或为伙伴设定角色与资源范围。这些账户资产可在另一个工作区继续使用,而每个工作区保留自己的材料与学习记录。 + +## 下次从哪里继续 + +用主页的[任务看板](/zh-cn/learning-workspace/task-board/)记录下一步,到[资料](/zh-cn/learning-workspace/resources/)查找证据与历史,在学习列表中重新打开活动。切换科目时,不必重新安装应用或再创建一遍伙伴。 diff --git a/docs/src/content/docs/zh-cn/explore/knowledge.md b/docs/src/content/docs/zh-cn/learning-workspace/knowledge.md similarity index 82% rename from docs/src/content/docs/zh-cn/explore/knowledge.md rename to docs/src/content/docs/zh-cn/learning-workspace/knowledge.md index 72e51aab2..2cfc0d67b 100644 --- a/docs/src/content/docs/zh-cn/explore/knowledge.md +++ b/docs/src/content/docs/zh-cn/learning-workspace/knowledge.md @@ -4,7 +4,7 @@ description: 创建、版本化、同步、检查并复用为主页、伙伴、 quadrant: how-to --- -知识空间是你构建与管理 **RAG** 背后文档库的地方;在 Web UI 中,这个入口显示为 **Knowledge Center / 知识中心**。一个知识库(KB)可以为主页对话、学习笔记本、书籍生成与伙伴对话提供依据。本页聚焦 KB 生命周期;引擎架构与选型归入 [RAG 集成](/zh-cn/ecosystem/rag-integration/)。 +知识空间是你构建与管理 **RAG** 背后文档库的地方;在 Web UI 中,这个入口显示为 **Knowledge Center / 知识中心**。一个知识库(KB)可以为主页对话、学习笔记本、书籍生成与伙伴对话提供依据。本页聚焦 KB 生命周期;引擎架构与选型归入 [RAG 集成](/zh-cn/customize/rag/)。 ## 它在哪里 @@ -14,7 +14,7 @@ quadrant: how-to ## 选择 RAG 集成 -每个 KB 都绑定一个检索集成。打开 **Knowledge engines**,目录会按 Local、Server、Cloud 与 External knowledge sources 分组;建库前即可看到 **Ready**、**Needs key**、**Needs setup** 或 **Not installed**。完整比较见 [RAG 集成](/zh-cn/ecosystem/rag-integration/),其中 PageIndex OSS 与 PageIndex Cloud 是两个不同 contract。 +每个 KB 都绑定一个检索集成。打开 **Knowledge engines**,目录会按 Local、Server、Cloud 与 External knowledge sources 分组;建库前即可看到 **Ready**、**Needs key**、**Needs setup** 或 **Not installed**。完整比较见 [RAG 集成](/zh-cn/customize/rag/),其中 PageIndex OSS 与 PageIndex Cloud 是两个不同 contract。 ## 创建一个知识库 @@ -62,22 +62,7 @@ MarginNote 显示 **Devices** 与 **Settings**,由 add-on 推送数据。Kiwix | **PyMuPDF4LLM** | 轻量、无下载、无需 CUDA。转换 PDF、电子书、XPS、图片、文本与 Markdown,并可抽取图片。`pip install deeptutor[parse-pymupdf4llm]`。 | | **LiteParse** | 轻量结构化解析,无需下载本地模型。`pip install deeptutor[parse-liteparse]`。 | -## CLI 对应命令 - -```bash -deeptutor kb list -deeptutor kb create physics --doc chapter1.pdf -deeptutor kb create textbooks --docs-dir ./pdfs -deeptutor kb connect-kiwix wiki --server-url http://localhost:8080 --zim-name wikipedia_en -deeptutor kb add physics --doc chapter2.pdf -deeptutor kb add-github-source physics --repo owner/repo --branch main --path docs --glob '*.md' -deeptutor kb add-web-source physics --url https://docs.example.com --max-depth 3 --max-pages 200 -deeptutor kb list-sources physics -deeptutor kb sync physics -deeptutor kb search physics "What is angular momentum?" -deeptutor kb eval physics --dataset physics-qa.jsonl --top-k 5 --format json -deeptutor kb set-default physics -``` +同样的操作在 CLI 里。见[命令参考](/zh-cn/developers/reference/cli/)。 ## 提示 @@ -89,12 +74,12 @@ deeptutor kb set-default physics ## 另见 -- [RAG 集成](/zh-cn/ecosystem/rag-integration/)——比较知识库背后的知识引擎 -- [主页](/zh-cn/explore/chat-workspace/)——把 KB 挂到一轮里 -- [沉浸式阅读](/zh-cn/explore/reading/)——读一份文档,而不是给一整个语料库建索引 -- [书籍](/zh-cn/explore/book/)——从 KB 编译学习材料 -- [伙伴](/zh-cn/explore/partners/)——把 KB 拷贝进伙伴工作区 -- [设置](/zh-cn/explore/settings/)——embedding 提供商与解析引擎 +- [RAG 集成](/zh-cn/customize/rag/)——比较知识库背后的知识引擎 +- [主页](/zh-cn/learning-workspace/chat/)——把 KB 挂到一轮里 +- [沉浸式阅读](/zh-cn/learning-workspace/reading/)——读一份文档,而不是给一整个语料库建索引 +- [书籍](/zh-cn/learning-workspace/books/)——从 KB 编译学习材料 +- [伙伴](/zh-cn/channels/)——把 KB 拷贝进伙伴工作区 +- [设置](/zh-cn/self-hosting/settings/)——embedding 提供商与解析引擎 ## 在工作区中使用知识库 diff --git a/docs/src/content/docs/zh-cn/explore/mastery-path.md b/docs/src/content/docs/zh-cn/learning-workspace/mastery.md similarity index 91% rename from docs/src/content/docs/zh-cn/explore/mastery-path.md rename to docs/src/content/docs/zh-cn/learning-workspace/mastery.md index be5f0083c..b28582379 100644 --- a/docs/src/content/docs/zh-cn/explore/mastery-path.md +++ b/docs/src/content/docs/zh-cn/learning-workspace/mastery.md @@ -37,9 +37,9 @@ quadrant: how-to ## 另见 -- [资料](/zh-cn/explore/space/)——复用材料与个性化预设的资料库 -- [沉浸式阅读](/zh-cn/explore/reading/)——把正在阅读的资料组转成新的精通之路 -- [主页](/zh-cn/explore/chat-workspace/)——学习对话背后共用的智能体循环 +- [资料](/zh-cn/learning-workspace/resources/)——复用材料与个性化预设的资料库 +- [沉浸式阅读](/zh-cn/learning-workspace/reading/)——把正在阅读的资料组转成新的精通之路 +- [主页](/zh-cn/learning-workspace/chat/)——学习对话背后共用的智能体循环 ## 把目标写成可验证的能力 diff --git a/docs/src/content/docs/zh-cn/explore/memory.md b/docs/src/content/docs/zh-cn/learning-workspace/memory.md similarity index 77% rename from docs/src/content/docs/zh-cn/explore/memory.md rename to docs/src/content/docs/zh-cn/learning-workspace/memory.md index 82659ffd3..c1fa786f9 100644 --- a/docs/src/content/docs/zh-cn/explore/memory.md +++ b/docs/src/content/docs/zh-cn/learning-workspace/memory.md @@ -32,27 +32,7 @@ quadrant: explanation L2 到 L1 可指向具体实体。当前 L3 引用界面名,因此图谱只画到对应 L2 集群的软连接,而非精确的端到端链。可先定位支撑领域,再检查相关事实与实体。 -## 调校整理器 - -**Settings → Memory** 设置 **Update** / **Audit** 的 LLM 预算、**Dedup** 迭代、分块与引用校验,以及不调用 LLM 的脚注合并。改动保存到 `data/user/settings/main.yaml`。 - - -| 模式 | 作用 | -| --- | --- | -| **Update** | 增量事实抽取,设置 L2 与 L3 预算;逐文档覆盖项在工作台里。 | -| **Audit** | 对照来源实体或 L2 事实做行级修订。 | -| **Dedup** | 对整篇文档迭代去重;当某轮迭代产出零修改时提前停止。 | -| **Merge footnotes** | 不调用 LLM:合并并重排重复引用;三个开关控制在 Update、Audit 或 Dedup 后自动运行。 | - -## CLI - -```bash -deeptutor memory show L3 -deeptutor memory show L2 -deeptutor memory show profile -deeptutor memory show chat -deeptutor memory clear trace --force -``` +Update、Audit 和 Dedup 的预算在 **设置 → 记忆**。见[设置](/zh-cn/self-hosting/settings/)。`deeptutor memory show` 可以打印某一层;参数见[命令参考](/zh-cn/developers/reference/cli/)。 ## 实践建议 @@ -63,9 +43,9 @@ deeptutor memory clear trace --force ## 另见 -- [主页](/zh-cn/explore/chat-workspace/)——读写记忆的那个循环 -- [伙伴](/zh-cn/explore/partners/)——伙伴的记忆与你的记忆如何关联 -- [设置](/zh-cn/explore/settings/)——完整的控制面板 +- [主页](/zh-cn/learning-workspace/chat/)——读写记忆的那个循环 +- [伙伴](/zh-cn/channels/)——伙伴的记忆与你的记忆如何关联 +- [设置](/zh-cn/self-hosting/settings/)——完整的控制面板 ## 账号级个性化与工作区依据 diff --git a/docs/src/content/docs/zh-cn/explore/co-writer.md b/docs/src/content/docs/zh-cn/learning-workspace/notebook.md similarity index 89% rename from docs/src/content/docs/zh-cn/explore/co-writer.md rename to docs/src/content/docs/zh-cn/learning-workspace/notebook.md index 40636e57d..304d5483c 100644 --- a/docs/src/content/docs/zh-cn/explore/co-writer.md +++ b/docs/src/content/docs/zh-cn/learning-workspace/notebook.md @@ -27,7 +27,7 @@ quadrant: how-to ## 将来源带入自己的写作 -使用**插入收藏**搜索、预览并插入[收藏夹](/zh-cn/explore/favorites/)中的原始记录,也可请 Dito 将多个收藏整理成带引用的笔记。来源插入与知识库操作帮助笔记依据可回看的材料。 +使用**插入收藏**搜索、预览并插入[收藏夹](/zh-cn/learning-workspace/favorites/)中的原始记录,也可请 Dito 将多个收藏整理成带引用的笔记。来源插入与知识库操作帮助笔记依据可回看的材料。 例如新建 `条件概率`,插入保存的解释,再写自己的反例。请 Dito 检查论证并建议更清楚的段落,审阅后再应用;另建 `练习` 子页,记录这个主题引出的题目。 @@ -39,4 +39,4 @@ quadrant: how-to 页面菜单支持导出 **Markdown** 或 **Word**。Word 保留文字与来源链接,互动块会变成静态内容;提交或分享前应检查导出结果。收藏夹适合存放原始来源,学习笔记本适合保存自己的综合理解、结构和学习活动。 -笔记页面属于当前工作区,切换工作区会改变页面库。[个性化](/zh-cn/explore/memory/)可跨工作区影响助手的帮助方式,而页面内容留在所属项目。 +笔记页面属于当前工作区,切换工作区会改变页面库。[个性化](/zh-cn/learning-workspace/memory/)可跨工作区影响助手的帮助方式,而页面内容留在所属项目。 diff --git a/docs/src/content/docs/zh-cn/explore/practice.md b/docs/src/content/docs/zh-cn/learning-workspace/questions.md similarity index 81% rename from docs/src/content/docs/zh-cn/explore/practice.md rename to docs/src/content/docs/zh-cn/learning-workspace/questions.md index c2d0a90be..d901c680d 100644 --- a/docs/src/content/docs/zh-cn/explore/practice.md +++ b/docs/src/content/docs/zh-cn/learning-workspace/questions.md @@ -1,5 +1,5 @@ --- -title: 练习 +title: 出题与练习 description: 收集与导入题目、复习错题,并安排下一次主动回忆。 quadrant: how-to --- @@ -8,6 +8,11 @@ quadrant: how-to ![练习会话](/screenshots/dev/practice.png) + +## 生成一套题 + +在[对话](/zh-cn/learning-workspace/chat/)里选择 **测验**。针对一个主题出题,或先附上材料。题目看起来可用时,收进这个工作区的题库,再用下面的步骤复习。 + ## 建立题目集合 受支持的聊天、书籍和精通之路活动产生的题目可以汇入题库。也能导入自己的材料,无需全部重新生成。 @@ -41,4 +46,4 @@ quadrant: how-to ## 与导师衔接 -同一题反复出错时,返回来源对话,或在[阅读](/zh-cn/explore/reading/)中打开相应材料。请助手解释,再到[学习笔记本](/zh-cn/explore/co-writer/)写一个自己的例子。需要评估更完整的能力时使用[精通之路](/zh-cn/explore/mastery-path/);练习的回忆日程与路径的掌握门槛用途不同。 +同一题反复出错时,返回来源对话,或在[阅读](/zh-cn/learning-workspace/reading/)中打开相应材料。请助手解释,再到[学习笔记本](/zh-cn/learning-workspace/notebook/)写一个自己的例子。需要评估更完整的能力时使用[精通之路](/zh-cn/learning-workspace/mastery/);练习的回忆日程与路径的掌握门槛用途不同。 diff --git a/docs/src/content/docs/zh-cn/explore/reading.md b/docs/src/content/docs/zh-cn/learning-workspace/reading.md similarity index 95% rename from docs/src/content/docs/zh-cn/explore/reading.md rename to docs/src/content/docs/zh-cn/learning-workspace/reading.md index 2807b38b3..a1f68b7bd 100644 --- a/docs/src/content/docs/zh-cn/explore/reading.md +++ b/docs/src/content/docs/zh-cn/learning-workspace/reading.md @@ -93,10 +93,10 @@ deeptutor run immersive_reading "Summarise the method section" ## 参见 -- [主页](/zh-cn/explore/chat-workspace/)——这个能力所运行的循环 -- [知识中心](/zh-cn/explore/knowledge/)——建一整个语料库的索引,而不是读一份文档 -- [资料](/zh-cn/explore/space/)——把读到的东西存进笔记本 -- [服务端 API](/zh-cn/cli/server-api/#沉浸式阅读)——`/api/reading` 接口 +- [主页](/zh-cn/learning-workspace/chat/)——这个能力所运行的循环 +- [知识中心](/zh-cn/learning-workspace/knowledge/)——建一整个语料库的索引,而不是读一份文档 +- [资料](/zh-cn/learning-workspace/resources/)——把读到的东西存进笔记本 +- [服务端 API](/zh-cn/developers/reference/http-api/#沉浸式阅读)——`/api/reading` 接口 ## 区分阅读合集与工作区 diff --git a/docs/src/content/docs/zh-cn/learning-workspace/research.md b/docs/src/content/docs/zh-cn/learning-workspace/research.md new file mode 100644 index 000000000..2abf8ca2c --- /dev/null +++ b/docs/src/content/docs/zh-cn/learning-workspace/research.md @@ -0,0 +1,24 @@ +--- +title: 深度研究 +description: 对一个问题运行 Deep Research,并把带引用的报告放进笔记本。 +quadrant: how-to +--- + +**Research**(`deep_research`)调查一个问题并返回带引用的报告。对话回答太薄、又需要把来源和写作留在一起时用它。 + +## 做出一份带引用的报告 + +1. 在项目工作区打开[对话](/zh-cn/learning-workspace/chat/)。 +2. 在 **More Capabilities** 里选择 **Research**。 +3. 来源应该来自你的资料时,附上一个知识库。否则这一轮可以使用工作区已经允许的网页和预印本检索。 +4. 只问一个问题,并写明报告要回答什么。例如:“2023 年之后,检索增强生成有哪些变化?引用你用到的论文,最多六篇。” +5. 等到报告出现在线程里。采信某个说法之前,打开它引用的材料。 + +## 归档 + +把准备引用的段落存进[收藏夹](/zh-cn/learning-workspace/favorites/)。报告要变成你自己的草稿时,在[笔记本](/zh-cn/learning-workspace/notebook/)里继续写。收藏夹保留来源,笔记本保留你的文字。 + +## 另见 + +- [知识库](/zh-cn/learning-workspace/knowledge/) — 建立你附上的资料库 +- [智能体循环是怎么工作的](/zh-cn/learning-workspace/agent-loop/) diff --git a/docs/src/content/docs/zh-cn/explore/space.md b/docs/src/content/docs/zh-cn/learning-workspace/resources.md similarity index 67% rename from docs/src/content/docs/zh-cn/explore/space.md rename to docs/src/content/docs/zh-cn/learning-workspace/resources.md index 09f33d37b..f8a2d234b 100644 --- a/docs/src/content/docs/zh-cn/explore/space.md +++ b/docs/src/content/docs/zh-cn/learning-workspace/resources.md @@ -4,7 +4,7 @@ description: 查找当前工作区的对话、收藏、学习日志、题目与 quadrant: how-to --- -**资料**是当前[工作区](/zh-cn/explore/workspaces/)可复用材料的入口,从侧栏打开(`/space`)。经典布局称其为**学习空间(Learning Space)**。这里保存可带回聊天和学习活动的输入与记录。 +**资料**是当前[工作区](/zh-cn/learning-workspace/workspaces/)可复用材料的入口,从侧栏打开(`/space`)。经典布局称其为**学习空间(Learning Space)**。这里保存可带回聊天和学习活动的输入与记录。 ![当前工作区的资料](/screenshots/dev/resources.png) @@ -13,10 +13,10 @@ quadrant: how-to | 资料 | 保存什么 | 下一步怎么用 | | --- | --- | --- | | **聊天历史** | 历史对话、组织方式与来源上下文 | 重开原对话,或在新轮次引用 | -| **[收藏夹](/zh-cn/explore/favorites/)** | 收藏的原始对话和结果集合 | 把选中记录插入学习笔记本页面 | +| **[收藏夹](/zh-cn/learning-workspace/favorites/)** | 收藏的原始对话和结果集合 | 把选中记录插入学习笔记本页面 | | **学习日志** | 当前目标、会话交接与已确认学习记录 | 继续之前先回顾目标 | -| **题库** | 题目、作答、解析与错题 | 选一组进入[练习](/zh-cn/explore/practice/) | -| **[知识中心](/zh-cn/explore/knowledge/)** | 知识库与检索集成 | 将可用知识库挂载到对话或学习任务 | +| **题库** | 题目、作答、解析与错题 | 选一组进入[练习](/zh-cn/learning-workspace/questions/) | +| **[知识中心](/zh-cn/learning-workspace/knowledge/)** | 知识库与检索集成 | 将可用知识库挂载到对话或学习任务 | 计数帮助你找到已有内容。范围随当前工作区和资源可用性变化;计数加载失败不代表底层记录消失。 @@ -25,7 +25,7 @@ quadrant: how-to 1. 选择对应学科的工作区。 2. 需要反复检索时,把来源文档加入知识库;需要对照原文讨论时使用阅读。 3. 在聊天、阅读、书籍或精通之路中学习,并将有用结果存到收藏夹。 -4. 从**主页**打开[学习笔记本](/zh-cn/explore/co-writer/),撰写自己的笔记,按需插入收藏与来源链接。 +4. 从**主页**打开[学习笔记本](/zh-cn/learning-workspace/notebook/),撰写自己的笔记,按需插入收藏与来源链接。 5. 回到题库整理题目,到练习进行有日程的主动回忆。 例如,讲义 PDF 放入 `信号` 知识库,清楚的解释放入收藏集合,自己的推导写入笔记页面。它们相互配合,但用途不同。 @@ -44,7 +44,7 @@ quadrant: how-to ## 接着了解 -- [工作区](/zh-cn/explore/workspaces/)——整理材料前先选容器。 -- [学习](/zh-cn/explore/learning/)——创建与继续学习活动。 -- [主页](/zh-cn/explore/chat-workspace/)——为当前轮次挂载合适材料。 -- [DeepTutor 生态](/zh-cn/ecosystem/)——配置检索、技能与连接工具。 +- [工作区](/zh-cn/learning-workspace/workspaces/)——整理材料前先选容器。 +- [学习](/zh-cn/learning-workspace/)——创建与继续学习活动。 +- [主页](/zh-cn/learning-workspace/chat/)——为当前轮次挂载合适材料。 +- [DeepTutor 生态](/zh-cn/customize/)——配置检索、技能与连接工具。 diff --git a/docs/src/content/docs/zh-cn/explore/task-board.md b/docs/src/content/docs/zh-cn/learning-workspace/task-board.md similarity index 74% rename from docs/src/content/docs/zh-cn/explore/task-board.md rename to docs/src/content/docs/zh-cn/learning-workspace/task-board.md index 7c532116a..62b59a2cd 100644 --- a/docs/src/content/docs/zh-cn/explore/task-board.md +++ b/docs/src/content/docs/zh-cn/learning-workspace/task-board.md @@ -16,10 +16,10 @@ quadrant: how-to 4. 用**今天**或**本周**按日期缩小范围。 5. 完成后可归档,清理当前视图;需要时从归档视图恢复。 -截止日期显示在卡片上,未完成的逾期任务会被突出显示。卡片还可以显示关联的日历时间块数量。打开[日历](/zh-cn/explore/calendar/)为工作安排时间;截止日期与预留学习时段不同,设置截止日期本身并不意味着已经安排执行时段。 +截止日期显示在卡片上,未完成的逾期任务会被突出显示。卡片还可以显示关联的日历时间块数量。打开[日历](/zh-cn/learning-workspace/calendar/)为工作安排时间;截止日期与预留学习时段不同,设置截止日期本身并不意味着已经安排执行时段。 ## 一套复习看板 新建“阅读条件概率证明”“写自己的例子”“完成今日复习”三个任务。阅读合集、笔记页面和练习会话仍在各自学习界面,看板只记录下一步行动。完成后逐个推进卡片,考试结束再归档。 -看板跟随当前[工作区](/zh-cn/explore/workspaces/);从 `概率论` 切到 `研究项目` 时,会展示后者的任务。日历事件仍属于账号级,同时叠加工作区任务与学习信息。 +看板跟随当前[工作区](/zh-cn/learning-workspace/workspaces/);从 `概率论` 切到 `研究项目` 时,会展示后者的任务。日历事件仍属于账号级,同时叠加工作区任务与学习信息。 diff --git a/docs/src/content/docs/zh-cn/learning-workspace/vision-solver.md b/docs/src/content/docs/zh-cn/learning-workspace/vision-solver.md new file mode 100644 index 000000000..341ae0088 --- /dev/null +++ b/docs/src/content/docs/zh-cn/learning-workspace/vision-solver.md @@ -0,0 +1,30 @@ +--- +title: 视觉解题 +description: 在对话里解出一张题目照片,再把这道题留到练习里。 +quadrant: how-to +--- + +视觉解题是 **Solve** 能力在读一张图片。同一轮可以规划步骤、做检查;几何图形还可以调用 GeoGebra。 + +## 解出一张照片 + +1. 在这个学科的工作区打开[对话](/zh-cn/learning-workspace/chat/)。 +2. 在能力菜单里打开 **More Capabilities**,选择 **Solve**。 +3. 用 **+** 附上题目照片。裁到你要解的那一题。 +4. 发送:“解这道题。先写出每一步,再给最终答案。图看不清就停下来问我。” +5. 在线程里核对步骤。需要工具轨迹时打开活动面板。 + +线程里出现一份你能对照照片核对的解答,这条路径就完成了。 + +## 几何图形 + +如果照片是几何作图,发送前在 **设置 → 工具** 里打开 `geogebra_analysis`。Solve 可以把图形转成 GeoGebra 命令。纯代数题保持关闭。 + +## 把题目留下来 + +解答值得再练时,收进[出题与练习](/zh-cn/learning-workspace/questions/)。要检验一个更大的主题,用[精通之路](/zh-cn/learning-workspace/mastery/),而不是这一张照片。 + +## 另见 + +- [智能体循环是怎么工作的](/zh-cn/learning-workspace/agent-loop/) +- [数学动画](/zh-cn/multimodal-studio/math-animator/) — 弄懂步骤之后,把推导做成动画 diff --git a/docs/src/content/docs/zh-cn/explore/workspaces.md b/docs/src/content/docs/zh-cn/learning-workspace/workspaces.md similarity index 87% rename from docs/src/content/docs/zh-cn/explore/workspaces.md rename to docs/src/content/docs/zh-cn/learning-workspace/workspaces.md index 345ef2844..d7ece5d7b 100644 --- a/docs/src/content/docs/zh-cn/explore/workspaces.md +++ b/docs/src/content/docs/zh-cn/learning-workspace/workspaces.md @@ -48,4 +48,4 @@ quadrant: how-to ## 一套实际学习流程 -创建 `信号与系统`,放入课件并分配对应知识库。在[主页](/zh-cn/explore/chat-workspace/)询问简短解释,到[沉浸式阅读](/zh-cn/explore/reading/)打开原文,为目标技能创建[精通之路](/zh-cn/explore/mastery-path/)。把有用回答存到[收藏夹](/zh-cn/explore/favorites/),在[学习笔记本](/zh-cn/explore/co-writer/)写自己的总结,再用[练习](/zh-cn/explore/practice/)进行每日回忆。这些内容始终围绕同一工作区组织。 +创建 `信号与系统`,放入课件并分配对应知识库。在[主页](/zh-cn/learning-workspace/chat/)询问简短解释,到[沉浸式阅读](/zh-cn/learning-workspace/reading/)打开原文,为目标技能创建[精通之路](/zh-cn/learning-workspace/mastery/)。把有用回答存到[收藏夹](/zh-cn/learning-workspace/favorites/),在[学习笔记本](/zh-cn/learning-workspace/notebook/)写自己的总结,再用[练习](/zh-cn/learning-workspace/questions/)进行每日回忆。这些内容始终围绕同一工作区组织。 diff --git a/docs/src/content/docs/zh-cn/multimodal-studio/index.md b/docs/src/content/docs/zh-cn/multimodal-studio/index.md new file mode 100644 index 000000000..ea70eaef3 --- /dev/null +++ b/docs/src/content/docs/zh-cn/multimodal-studio/index.md @@ -0,0 +1,17 @@ +--- +title: 该用哪种生成 +description: Visualize、Math Animator 和 Video Lesson 分别解决什么样的观看需求。 +quadrant: explanation +--- + +DeepTutor 有三种生成器。它们共用对话线程和模型,回答的是不同的事。 + +| 生成器 | 你想要 | 得到什么 | +| --- | --- | --- | +| [Visualize](/zh-cn/multimodal-studio/visualize/) | 一张能读的图:曲线、示意图、一小页可交互内容 | 线程里的 SVG、Mermaid、Chart.js 或 HTML | +| [Math Animator](/zh-cn/multimodal-studio/math-animator/) | 必须动起来的推导或几何作图 | Manim 视频或分镜 | +| [Video Lesson](/zh-cn/multimodal-studio/video-lesson/) | 一段可以播放、带字幕的短课 | 浏览器里的课程,旁白可选 | + +Visualize 也可以把数学动画交给 Manim 渲染器。主题本身是数学、并且要看过程时,走 Math Animator。Video Lesson 是一节课,不是一张图:它写出序列、检查渲染,再在浏览器里播放。 + +三种都是同一个[智能体循环](/zh-cn/learning-workspace/agent-loop/)上的能力。缺少系统工具(LaTeX、ffmpeg,或源码安装所需的 Node)会让渲染停住,并不会改变你该选哪一种生成器。 diff --git a/docs/src/content/docs/zh-cn/multimodal-studio/math-animator.md b/docs/src/content/docs/zh-cn/multimodal-studio/math-animator.md new file mode 100644 index 000000000..72254593e --- /dev/null +++ b/docs/src/content/docs/zh-cn/multimodal-studio/math-animator.md @@ -0,0 +1,23 @@ +--- +title: 数学动画 +description: 在对话里渲染一段 Manim 数学动画。 +quadrant: how-to +--- + +**Math Animator**(`math_animator`)为一则推导或作图写一个 Manim 场景,并渲染成视频或分镜。执行渲染的这台电脑需要 LaTeX 和 ffmpeg。桌面端安装不附带这两个工具。 + +源码或 PyPI 安装里,渲染器来自 `math-animator` extra。见[从源码安装](/zh-cn/self-hosting/source/#可选的安装-extras)。 + +## 渲染一段动画 + +1. 在这台电脑的终端里确认 `latex` 和 `ffmpeg` 可以运行。 +2. 打开[对话](/zh-cn/learning-workspace/chat/),选择 **Math Animator**。 +3. 只描述一个变换。例如:“把 sin(x²) 的导数按链式法则逐步动画,最后停在表达式上。” +4. 等到线程里出现视频或分镜。播放一次,核对每一步和代数一致。 + +因为缺少某个可执行文件而失败时,装上它,再发送同一个请求。不要靠换成另一种生成器来躲开缺失的工具。 + +## 另见 + +- [可视化](/zh-cn/multimodal-studio/visualize/) — 一张静止的图 +- [该用哪种生成](/zh-cn/multimodal-studio/) diff --git a/docs/src/content/docs/zh-cn/multimodal-studio/video-lesson.md b/docs/src/content/docs/zh-cn/multimodal-studio/video-lesson.md new file mode 100644 index 000000000..a8d1acdf9 --- /dev/null +++ b/docs/src/content/docs/zh-cn/multimodal-studio/video-lesson.md @@ -0,0 +1,23 @@ +--- +title: 视频课 +description: 生成一节带字幕、在浏览器里播放的课。 +quadrant: how-to +--- + +**Video Lesson**(`video_lesson`)写出一节短课,检查渲染,再在浏览器里连字幕一起播放。旁白使用设置里的语音合成提供方;没有设置时使用 Edge。 + +源码安装需要渲染这台机器上有 Node.js 22 或更新版本,以及 npm。桌面应用已经带有 Node。 + +## 生成一节课 + +1. 打开[对话](/zh-cn/learning-workspace/chat/),选择 **Video Lesson**。 +2. 只写一个概念和时长。例如:“给一年级讲三分钟采样定理。打开字幕。带一个数字例题。” +3. 等到播放器出现在线程里。完整看一遍。 +4. 如果你需要声音而这节课是静音的,在 **设置 → 模型与服务** 里配置语音合成,再生成一次。 + +你能在线程里看完,并且字幕和画面一致,这节课就完成了。 + +## 另见 + +- [该用哪种生成](/zh-cn/multimodal-studio/) +- [提供方与模型](/zh-cn/get-started/providers/) — 语音合成和其他模型 profile 在一起 diff --git a/docs/src/content/docs/zh-cn/multimodal-studio/visualize.md b/docs/src/content/docs/zh-cn/multimodal-studio/visualize.md new file mode 100644 index 000000000..6244922a1 --- /dev/null +++ b/docs/src/content/docs/zh-cn/multimodal-studio/visualize.md @@ -0,0 +1,23 @@ +--- +title: 可视化 +description: 在对话里用 Visualize 生成一张图。 +quadrant: how-to +--- + +**Visualize** 把一段描述变成线程里的一张图。核心结果是 SVG、Mermaid、Mermaid 思维导图、Chart.js 和可交互 HTML。 + +## 做一张图 + +1. 打开[对话](/zh-cn/learning-workspace/chat/)。 +2. 在能力菜单里选择 **Visualize**。 +3. 写明图要表达的判断。例如:“用 Chart.js 画采样率与混叠的折线,标出奈奎斯特率。不要 3D。” +4. 等到图出现在线程里。类型不对时,直接回复你要的类型(SVG、Mermaid 或 Chart.js),要求重做一张。 + +你不看旁边的文字也能从这张图读出那个判断,这张图就完成了。 + +Manim 动画和分镜也是这个能力的渲染模式。推导需要被看的过程时,用[数学动画](/zh-cn/multimodal-studio/math-animator/)。GeoGebra 是可选安装,不属于核心类型。 + +## 另见 + +- [该用哪种生成](/zh-cn/multimodal-studio/) +- [视觉解题](/zh-cn/learning-workspace/vision-solver/) — 从题目照片开始,而不是从一段描述开始 diff --git a/docs/src/content/docs/zh-cn/partners/channels.md b/docs/src/content/docs/zh-cn/partners/channels.md deleted file mode 100644 index ab9fd0de3..000000000 --- a/docs/src/content/docs/zh-cn/partners/channels.md +++ /dev/null @@ -1,109 +0,0 @@ ---- -title: 渠道矩阵 -description: 所有内置 Partner channels 的连接模型、关键字段和适用场景。 -quadrant: reference ---- - -Partner channels 是同一个 Partner brain 外面的投递适配器。它不会创建第二套 agent runtime:一条 IM 入站事件会变成作用域内的 chat turn,最终回复再通过 channel 发回去。 - -大多数配置建议在 Web UI 完成:**Partners -> 你的 partner -> Channels** 会从 `/api/partners/channels/schema` 渲染实时 schema,自动 mask secret 字段,轮询 `/channels/status`,并允许你 reload channels,而不需要手写 YAML。 - -![伙伴渠道配置](/screenshots/dev/partners-channels.png) - -## 内置渠道 - -| 渠道 | Key | 连接模型 | 适合场景 | 核心字段 | -| --- | --- | --- | --- | --- | -| WeChat | `weixin` | HTTP long-poll + 扫码登录 | 个人微信助手 | `allow_from`;可选 `token`、`state_dir`、`route_tag`、`poll_timeout` | -| WeCom | `wecom` | 企业微信 AI Bot WebSocket | 企业微信 / WeChat Work | `bot_id`、`secret`、`allow_from` | -| QQ | `qq` | 腾讯 botpy WebSocket | 官方 QQ Bot 部署 | `app_id`、`secret`、`allow_from`、`msg_format` | -| QQ (NapCat) | `napcat` | OneBot v11 WebSocket | 通过 NapCat 接个人 QQ | `ws_url`、可选 `access_token`、`allow_from`、`group_policy` | -| Telegram | `telegram` | Bot API polling | 简单个人/群 bot | `token`、`allow_from` | -| Discord | `discord` | Gateway WebSocket | Discord server 和 DM | `token`、`allow_from`、群策略字段 | -| Slack | `slack` | Socket Mode | Slack team、DM、threaded channel help | `bot_token`、`app_token`、`allow_from`、`group_policy` | -| Feishu / Lark | `feishu` | Lark SDK WebSocket | 飞书 / Lark 企业聊天 | `app_id`、`app_secret`,以及 verification/encryption 字段 | -| DingTalk | `dingtalk` | Stream Mode | 钉钉企业聊天 | `client_id`、`client_secret`、`allow_from` | -| Matrix | `matrix` | Matrix sync loop | 去中心化房间,可选 E2EE | `homeserver`、用户凭证或 `access_token`、`allow_from`、`group_policy` | -| Zulip | `zulip` | Event queue | stream + topic 工作流 | `email`、`api_key`、`site`、`allow_from`、`group_policy` | -| Mattermost | `mattermost` | 原生 v4 WebSocket + REST | 自托管开源团队聊天 | `server_url`、`bot_token`、`allow_from`、可选 `group_policy`、`reply_in_thread`、`verify_ssl` | -| WhatsApp | `whatsapp` | Bridge WebSocket | 通过桥接运行时接 WhatsApp | bridge URL/token、`allow_from` | -| Email | `email` | IMAP poll + SMTP send | 异步邮件答疑 / helpdesk | IMAP host/user/password、SMTP host/user/password、`allow_from` | -| Mochat | `mochat` | Socket.IO 或 HTTP polling | 客服式聊天面板 | `base_url` / socket URL、`claw_token`、`allow_from` | -| Microsoft Teams | `msteams` | 内置 HTTP webhook listener | Teams DM-first Bot Framework 集成 | `app_id`、`app_password`、`tenant_id`、host/port/path | - -## 安装依赖 - -除 Matrix 外,所有内置 channel 都包含在 Partners extra 里: - -```bash -python scripts/install_extras.py partners -# 或发布包支持 extras 时: -pip install "deeptutor[partners]" -``` - -这一条命令会装齐全部 channel SDK——`python-telegram-bot`、`slack-sdk`、`lark-oapi`、`dingtalk-stream`、`qq-botpy`、`wecom-aibot-sdk`、`python-socketio` 等(完整清单见 `requirements/partners.txt`)。Email 只用 Python 标准库,不需要额外的包。Matrix 单独成 extra,因为加密房间依赖原生 `libolm` 库:源码中普通房间运行 `python scripts/install_extras.py matrix`,加密房间运行 `python scripts/install_extras.py matrix-e2e`。 - -如果服务器上缺某个 channel 的依赖,Channels 面板会把它置灰并显示 import 错误(如 `No module named 'lark_oapi'`)。已安装卡片会区分 **Connected**、**Connecting**、**Listener running**、**Waiting for scan**、**Configuration required**、**Connection failed** 与 **Not connected**。按提示补依赖或配置,再重启/reload Partner。 - -修改模块或依赖前先停止 DeepTutor。从源码仓库根目录运行安装助手,用同一个数据目录重启,再检查 `deeptutor module list` 与 Channels 状态。wheel 环境使用对应版本支持的 extras,不要在源码安装上叠加功能 wheel。 - -## 共享投递开关 - -大多数 channels 都继承同一组 delivery controls: - -| 字段 | 含义 | -| --- | --- | -| `enabled` | Partner 是否启动这个 channel。 | -| `send_progress` | 长 turn 期间是否投递 narration/progress。 | -| `send_tool_hints` | 是否投递一行工具调用提示。调试时有用,生产环境可能太吵。 | -| `streaming` | 仅 Telegram、Discord、Feishu:回复实时流式输出,靠原地编辑消息逐步长出(Feishu 走 CardKit 流式卡片)。需要 `send_progress` 开启。默认关闭。 | -| `allow_from` | 用户/会话 allowlist。`*` 适合测试;部署时更建议明确 id。 | - -## 配置流程 - -1. 先在 Web UI 创建并测试 Partner,不要一开始就开 IM channel。 -2. 第一次只启用一个 channel。 -3. 调试阶段保持 `send_progress` 和 `send_tool_hints` 开启。 -4. `allow_from: ["*"]` 只用于本地/私有测试。 -5. 先确认实时卡片进入 connected/listening 状态,再发一条短消息并把 `*` 换成真实 sender ids;只有状态详情不够时才查日志。 -6. 第一个 channel 稳定后,再添加其它 channels。 - -## 怎么选 - -- 个人微信用 **WeChat**,需要人工扫码和持久化 state。 -- 企业/团队部署用 **WeCom**、**Feishu**、**DingTalk**、**Slack** 或 **Teams**。 -- 官方 QQ Bot 用 **QQ**;只有在明确操作个人 QQ bridge 时才用 **NapCat**。 -- 异步 inbox 工作流用 **Email**。 -- 需要 room/topic 结构时,用 **Matrix** 或 **Zulip**。 -- 想要自己运维的自托管开源团队聊天,用 **Mattermost**。 - -## 状态存在哪里 - -Channel state 存在 Partner 的 `channels/` 目录下,例如: - -```text -data/partners//channels/weixin/account.json -data/partners//channels/msteams/msteams_conversations.json -``` - -Docker 或生产部署要持久化整个 `data/partners/`。丢失 channel state 可能导致重新扫码,或重新收集 conversation reference。 - -## 详细页面 - -每个内置 channel 都有专属配置页:平台侧申请步骤、对着截图逐字段讲解 channel card、配完后的验证流程和故障排查: - -- [WeChat](/zh-cn/partners/weixin/) —— 个人微信扫码登录和 long-poll 配置 -- [WeCom](/zh-cn/partners/wecom/) —— 企业微信 AI Bot 配置 -- [QQ / NapCat](/zh-cn/partners/qq/) —— 官方 QQ bot 和个人 QQ bridge 两条路径 -- [Telegram](/zh-cn/partners/telegram/) —— BotFather 注册、Bot API 轮询、流式回复 -- [Discord](/zh-cn/partners/discord/) —— Developer Portal 应用、intents、Gateway WebSocket -- [Slack](/zh-cn/partners/slack/) —— Socket Mode 应用(bot + app 双 token) -- [Feishu / Lark](/zh-cn/partners/feishu/) —— 开放平台应用和 CardKit 流式卡片 -- [DingTalk](/zh-cn/partners/dingtalk/) —— Stream Mode 企业机器人 -- [Matrix](/zh-cn/partners/matrix/) —— homeserver 凭证和可选 E2EE -- [Zulip](/zh-cn/partners/zulip/) —— bot 账号和 stream 订阅 -- [Mattermost](/zh-cn/partners/mattermost/) —— 自托管服务器,bot token 走原生 v4 API -- [WhatsApp](/zh-cn/partners/whatsapp/) —— bridge 运行时配置 -- [Email](/zh-cn/partners/email/) —— IMAP 收件轮询和 SMTP 回信 -- [Mochat](/zh-cn/partners/mochat/) —— Socket.IO 客服面板 -- [Microsoft Teams](/zh-cn/partners/msteams/) —— Bot Framework webhook 监听 diff --git a/docs/src/content/docs/zh-cn/partners/index.md b/docs/src/content/docs/zh-cn/partners/index.md deleted file mode 100644 index 99358b860..000000000 --- a/docs/src/content/docs/zh-cn/partners/index.md +++ /dev/null @@ -1,123 +0,0 @@ ---- -title: 伙伴与渠道 -description: DeepTutor Partners 的运维文档:渠道配置、工作区布局和 IM 投递行为。 -quadrant: how-to ---- - -Partners 是可以存在于 Web UI 和外部 IM 应用里的持久 DeepTutor 伙伴。它不是第二套 bot engine。每条入站消息都会变成一个作用域在该 Partner 下的普通 chat-agent turn: - -```text -IM / Web message -> PartnerRunner -> ChatOrchestrator -> AgenticChatPipeline -> tools -> reply -``` - -![伙伴列表](/screenshots/dev/partners.png) - -本页是运维指南。想了解伙伴*是什么*(它的灵魂、资料库、记忆与网页 Chat 视图),见[探索 → 伙伴](/zh-cn/explore/partners/)。伙伴也可以在一轮普通聊天里通过[我的智能体](/zh-cn/explore/subagents/)被咨询。 - -## 账号范围与资料模式 - -伙伴及伙伴群组属于账号,切换工作区不会改变列表。创建时或在 **Configure → Workspace** 中,可以选择**伙伴私有工作区**,复制获准的知识库、技能和笔记本;也可以绑定所有者的现有工作区,实时共用它的文件、知识库、技能、笔记本,生成文件进入该工作区 outputs 文件夹。绑定后请在工作区的资源入口维护材料,而不是继续复制私有 Library。下方目录树描述的是私有资料模式;灵魂、渠道状态和关系会话在两种模式下都由伙伴保存。详见[伙伴资料模式](/zh-cn/explore/partners/#账号伙伴与工作区资源)。 - -## 和旧 TutorBot 的区别 - -| 旧 TutorBot | 新 Partner | -| --- | --- | -| 独立 bot engine,工作区在 `data/tutorbot//` | 复用 Chat loop,作用域在 `data/partners//workspace/` | -| `deeptutor bot ...` 命令 | `deeptutor partner list/create/start/stop` | -| 手写 bot YAML 里的 channels | Partners UI 中按 schema 渲染的 channel cards | -| bot skills / memory 独立处理 | 分配的 KB、skills、notebooks、tools、memory 像普通 chat context 一样挂载 | - -旧 `/tutorbot/*` 文档地址会重定向到对应的 `/partners/*` 页面,已有外链和书签仍可继续使用。 - -## 所有权、分配与私有会话 - -任何已认证用户都可以创建 Partner,并自动成为其所有者。所有者和管理员可以管理它的 soul、资料库、渠道、模型、生命周期与删除操作。管理员还可以把 Partner 分配给其他用户;被分配的用户可以与它对话,但只能看到身份卡片,看不到配置和凭据。 - -Partner 的配置与复制进来的资料库是共享的,关系状态则彼此隔离。每个已认证的非管理员用户都在 `users//` 下拥有自己的会话文件和关系记忆。与该用户互动时,Partner 还可以读取这个用户自己的共享记忆;新学到的偏好只写入这段私有的 Partner—用户关系记忆。因此,两个人使用同一个 Partner 时不会看到彼此的会话或已学习偏好。管理员会话和未归属到账号的渠道消息则兼容性地使用 Partner 顶层的会话与记忆作用域。 - -## 推荐配置流程 - -1. 在 **Partners -> New partner** 创建 Partner。 -2. 启用任何 channel 前,先填好 **Identity** 和 **Soul**。第一条 IM 回复就会使用这个 soul。 -3. 在 **Mind** 里选择模型;测试阶段先少开可选工具。 -4. 在 **Library** 中选择私有复制资料库或绑定所有者的现有工作区,先用一份小资料测试。 -5. 在 **Channels** 里先只启用一个 channel,并从本地/私有测试开始。 -6. 调试时保留 `send_progress` 和 `send_tool_hints`,生产环境再按需要关闭。 -7. 对真实用户开放前,把 `allow_from: ["*"]` 换成明确 sender ids。 - -![伙伴渠道配置](/screenshots/dev/partners-channels.png) - -## Partner Groups - -Partners 页面还支持一等公民的 **Partner Groups(伙伴群组)**。从两个或更多 Partner 组建群组,选择成员、讨论模式和共享记忆模式,就能在同一场讨论中保留每个 Partner 各自的角色与推理方式。 - -每个群组都有独立的会话与持久历史。一轮消息可以发给全部成员,也可以只指定部分成员;每个成员的回复占据独立 seat。某个 seat 失败时,可以只重试这一席,而不用让已经答完的 Partner 全部重跑。 - -## Channel 入口 - -| Channel | 适用场景 | 页面 | -| --- | --- | --- | -| WeChat (`weixin`) | 个人微信,扫码登录,HTTP long-poll | [WeChat](/zh-cn/partners/weixin/) | -| WeCom (`wecom`) | 企业微信 / WeChat Work AI Bot 平台 | [WeCom](/zh-cn/partners/wecom/) | -| QQ (`qq`) | 腾讯官方 QQ Bot,botpy SDK | [QQ / NapCat](/zh-cn/partners/qq/) | -| NapCat (`napcat`) | 个人 QQ,通过 OneBot v11 / NapCat 接入 | [QQ / NapCat](/zh-cn/partners/qq/) | -| Telegram (`telegram`) | 上手最快——BotFather 拿 token,无需公网 IP | [Telegram](/zh-cn/partners/telegram/) | -| Discord (`discord`) | Discord server 和 DM,Gateway WebSocket | [Discord](/zh-cn/partners/discord/) | -| Slack (`slack`) | Slack team,Socket Mode,线程回复 | [Slack](/zh-cn/partners/slack/) | -| Feishu (`feishu`) | 飞书 / Lark,CardKit 流式卡片 | [Feishu](/zh-cn/partners/feishu/) | -| DingTalk (`dingtalk`) | 钉钉企业机器人,Stream Mode | [DingTalk](/zh-cn/partners/dingtalk/) | -| Matrix (`matrix`) | 去中心化房间,可选 E2EE | [Matrix](/zh-cn/partners/matrix/) | -| Zulip (`zulip`) | stream + topic 结构化团队聊天 | [Zulip](/zh-cn/partners/zulip/) | -| Mattermost (`mattermost`) | 自托管 Mattermost,原生 v4 WebSocket | [Mattermost](/zh-cn/partners/mattermost/) | -| WhatsApp (`whatsapp`) | 通过 bridge 运行时接 WhatsApp | [WhatsApp](/zh-cn/partners/whatsapp/) | -| Email (`email`) | IMAP/SMTP 异步收发件箱工作流 | [Email](/zh-cn/partners/email/) | -| Mochat (`mochat`) | 客服式聊天面板 | [Mochat](/zh-cn/partners/mochat/) | -| Microsoft Teams (`msteams`) | Teams,Bot Framework webhook 监听 | [Microsoft Teams](/zh-cn/partners/msteams/) | - -各渠道的连接模型、必填字段和投递开关对照,请看 [渠道矩阵](/zh-cn/partners/channels/)。 - -## 运行时状态 - -```text -data/partners// -├── config.yaml # Partner identity, model, channels, tools -├── sessions/ # 共享/未归属账号的会话 -│ ├── .jsonl # 每个会话一个 append-only 文件 -│ └── _index.json # 需要时创建的归档元数据 -├── channels/ -│ └── /... # QR token、cursor、conversation ref -├── users// # 已认证用户的私有关系状态 -│ ├── sessions/.jsonl -│ └── workspace/memory/ -└── workspace/ - ├── knowledge_bases/ # 复制过来的 assigned KBs - └── user/ - ├── workspace/SOUL.md - ├── workspace/skills//SKILL.md - ├── workspace/notebook/ - └── workspace/memory/ -``` - -私有资料模式会复制分配资源,便于保留独立演进的资料库。绑定工作区时则共用其实时资源;伙伴的灵魂、渠道状态、会话及关系记忆仍独立保存。 - -## 对话命令 - -所有 Partner 对话共用这组 slash commands: - -- `/help` —— 查看可用命令。 -- `/new` —— 归档当前会话并新开一段;`/branch` 会归档当前会话,再从其副本继续;`/stop` 停止生成中的回复。 -- `/sessions` —— 列出会话 id;`/resume ` 恢复已归档会话,`/delete ` 永久删除会话。 -- `/status` —— 查看 Partner、会话、模型与工具状态;`/history [n]` 查看最近消息。 -- `/tool [on|off |reset]` —— 查看或调整 Partner 已启用的工具。 -- `/model [number|model name]` —— 所有者或管理员在私聊里列出或切换模型。 -- `/link ` —— 在外部 IM 私聊里,把该账号关联到生成此 code 的 DeepTutor 用户。 - -## Web UI vs CLI - -配置 channel 推荐用 Web UI,因为它会从 `/api/partners/channels/schema` 渲染实时 schema,并自动 mask secret 字段。CLI 更适合 lifecycle 检查: - -```bash -deeptutor partner list -deeptutor partner start math-tutor -deeptutor partner stop math-tutor -``` diff --git a/docs/src/content/docs/zh-cn/get-started/cli-only.md b/docs/src/content/docs/zh-cn/self-hosting/cli-only.md similarity index 91% rename from docs/src/content/docs/zh-cn/get-started/cli-only.md rename to docs/src/content/docs/zh-cn/self-hosting/cli-only.md index 46cd2f6b1..a7258260e 100644 --- a/docs/src/content/docs/zh-cn/get-started/cli-only.md +++ b/docs/src/content/docs/zh-cn/self-hosting/cli-only.md @@ -50,7 +50,7 @@ deeptutor memory show deeptutor config show ``` -完整命令面:[**DeepTutor CLI**](/zh-cn/cli/)。 +完整命令面:[**DeepTutor CLI**](/zh-cn/developers/guides/cli/)。 ## 源码 CLI 与精简 core 是两种安装 @@ -79,13 +79,13 @@ python -m pip check deeptutor module list ``` -使用相同的 `DEEPTUTOR_HOME` 重启。账号伙伴状态保存在 `data/partners//` 下;伙伴绑定哪个内容工作区,与运行目录是两件不同的事。渠道凭据和私有关系历史仍属于伙伴状态。详见[伙伴](/zh-cn/explore/partners/)。 +使用相同的 `DEEPTUTOR_HOME` 重启。账号伙伴状态保存在 `data/partners//` 下;伙伴绑定哪个内容工作区,与运行目录是两件不同的事。渠道凭据和私有关系历史仍属于伙伴状态。详见[伙伴](/zh-cn/channels/)。 ## 让另一个 agent 来调用 CLI 是 **agent-native** 的。`deeptutor run --format json` 每行输出一个 JSON 事件,`kb list`、`kb search`、`session show`、`notebook show` 等数据查询命令在已实现的地方都暴露 JSON —— 方便接到另一个 agent 的 harness 里。 -把项目根目录的 [`SKILL.md`](https://github.com/HKUDS/DeepTutor/blob/main/SKILL.md) 丢给任何会调工具的 LLM,它就能自己驱动 DeepTutor。具体模式见 [**Agent handoff**](/zh-cn/cli/agent-handoff/)。 +把项目根目录的 [`SKILL.md`](https://github.com/HKUDS/DeepTutor/blob/main/SKILL.md) 丢给任何会调工具的 LLM,它就能自己驱动 DeepTutor。具体模式见 [**Agent handoff**](/zh-cn/developers/guides/agent-handoff/)。 ## 升级 @@ -120,10 +120,10 @@ python -m deeptutor_cli.main chat python scripts/install_extras.py partners ``` -更多:[**故障排查**](/zh-cn/get-started/troubleshooting/)。 +更多:[**故障排查**](/zh-cn/self-hosting/troubleshooting/)。 ## 下一步 -- [**DeepTutor CLI**](/zh-cn/cli/) —— 完整 CLI 参考 -- [**Agent handoff**](/zh-cn/cli/agent-handoff/) —— 让你的 agent 来驱动 -- [**Partners 伙伴与渠道**](/zh-cn/partners/) —— 从 CLI 跑一个 Partner +- [**DeepTutor CLI**](/zh-cn/developers/guides/cli/) —— 完整 CLI 参考 +- [**Agent handoff**](/zh-cn/developers/guides/agent-handoff/) —— 让你的 agent 来驱动 +- [**Partners 伙伴与渠道**](/zh-cn/channels/) —— 从 CLI 跑一个 Partner diff --git a/docs/src/content/docs/zh-cn/self-hosting/configuration.md b/docs/src/content/docs/zh-cn/self-hosting/configuration.md new file mode 100644 index 000000000..26fae34c8 --- /dev/null +++ b/docs/src/content/docs/zh-cn/self-hosting/configuration.md @@ -0,0 +1,36 @@ +--- +title: 配置文件 +description: 部署实际读取的设置 JSON,以及 setup 能力可以写入的键。 +quadrant: reference +--- + +DeepTutor 从运行目录里的 `data/user/settings/*.json` 读取配置。进程环境变量只覆盖启动时的少量值。Podman 的宿主机端口映射是 `.env.example` 里的变量。 + +## 应用读取的文件 + +| 文件 | 内容 | +| --- | --- | +| `interface.json` | 个人界面选择,包括语言和主题。 | +| `system.json` | 端口,以及服务端使用的 API 基址。`next_public_api_base` 是前端服务器访问后端的地址。开启认证后,`cors_origins` 列出允许调用 API 的页面来源。 | +| `document_parsing.json` | 文档解析引擎。 | +| `model_catalog.json` | 提供方配置和选中的模型。 | +| `auth.json` | 多用户认证。`enabled`、`token_expire_hours` 和 `cookie_secure` 是[多用户部署](/zh-cn/self-hosting/multi-user/)里写明的开关。 | + +编辑这些值的界面是[设置](/zh-cn/self-hosting/settings/)。 + +## setup 能力可以写入的键 + +这些行来自 `deeptutor/services/config/settings_spec.py`,是该能力被允许修改的旋钮,不是每个 JSON 字段的清单。密钥不在这张表里;凭据在设置卡片中填写。 + +| 键 | 区域 | 范围 | 生效 | +| --- | --- | --- | --- | +| `interface.language` | interface | personal | 立即 | +| `interface.response_language` | interface | personal | 立即 | +| `interface.theme` | interface | personal | 立即 | +| `document_parsing.engine` | parsing | global | 立即;已解析的文档保持原文,直到重新上传 | +| `catalog.llm` | models | global | 立即,连通性探测通过之后 | +| `catalog.embedding` | models | global | 需要重建索引,连通性探测通过之后 | +| `catalog.search` | models | global | 立即 | +| `web_fetch.backend` | models | global | 立即 | + +个人行写在调用者自己的 `interface.json`。全局行写在部署共享设置里,只有管理员可以改。 diff --git a/docs/src/content/docs/zh-cn/self-hosting/desktop.md b/docs/src/content/docs/zh-cn/self-hosting/desktop.md new file mode 100644 index 000000000..53b42df1e --- /dev/null +++ b/docs/src/content/docs/zh-cn/self-hosting/desktop.md @@ -0,0 +1,29 @@ +--- +title: 桌面版本 +description: Open DeepTutor 的四个下载文件,以及各版本的数据和日志路径。 +quadrant: reference +--- + +Open DeepTutor 是 macOS 和 Windows 上双击打开的应用。首次启动会安装自带运行时,在本机回环上启动服务,并打开 Web 界面。打包和签名留在仓库的 `apps/desktop/README.md`。 + +## 下载 + +每个版本发布四个文件。`` 是该构建自带的 DeepTutor 版本。 + +| 目标 | 应用 | 下载 | +| --- | --- | --- | +| `macos-arm64` | Apple Silicon 版 Open DeepTutor for MacOS | `Open-DeepTutor-MacOS-Apple-Silicon-v.dmg` | +| `macos-x64` | Intel 版 Open DeepTutor for MacOS | `Open-DeepTutor-MacOS-Intel-v.dmg` | +| `windows-x64` | Open DeepTutor for Windows | `Open-DeepTutor-Windows-v-Setup.exe` 和 `Open-DeepTutor-Windows-v-Portable.zip` | + +GitHub Release 同时保留最新文件的无版本别名。安装步骤在[桌面端教程](/zh-cn/get-started/desktop/)。 + +## 数据与日志 + +| | macOS | Windows | +| --- | --- | --- | +| 数据 | `~/Library/Application Support/Open DeepTutor/workspace/data` | `%LOCALAPPDATA%\Open DeepTutor\workspace\data` | +| 运行时 | `…/Open DeepTutor/runtimes/` | `%LOCALAPPDATA%` 下的同一路径 | +| 日志 | `…/Open DeepTutor/logs/runtime.log` | `%LOCALAPPDATA%` 下的同一路径 | + +退出应用会停掉它自己启动的服务,不会停掉另外运行的 `deeptutor start`。 diff --git a/docs/src/content/docs/zh-cn/self-hosting/docker.md b/docs/src/content/docs/zh-cn/self-hosting/docker.md new file mode 100644 index 000000000..b89a5f99a --- /dev/null +++ b/docs/src/content/docs/zh-cn/self-hosting/docker.md @@ -0,0 +1,173 @@ +--- +title: Docker 运维 +description: 已发布容器的卷、端口、反向代理、本地模型和升级。 +quadrant: how-to +--- + +第一次运行的命令在 [Docker 教程](/zh-cn/get-started/docker/)。本页是之后的部署操作。 + +## 选择宿主机上的内容工作区 + +默认情况下,内容工作区的存储位于 `deeptutor-data` volume 内部。想改用宿主机上的文件夹,就把它挂到固定的容器路径 `/workspace`,并把 DeepTutor 锁到该路径: + +```bash +mkdir -p "$PWD/deeptutor-workspace/outputs" +docker run --rm --name deeptutor \ + -p 127.0.0.1:3782:3782 \ + -v deeptutor-data:/app/data \ + -v "$PWD/deeptutor-workspace:/workspace" \ + -e DEEPTUTOR_WORKSPACE_ROOT=/workspace \ + -e DEEPTUTOR_WORKSPACE_ALLOWED_ROOTS=/workspace \ + ghcr.io/hkuds/deeptutor:latest +``` + +首次运行前请自己建好 `outputs/`——否则 Docker 会以 root 身份创建这个挂载源,非特权的应用进程写不进去。 + +容器看到的始终是 `/workspace`,因此路径在宿主机间保持可移植。该部署根目录约束所有账号;托管工作区使用 `outputs/.deeptutor/chat/` 下按账号隔离的目录。**Settings → Workspace** 管理各工作区与存储,不会暴露私有运行设置。 + +用 Compose 时,在 `python scripts/docker_compose.py up -d` 之前设好 `DEEPTUTOR_WORKSPACE_HOST=/absolute/host/folder`;辅助脚本会替你建好该文件夹及其 `outputs/`。不设则继续使用 `./data/user/workspace`。 + +## 后台模式 + +加 `-d` 让它在后台跑: + +```bash +docker run -d --name deeptutor \ + -p 127.0.0.1:3782:3782 \ + -v deeptutor-data:/app/data \ + ghcr.io/hkuds/deeptutor:latest + +docker logs -f deeptutor # 跟踪日志 +docker stop deeptutor # 停止 +docker rm deeptutor # 删除(volume 仍保留) +``` + +`deeptutor-data` volume 会在 `stop` / `rm` 之间保留设置和默认内容工作区。如果真要从头来:`docker volume rm deeptutor-data`。 + +## 远程 Docker / 反向代理 + +浏览器始终只跟前端 origin(`:3782`)通信;容器里的 Next.js 中间件会在服务端把 `/api/*` 和 `/ws/*` 转发给 `localhost:8001` 上的后端。所以常见的**单容器**场景下,你完全**不需要**配置任何 API base —— 把反向代理 / TLS 终止器指向发布出来的 `:3782` 即可: + +```text +deeptutor.example.com { + reverse_proxy localhost:3782 +} +``` + +只有**拆分部署**(后端跑在另一个容器或主机上)才需要设置 API base。在挂载 volume 里的 `data/user/settings/system.json` 中,把它设成**前端服务器**用来访问后端的内网地址 —— 这个值由代理在服务端读取,不会发给浏览器: + +```json +{ + "next_public_api_base": "http://backend:8001" +} +``` + +`next_public_api_base_external`(及其别名 `public_api_base`)作为更低优先级的回退被接受,保存时会归一化。 + +CORS 只在开启 auth 且前端跨 origin 时才有意义:`cors_origins` 列出哪些前端页面 origin 可以调用后端。未开启 auth 时,DeepTutor 默认允许正常 HTTP/HTTPS 浏览器 origin。 + +```json +{ + "cors_origins": ["https://deeptutor.example.com"] +} +``` + +## 改宿主机端口 + +改 `-p host:container` 映射的左边即可: + +```bash +docker run --rm --name deeptutor \ + -p 127.0.0.1:8088:3782 \ + -v deeptutor-data:/app/data \ + ghcr.io/hkuds/deeptutor:latest +``` + +如果还想把 API 暴露到宿主机,再加 `-p 127.0.0.1:8089:8001`。如果你在 `/app/data/user/settings/system.json` 里改了容器侧端口,重启并把每条映射右侧同步改掉。 + +## 连本地 LLM(Ollama / LM Studio / llama.cpp / vLLM) + +Docker 里的 `localhost` 指的是容器本身,不是宿主机。要访问宿主机上跑的模型服务,用 host gateway: + +```bash +docker run --rm --name deeptutor \ + -p 127.0.0.1:3782:3782 \ + --add-host=host.docker.internal:host-gateway \ + -v deeptutor-data:/app/data \ + ghcr.io/hkuds/deeptutor:latest +``` + +然后在 **设置 → LLM**(或 **Embedding**)里,把 provider Base URL 指到 `host.docker.internal`: + +| 服务 | Base URL | +|------|----------| +| Ollama LLM | `http://host.docker.internal:11434/v1` | +| Ollama embedding | `http://host.docker.internal:11434/api/embed` | +| LM Studio | `http://host.docker.internal:1234/v1` | +| llama.cpp | `http://host.docker.internal:8080/v1` | + +Docker Desktop(macOS / Windows)通常**不需要** `--add-host` 就能解析 `host.docker.internal`。Linux 上,这个 flag 是在现代 Docker Engine 上创建这个 hostname 的可移植方式。 + +### Linux 替代方案 —— host networking + +加 `--network=host`,去掉 `-p` flags: + +```bash +docker run --rm --name deeptutor \ + --network=host \ + -v deeptutor-data:/app/data \ + ghcr.io/hkuds/deeptutor:latest +``` + +容器直接共享宿主机网络,所以打开 (或 `system.json` 里的 `frontend_port`),宿主机服务也能用普通的 localhost URL 访问,比如 `http://127.0.0.1:11434/v1`。 + +> Host networking 把容器端口直接暴露在宿主机上,可能跟已有服务冲突。 + +## 升级 + +```bash +docker pull ghcr.io/hkuds/deeptutor:latest +docker rm -f deeptutor 2>/dev/null +docker run --rm --name deeptutor \ + -p 127.0.0.1:3782:3782 \ + -v deeptutor-data:/app/data \ + ghcr.io/hkuds/deeptutor:latest +``` + +volume 会保留 —— 你的设置、KB、记忆都能撑过升级。 + +**设置 → 关于** 会识别 Docker 镜像并检查是否有新版本,但替换容器仍属于部署操作:按上面的步骤拉取新镜像并重建容器。DeepTutor 不会在运行中的容器里原地升级包。 + +## 常见错误 + +### `Bind for 0.0.0.0:3782 failed: port is already allocated` + +```bash +lsof -i :3782 # macOS +ss -ltnp | grep :3782 # Linux +``` + +干掉冲突进程,或者在 `-p` 映射里换一个宿主机端口。 + +### 容器立刻退出 + +```bash +docker logs deeptutor | tail -30 +``` + +无效的 LLM 凭据会被捕获并记为 warning,**不会**让后端启动失败。如果容器已经退出,请从日志中寻找其他致命错误。Web UI 可用后,到 **设置 → 模型与服务** 修正凭据即可。 + +### 前端能加载但 API 调用失败(拆分部署) + +用单容器镜像时不该出现这种情况 —— 容器内的代理会自动把 `/api/*` 转发给后端。如果你跑的是**拆分部署**(后端在另一个容器或主机上),在 volume 里的 `data/user/settings/system.json` 把 `next_public_api_base` 设成前端服务器访问后端用的内网地址,然后重启。 + +### Docker 里的多用户模式 + +直接在 volume 的 `data/user/settings/auth.json` 里把 auth 开关打开(`"enabled": true`),然后重启。容器会自动 pick up。完整配置见 [**多用户部署**](/zh-cn/self-hosting/multi-user/)。 + +更多:[**故障排查**](/zh-cn/self-hosting/troubleshooting/)。 + +## 下一步 + +- [**多用户部署**](/zh-cn/self-hosting/multi-user/) —— 团队配置 +- [**探索 DeepTutor**](/zh-cn/learning-workspace/) —— 看看跑起来的应用 diff --git a/docs/src/content/docs/zh-cn/self-hosting/index.md b/docs/src/content/docs/zh-cn/self-hosting/index.md new file mode 100644 index 000000000..8ec8c1ac2 --- /dev/null +++ b/docs/src/content/docs/zh-cn/self-hosting/index.md @@ -0,0 +1,23 @@ +--- +title: 运行目录 +description: 自部署的 DeepTutor 把设置、工作区和账户数据放在哪里。 +quadrant: explanation +--- + +每条安装路径最后都落到同一个运行目录。设置在启动目录下的 `data/user/settings/`,也可以用 `DEEPTUTOR_HOME` 或 `deeptutor start --home` 指定。知识库、记忆、伙伴运行状态、多用户账户和审计日志都在同一棵 `data/` 里。把这棵目录,以及单独配置的内容工作区目录,一起持久化。 + +运行目录是部署的存储根,和应用里选中的工作区不是一回事。主页、学习和资料跟随当前工作区;伙伴和个性化属于账户。 + +进程环境变量只覆盖启动时的少量项,例如传给 `deeptutor start` 的端口。Podman 的宿主机端口映射写在 `.env.example`,不写进应用设置文件。 + +## 安装路径 + +| 路径 | 适合 | 页面 | +| --- | --- | --- | +| PyPI | 已发布的包,1.7.0 之后的完整应用 | [PyPI](/zh-cn/self-hosting/pypi/) | +| 源码 | 当前 dev 检出 | [从源码运行](/zh-cn/self-hosting/source/) | +| Docker | 一个已发布容器 | [Docker 教程](/zh-cn/get-started/docker/) 和 [运维](/zh-cn/self-hosting/docker/) | +| 纯 CLI | 不要 Web 前端 | [纯 CLI](/zh-cn/self-hosting/cli-only/) | +| 桌面端 | macOS 或 Windows 上双击打开 | [桌面版本](/zh-cn/self-hosting/desktop/) | + +桌面端和 Docker 的快速上手仍在[从这里开始](/zh-cn/get-started/)。本页是部署地图。 diff --git a/docs/src/content/docs/zh-cn/get-started/multi-user.md b/docs/src/content/docs/zh-cn/self-hosting/multi-user.md similarity index 99% rename from docs/src/content/docs/zh-cn/get-started/multi-user.md rename to docs/src/content/docs/zh-cn/self-hosting/multi-user.md index 323b08040..44e4d1e02 100644 --- a/docs/src/content/docs/zh-cn/get-started/multi-user.md +++ b/docs/src/content/docs/zh-cn/self-hosting/multi-user.md @@ -164,4 +164,4 @@ print(bcrypt.hashpw(b"your-password", bcrypt.gensalt()).decode()) 然后 `deeptutor start`,用 `alice` + your-password 登录。 -更多修复方法:[**故障排查**](/zh-cn/get-started/troubleshooting/)。 +更多修复方法:[**故障排查**](/zh-cn/self-hosting/troubleshooting/)。 diff --git a/docs/src/content/docs/zh-cn/self-hosting/oauth.md b/docs/src/content/docs/zh-cn/self-hosting/oauth.md new file mode 100644 index 000000000..9c6adae47 --- /dev/null +++ b/docs/src/content/docs/zh-cn/self-hosting/oauth.md @@ -0,0 +1,24 @@ +--- +title: Codex 登录 +description: 用自己的 ChatGPT 订阅登录 OpenAI Codex,并确认回调已经收到。 +quadrant: how-to +--- + +OpenAI Codex 登录使用你自己的 ChatGPT 订阅,不需要 `OPENAI_API_KEY`。 + +## 登录 + +1. 打开 **设置 → 模型与服务**,添加 **OpenAI Codex**。 +2. 完成 DeepTutor 打开的浏览器登录。 +3. 提供方把浏览器重定向到 `GET /api/auth/openai-codex/callback`,带上 `code` 和 `state`;如果登录被拒绝,则带上 `error`。 +4. 成功的回调页会写明已经收到认证。回到 DeepTutor。 + +模型列表来自该账号的实时目录。登录会发布一个配置;只有还没有配置任何 LLM 时,它才会成为当前模型。 + +## 令牌放在哪里 + +令牌只保存在 `data/system/user-secrets//private/openai-codex/`。DeepTutor 不会读取或修改 `~/.codex` 的 CLI 登录。令牌只授权一个人的订阅,不能通过用户授权分享。每个账号,包括非管理员,都为自己登录。产生的模型、目录和退出登录只属于该账号。 + +## 容器 + +默认的本地 Docker 或 Podman 使用自己的回环网络,登录期间浏览器回调需要一条临时桥接。具体的 Docker、Compose、Podman 和拆除命令在仓库的[容器化指南](https://github.com/HKUDS/DeepTutor/blob/dev/docs-for-dev/CONTAINERIZATION.md#temporary-local-codex-oauth-bridge)。 diff --git a/docs/src/content/docs/zh-cn/get-started/pypi.md b/docs/src/content/docs/zh-cn/self-hosting/pypi.md similarity index 91% rename from docs/src/content/docs/zh-cn/get-started/pypi.md rename to docs/src/content/docs/zh-cn/self-hosting/pypi.md index 7e3358855..d9b81fadc 100644 --- a/docs/src/content/docs/zh-cn/get-started/pypi.md +++ b/docs/src/content/docs/zh-cn/self-hosting/pypi.md @@ -4,7 +4,7 @@ description: 说明模块化 full 安装与旧包迁移,并在升级时保留 quadrant: how-to --- -本页介绍 **1.7.x** 模块化包(当前发布版本为 1.7.4)及从 **1.6.15** 旧布局迁移的方法。Web 应用选择 full 安装范围,终端聊天可只安装 core。要体验当前开发版功能,请[从源码安装](/zh-cn/get-started/from-source/),或在独立环境构建、安装完整且版本一致的本地 wheel 家族。 +本页介绍 **1.7.x** 模块化包(当前发布版本为 1.7.4)及从 **1.6.15** 旧布局迁移的方法。Web 应用选择 full 安装范围,终端聊天可只安装 core。要体验当前开发版功能,请[从源码安装](/zh-cn/self-hosting/source/),或在独立环境构建、安装完整且版本一致的本地 wheel 家族。 1.6.15 完整包包含 Web 与 CLI。1.7.x 家族中,**`deeptutor` 提供 core CLI/SDK**,**`deeptutor-cli` 是兼容别名**,完整 Web 应用使用 **`deeptutor[full]`**。功能 wheel 必须与 core 同版本。当前开发环境使用 Python 3.11–3.14 与 Node.js 22 LTS。 @@ -59,7 +59,7 @@ pip install -U "deeptutor[full]==" pip install -U "deeptutor[partners]" ``` -完整 extras 总表(`matrix`、`matrix-e2e`、`math-animator`、`dev`、`all`)见 [**从源码安装**](/zh-cn/get-started/from-source/#可选的安装-extras) —— 同样的 extra 名对 PyPI 包同样有效。 +完整 extras 总表(`matrix`、`matrix-e2e`、`math-animator`、`dev`、`all`)见 [**从源码安装**](/zh-cn/self-hosting/source/#可选的安装-extras) —— 同样的 extra 名对 PyPI 包同样有效。 ## 文件存在哪里 @@ -110,7 +110,7 @@ deeptutor memory show # 查看记忆 deeptutor config show # 查看当前配置 ``` -完整命令面:[**DeepTutor CLI**](/zh-cn/cli/)。 +完整命令面:[**DeepTutor CLI**](/zh-cn/developers/guides/cli/)。 ## 升级 @@ -170,9 +170,9 @@ API key 被 provider 拒绝。在 **设置 → 语言模型** 重新输入,或 deeptutor init # 重跑向导,工作区会保留 ``` -更多问题:[**故障排查**](/zh-cn/get-started/troubleshooting/)。 +更多问题:[**故障排查**](/zh-cn/self-hosting/troubleshooting/)。 ## 下一步 -- [**探索 DeepTutor**](/zh-cn/explore/) —— 看看跑起来的应用 -- [**多用户部署**](/zh-cn/get-started/multi-user/) —— 部署成团队服务器 +- [**探索 DeepTutor**](/zh-cn/learning-workspace/) —— 看看跑起来的应用 +- [**多用户部署**](/zh-cn/self-hosting/multi-user/) —— 部署成团队服务器 diff --git a/docs/src/content/docs/zh-cn/explore/settings.md b/docs/src/content/docs/zh-cn/self-hosting/settings.md similarity index 91% rename from docs/src/content/docs/zh-cn/explore/settings.md rename to docs/src/content/docs/zh-cn/self-hosting/settings.md index 9bea70bd4..e323e911b 100644 --- a/docs/src/content/docs/zh-cn/explore/settings.md +++ b/docs/src/content/docs/zh-cn/self-hosting/settings.md @@ -4,7 +4,7 @@ description: DeepTutor 的控制面板——外观、网络、工作区、模型 quadrant: how-to --- -设置(Settings)是 DeepTutor 的运维控制面板。大多数版块采用**草稿—应用**(draft-and-apply)模式:你先编辑草稿、测试,再 **Apply**(应用)——这样一次糟糕的提供商改动永远不会搞垮一套正常的配置。配置值持久化到你账户下的 `data/user/settings/*.json`(以及少数几个 YAML 文件)。 +设置(Settings)是 DeepTutor 的运维控制面板。大多数版块采用**草稿—应用**(draft-and-apply)模式:你先编辑草稿、测试,再 **Apply**(应用)——这样一次糟糕的提供商改动永远不会搞垮一套正常的配置。配置值持久化到你账户下的 `data/user/settings/*.json`(以及少数几个 YAML 文件)。文件名和 setup 能力可写的键见[配置文件](/zh-cn/self-hosting/configuration/)。 ## 它在哪里 @@ -26,7 +26,7 @@ quadrant: how-to ## 先判断配置范围 -**设置**负责应用、服务与工作区策略;[个性化](/zh-cn/explore/personalization/)负责可复用的人格、技能、智能体与服务连接;当前工作区的**主页、学习、资源**负责对话、学习与材料。伙伴拥有独立的账号级入口。 +**设置**负责应用、服务与工作区策略;[个性化](/zh-cn/customize/)负责可复用的人格、技能、智能体与服务连接;当前工作区的**主页、学习、资源**负责对话、学习与材料。伙伴拥有独立的账号级入口。 个人偏好随账号跨工作区保留。提供商基础设施、本机 agent 执行、应用安装等部署配置可能需要管理员。修改工作区资源选择,不会改变资源所有权或部署权限。 @@ -45,7 +45,7 @@ quadrant: how-to 工作区策略是范围上限。对话中选择技能或 MCP 服务可以继续缩小范围;清空对话选择后恢复继承工作区。共享部署还会应用用户授权,不会因为工作区选择而显示别人的文件或凭据。 -Partner 可以绑定所有者的工作区,共用最新材料。在工作区资源入口维护材料,在伙伴入口配置身份、渠道和模型,详见[伙伴](/zh-cn/explore/partners/)。 +Partner 可以绑定所有者的工作区,共用最新材料。在工作区资源入口维护材料,在伙伴入口配置身份、渠道和模型,详见[伙伴](/zh-cn/channels/)。 ## 外观 @@ -57,11 +57,11 @@ Partner 可以绑定所有者的工作区,共用最新材料。在工作区资 这里集中管理所有模型与服务:语言模型、用于自动调用以及 Math Animator/Video Lesson 修复的 **task model**、embedding、网络搜索、语音(TTS/STT)以及图像/视频生成。每项服务由 profile 与模型目录组成,修改凭据后会自动发现模型,支持批量导入;LLM 和 Task profile 可选择提供方支持的 API format;默认 URL 随格式切换,自填地址保持不变。每个模型可沿用自动能力判断,也可覆盖工具调用、图像输入、JSON 输出与推理支持。**提供方**页保存同一厂商的一份凭据,并把它连接到该厂商提供的所有服务——密钥只需输入一次。语音模型驱动朗读与输入框麦克风,图像/视频模型会成为聊天工具。请在 **Apply** 前先 **Test**;测试通过只证明 profile 能完成最小调用,并不保证该模型适合所有 capability。 -在上下文中查看 Models 页面见[聊天工作台 → 配置聊天能用到的东西](/zh-cn/explore/chat-workspace/#配置聊天能用到的东西),配置范例见[模型与搜索提供商](/zh-cn/get-started/providers/)。 +在上下文中查看 Models 页面见[聊天工作台 → 配置聊天能用到的东西](/zh-cn/learning-workspace/chat/#配置聊天能用到的东西),配置范例见[模型与搜索提供商](/zh-cn/get-started/providers/)。 ## 知识库 -把上传内容转成文本(供知识库与出题用)的**文档解析**引擎——Text-only、MinerU、Docling、Tika、markitdown、PyMuPDF4LLM 或 LiteParse。本地模型下载**默认关闭**。详见[知识中心 → 文档解析](/zh-cn/explore/knowledge/#文档解析)。 +把上传内容转成文本(供知识库与出题用)的**文档解析**引擎——Text-only、MinerU、Docling、Tika、markitdown、PyMuPDF4LLM 或 LiteParse。本地模型下载**默认关闭**。详见[知识中心 → 文档解析](/zh-cn/learning-workspace/knowledge/#文档解析)。 ## 聊天 @@ -73,7 +73,7 @@ Partner 可以绑定所有者的工作区,共用最新材料。在工作区资 - **Starting points**(起始建议)——多少条近期活动参与生成空输入框下面那三行建议。 - **Attachments**(附件)——聊天附件的大小上限与提取预算(管理员门控)。 -MCP 服务**不再**在这里:每个账号都从个性化的 MCP 服务商店(`/space/mcp`)自行安装,或按 URL 添加远程服务器。见 [MCP 扩展](/zh-cn/ecosystem/mcp/)。 +MCP 服务**不再**在这里:每个账号都从个性化的 MCP 服务商店(`/space/mcp`)自行安装,或按 URL 添加远程服务器。见 [MCP 扩展](/zh-cn/customize/mcp/)。 ![视频学习设置](/screenshots/dev/settings-video.png) @@ -93,13 +93,13 @@ MCP 服务**不再**在这里:每个账号都从个性化的 MCP 服务商店 ## 伙伴与智能体 -配置**你能在聊天里调用的本地 agent harness**——Claude Code、Codex、Grok CLI、Antigravity CLI、Kimi CLI、opencode、MiMo Code、Hermes Agent、OpenClaw 与 DeepSeek Harness,也支持远程 Hermes 连接。各本地配置块会显示本机是否找到命令,支持时可同步模型列表,并暴露各 harness 的无人值守运行参数。详见[我的智能体](/zh-cn/explore/subagents/)。 +配置**你能在聊天里调用的本地 agent harness**——Claude Code、Codex、Grok CLI、Antigravity CLI、Kimi CLI、opencode、MiMo Code、Hermes Agent、OpenClaw 与 DeepSeek Harness,也支持远程 Hermes 连接。各本地配置块会显示本机是否找到命令,支持时可同步模型列表,并暴露各 harness 的无人值守运行参数。详见[我的智能体](/zh-cn/customize/agents/)。 ![伙伴与智能体设置](/screenshots/dev/settings-agents.png) ## 记忆 -调校基于分块的整理器:**Update** 与 **Audit** 各自针对每个 L2 界面与 L3 槽位的 LLM 轮数预算,以及 **Dedup** 迭代次数。详见[记忆 → 调校整理器](/zh-cn/explore/memory/#调校整理器)。 +调校基于分块的整理器:**Update** 与 **Audit** 各自针对每个 L2 界面与 L3 槽位的 LLM 轮数预算,以及 **Dedup** 迭代次数。详见[记忆 → 调校整理器](/zh-cn/learning-workspace/memory/#调校整理器)。 ## 关于与更新 @@ -118,6 +118,6 @@ MCP 服务**不再**在这里:每个账号都从个性化的 MCP 服务商店 ## 另见 - [模型与搜索提供商](/zh-cn/get-started/providers/)——模型与搜索的配置范例 -- [DeepTutor 生态](/zh-cn/ecosystem/)——在个性化管理 Skill、MCP 服务与 CLI App +- [DeepTutor 生态](/zh-cn/customize/)——在个性化管理 Skill、MCP 服务与 CLI App - [Docker](/zh-cn/get-started/docker/)——端口与反向代理说明 -- [记忆](/zh-cn/explore/memory/) · [知识空间](/zh-cn/explore/knowledge/) · [我的智能体](/zh-cn/explore/subagents/) +- [记忆](/zh-cn/learning-workspace/memory/) · [知识空间](/zh-cn/learning-workspace/knowledge/) · [我的智能体](/zh-cn/customize/agents/) diff --git a/docs/src/content/docs/zh-cn/get-started/from-source.md b/docs/src/content/docs/zh-cn/self-hosting/source.md similarity index 95% rename from docs/src/content/docs/zh-cn/get-started/from-source.md rename to docs/src/content/docs/zh-cn/self-hosting/source.md index 5264a7ca8..e67456d1f 100644 --- a/docs/src/content/docs/zh-cn/get-started/from-source.md +++ b/docs/src/content/docs/zh-cn/self-hosting/source.md @@ -27,7 +27,7 @@ deeptutor init deeptutor start --dev ``` -`deeptutor start` 会为本地 `web/` 前端构建一次生产版本并复用;`--dev` 则以 HMR 跑 Next.js。配置结构、端口、`Ctrl+C` 停止都和 [**PyPI 安装**](/zh-cn/get-started/pypi/) 一致。 +`deeptutor start` 会为本地 `web/` 前端构建一次生产版本并复用;`--dev` 则以 HMR 跑 Next.js。配置结构、端口、`Ctrl+C` 停止都和 [**PyPI 安装**](/zh-cn/self-hosting/pypi/) 一致。 修改模块或依赖分组前先停止 DeepTutor。安装后运行 `python -m pip check` 和 `deeptutor module list`。源码支持 `module enable/disable`;安装、卸载模块 wheel 应在独立 wheel 环境进行。重启时保留同一个运行目录。 @@ -167,9 +167,9 @@ python -m uvicorn deeptutor.api.main:app \ --reload --reload-exclude "web/*" --reload-exclude "data/*" ``` -更多修复方法:[**故障排查**](/zh-cn/get-started/troubleshooting/)。 +更多修复方法:[**故障排查**](/zh-cn/self-hosting/troubleshooting/)。 ## 下一步 -- [**DeepTutor CLI**](/zh-cn/cli/) —— 在同一个工作区里使用 CLI -- [**探索 DeepTutor**](/zh-cn/explore/) —— 看看跑起来的应用 +- [**DeepTutor CLI**](/zh-cn/developers/guides/cli/) —— 在同一个工作区里使用 CLI +- [**探索 DeepTutor**](/zh-cn/learning-workspace/) —— 看看跑起来的应用 diff --git a/docs/src/content/docs/zh-cn/get-started/troubleshooting.md b/docs/src/content/docs/zh-cn/self-hosting/troubleshooting.md similarity index 99% rename from docs/src/content/docs/zh-cn/get-started/troubleshooting.md rename to docs/src/content/docs/zh-cn/self-hosting/troubleshooting.md index 9777f16a1..41d550438 100644 --- a/docs/src/content/docs/zh-cn/get-started/troubleshooting.md +++ b/docs/src/content/docs/zh-cn/self-hosting/troubleshooting.md @@ -290,7 +290,7 @@ Long-poll / WebSocket 连接偶尔会掉。channel manager 会带退避自动重 - Teams / webhook 类 channel 检查公网 callback URL 是否能到达配置的 host/port/path - Matrix 检查 homeserver 是否有过于激进的超时 -针对每个 gateway 的调试方法见 [**Partners 伙伴与渠道**](/zh-cn/partners/) 和 [**渠道矩阵**](/zh-cn/partners/channels/)。 +针对每个 gateway 的调试方法见 [**Partners 伙伴与渠道**](/zh-cn/channels/) 和 [**渠道矩阵**](/zh-cn/channels/schema/)。 ## 记忆 / RAG 精度 diff --git a/docs/src/content/docs/zh-cn/welcome.mdx b/docs/src/content/docs/zh-cn/welcome.mdx new file mode 100644 index 000000000..e1a8706af --- /dev/null +++ b/docs/src/content/docs/zh-cn/welcome.mdx @@ -0,0 +1,44 @@ +--- +title: 欢迎 +description: DeepTutor 是一个 agent-native 学习伴侣。用它带着自己的材料学习、练习、做研究,并把每个主题留在各自的工作区里。 +quadrant: explanation +--- + +import { CardGrid, LinkCard } from '@astrojs/starlight/components'; + +DeepTutor 是一个 agent-native 学习伴侣。用它带着自己的材料学习、练习、做研究,并把每个主题留在各自的工作区里。 + +DeepTutor 工作区:对话旁边是学习相关的入口。 + +## 从这里开始 + +
+ + + + + +
+ +## 你可以用 DeepTutor 做什么 + +
+ + + + + + + + +
+ +## 更多入口 + +
+ + + + + +
diff --git a/docs/src/styles/global.css b/docs/src/styles/global.css index 929ee3e27..2725cd0f3 100644 --- a/docs/src/styles/global.css +++ b/docs/src/styles/global.css @@ -1,4 +1,4 @@ -@import url("https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300..700;1,9..144,300..600&family=Geist:wght@300;400;500;600;700&family=Geist+Mono:wght@400;500;600&display=swap"); +@import url("https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300..700;1,9..144,300..600&family=Geist:wght@300;400;500;600;700&family=Geist+Mono:wght@400;500;600&family=Noto+Serif+SC:wght@500;600;700&display=swap"); :root { color-scheme: light; @@ -20,7 +20,8 @@ transparent 70% ); - --font-display: "Fraunces", "Iowan Old Style", "Charter", Georgia, serif; + --font-display: "Fraunces", "Iowan Old Style", "Charter", Georgia, "Songti SC", + "Source Han Serif SC", "Noto Serif SC", "STSong", "SimSun", serif; --font-body: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif; --font-mono: Monaco, "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, diff --git a/docs/src/styles/landing.css b/docs/src/styles/landing.css new file mode 100644 index 000000000..22c5a91f8 --- /dev/null +++ b/docs/src/styles/landing.css @@ -0,0 +1,1008 @@ +.dt-landing .nav { +position:sticky;top:0;z-index:50;background:#faf8f3c7;backdrop-filter:saturate(180%) blur(14px);-webkit-backdrop-filter:saturate(180%) blur(14px);border-bottom:1px solid var(--rule) +} + +.dt-landing .nav-inner { +max-width:1280px;margin:0 auto;height:60px;padding:0 32px;display:flex;align-items:center;gap:10px;position:relative +} + +.dt-landing .nav-brand { +display:inline-flex;align-items:center;gap:9px;text-decoration:none;color:var(--ink) +} + +.dt-landing .nav-brand-mark { +width:26px;height:26px;object-fit:contain;flex-shrink:0 +} + +.dt-landing .nav-brand-home { +width:23px;height:23px;flex-shrink:0 +} + +.dt-landing .nav-brand-wordmark { +height:22px;width:auto;object-fit:contain;user-select:none +} + +html[data-theme=dark] .dt-landing .nav-brand-wordmark { +filter:invert(1) hue-rotate(180deg) brightness(1.12) +} + +.dt-landing .nav-links { +position:absolute;left:50%;transform:translate(-50%);display:flex;align-items:center;gap:4px +} + +.dt-landing .nav-social { +display:inline-flex;align-items:center;gap:2px +} + +.dt-landing .nav-icon { +display:inline-flex;align-items:center;justify-content:center;width:34px;height:34px;color:var(--ink-soft);border-radius:8px;text-decoration:none;transition:color .15s ease,background .15s ease +} + +.dt-landing .nav-icon svg { +width:19px;height:19px +} + +.dt-landing .nav-social a:nth-child(1) svg { +width:17px;height:17px +} + +.dt-landing .nav-social a:nth-child(2) svg, .dt-landing .nav-social a:nth-child(3) svg { +width:23px;height:23px +} + +.dt-landing .nav-icon:hover { +color:var(--ink);background:#18181c0d +} + +.dt-landing .nav-text { +text-decoration:none;color:var(--ink);font-size:15px;font-weight:500;padding:6px 12px;border-radius:8px;transition:color .15s ease,background .15s ease +} + +.dt-landing .nav-text:hover { +color:var(--ink);background:#18181c0d +} + +.dt-landing .nav-login { +display:inline-flex;align-items:center;padding:6px 16px;font-size:14px;font-weight:600;color:var(--paper);background:var(--ink);border-radius:999px;text-decoration:none;transition:opacity .15s ease;white-space:nowrap +} + +.dt-landing .nav-login:hover { +opacity:.85 +} + +.dt-landing .nav-links-divider { +margin:0 8px +} + +.dt-landing .nav-tools { +margin-left:auto;display:flex;align-items:center;gap:12px +} + +.dt-landing .nav-tool { +position:relative;display:inline-flex;align-items:center;gap:6px;color:var(--ink-soft);font-size:14px;font-weight:500;cursor:pointer;transition:color .15s ease +} + +.dt-landing .nav-tool:hover { +color:var(--ink) +} + +.dt-landing .nav-tool-icon { +flex-shrink:0;color:var(--ink-faint);transition:color .15s ease +} + +.dt-landing .nav-tool:hover .nav-tool-icon { +color:var(--ink-soft) +} + +.dt-landing .nav-select { +appearance:none;-webkit-appearance:none;border:0;background:transparent;color:inherit;font:inherit;cursor:pointer;padding:4px 16px 4px 0;outline:none;line-height:1 +} + +.dt-landing .nav-tool-caret { +position:absolute;right:0;pointer-events:none;opacity:.5 +} + +.dt-landing .nav-tool-divider { +width:1px;height:14px;background:var(--rule-strong);opacity:.6 +} + +@media(max-width:900px) { +.dt-landing .nav-links { +display:none +} +} + +@media(max-width:620px) { +.dt-landing .nav-inner { +height:56px;padding:0 16px;gap:8px +} +} + +.dt-landing .hero { +position:relative;max-width:1280px;margin:0 auto;padding:88px 32px 0;text-align:center;overflow:hidden +} + +.dt-landing .hero-bg { +position:absolute;top:60px;left:50%;transform:translate(-50%);width:760px;height:380px;background:var(--warm-glow);filter:blur(40px);z-index:-1;pointer-events:none +} + +.dt-landing .eyebrow { +display:inline-flex;align-items:center;gap:8px;margin-bottom:36px;padding:6px 14px;border:1px solid var(--rule);background:#faf8f399;border-radius:999px;font-family:var(--font-mono);font-size:11.5px;font-weight:500;letter-spacing:.04em;color:var(--ink-soft) +} + +.dt-landing .eyebrow .dot { +width:6px;height:6px;border-radius:50%;background:var(--accent);box-shadow:0 0 0 3px var(--accent-soft) +} + +.dt-landing .hero-wordmark { +display:block;max-width:380px;width:min(72%,380px);height:auto;margin:0 auto 32px;user-select:none +} + +.dt-landing .hero-tagline { +font-family:var(--font-display);font-weight:500;font-size:clamp(36px,5.4vw,60px);line-height:1.05;letter-spacing:-.03em;color:var(--ink);margin:0 auto 24px;max-width:760px;font-variation-settings:"opsz" 72,"SOFT" 30 +} + +.dt-landing .hero-tagline em { +font-style:italic;font-weight:400;color:var(--accent);font-variation-settings:"opsz" 72,"SOFT" 100 +} + +.dt-landing .hero-sub { +font-size:17px;line-height:1.55;color:var(--ink-soft);margin:0 auto 40px;max-width:560px;font-weight:400 +} + +.dt-landing .hero-actions { +display:flex;gap:10px;justify-content:center;flex-wrap:wrap;margin-bottom:0 +} + +.dt-landing .btn { +display:inline-flex;align-items:center;gap:8px;height:44px;padding:0 20px;border-radius:11px;font-size:14px;font-weight:500;text-decoration:none;transition:transform .18s ease,background .18s ease,border-color .18s ease,box-shadow .18s ease,color .18s ease;border:1px solid transparent +} + +.dt-landing .btn-primary { +background:var(--ink);color:var(--paper) +} + +.dt-landing .btn-primary:hover { +transform:translateY(-1px);box-shadow:0 8px 22px -10px #18181c73 +} + +.dt-landing .btn-ghost { +background:transparent;border-color:var(--rule-strong);color:var(--ink) +} + +.dt-landing .btn-ghost:hover { +border-color:var(--ink-soft);background:#18181c06;transform:translateY(-1px) +} + +.dt-landing .btn-gh { +gap:9px;padding:0 16px;font-family:var(--font-mono);font-size:13px +} + +.dt-landing .btn-gh svg { +flex-shrink:0 +} + +.dt-landing .btn-gh-sep { +width:1px;height:16px;background:var(--rule-strong);opacity:.8 +} + +.dt-landing .btn-gh-count { +font-family:var(--font-mono);font-weight:600;font-size:13.5px;letter-spacing:.01em;color:var(--ink);min-width:1.5ch;text-align:right +} + +.dt-landing .btn-gh-label { +font-family:var(--font-mono);color:var(--ink-soft);font-weight:500 +} + +.dt-landing .btn-gh:hover .btn-gh-count { +color:var(--ink) +} + +.dt-landing .hero-meta { +font-family:var(--font-mono);font-size:11.5px;color:var(--ink-faint);letter-spacing:.02em;display:inline-flex;flex-wrap:wrap;justify-content:center;gap:8px +} + +.dt-landing .hero-meta strong { +color:var(--ink-soft);font-weight:600 +} + +.dt-landing .hero-meta .sep { +opacity:.4 +} + +.dt-landing .showcase { +max-width:1180px;margin:56px auto 0;padding:0 32px +} + +.dt-landing .showcase-frame { +border-radius:20px;overflow:hidden;border:1px solid var(--rule-strong);background:var(--paper-soft);box-shadow:0 1px #fff9 inset,0 40px 80px -40px #18181c38,0 16px 32px -20px #18181c1a +} + +.dt-landing .showcase-frame img { +width:100%;display:block +} + +.dt-landing .section { +position:relative;max-width:1180px;margin:0 auto;padding:96px 32px 0 +} + +.dt-landing .section-quiet { +max-width:none;margin:0;padding-left:32px;padding-right:32px +} + +.dt-landing .section-quiet>.chapter-mark, .dt-landing .section-quiet>.section-head, .dt-landing .section-quiet>.install { +max-width:1180px;margin-left:auto;margin-right:auto +} + +.dt-landing .chapter-mark { +font-family:var(--font-display);font-style:italic;font-size:14px;font-weight:500;color:var(--ink-faint);text-align:center;letter-spacing:.04em;margin-bottom:24px;font-variation-settings:"opsz" 24 +} + +.dt-landing .section-head { +text-align:center;margin-bottom:52px;max-width:720px;margin-left:auto;margin-right:auto +} + +.dt-landing .section-eyebrow { +display:inline-block;margin-bottom:18px;font-family:var(--font-mono);font-size:11px;font-weight:600;letter-spacing:.18em;text-transform:uppercase;color:var(--accent) +} + +.dt-landing .section-head h2 { +font-family:var(--font-display);margin:0 0 16px;font-size:clamp(34px,4.4vw,52px);font-weight:500;letter-spacing:-.032em;line-height:1.05;color:var(--ink);font-variation-settings:"opsz" 56,"SOFT" 30 +} + +.dt-landing .section-head h2 em { +font-style:italic;font-weight:400;color:var(--ink-soft);font-variation-settings:"opsz" 56,"SOFT" 100 +} + +.dt-landing .section-head p { +margin:0 auto;max-width:580px;font-size:17px;color:var(--ink-soft);line-height:1.55 +} + +.dt-landing .feature-grid { +display:grid;grid-template-columns:repeat(4,1fr);border:1px solid var(--rule);border-radius:16px;overflow:hidden;background:var(--paper-soft);gap:1px +} + +.dt-landing .feature { +position:relative;display:flex;flex-direction:column;padding:28px 24px 26px;background:var(--paper);text-decoration:none;color:var(--ink);transition:background .25s ease,transform .2s ease +} + +.dt-landing .feature:hover { +background:#4d8fbf0a +} + +.dt-landing .feature-mark { +font-family:var(--font-display);font-style:italic;font-size:17px;font-weight:400;line-height:1;color:var(--accent);margin-bottom:16px;font-variation-settings:"opsz" 24 +} + +.dt-landing .feature h3 { +font-family:var(--font-display);margin:0 0 12px;font-size:18px;font-weight:500;letter-spacing:-.02em;color:var(--ink);font-variation-settings:"opsz" 24 +} + +.dt-landing .feature p { +margin:0;font-size:13px;line-height:1.6;color:var(--ink-soft);flex:1 +} + +.dt-landing .feature-arrow { +opacity:0;transform:translate(-4px,4px);transition:opacity .2s ease,transform .25s ease;margin-top:18px;color:var(--accent) +} + +.dt-landing .feature:hover .feature-arrow { +opacity:1;transform:translate(0) +} + +@media(max-width:1080px) { +.dt-landing .feature-grid { +grid-template-columns:repeat(2,1fr) +} +} + +@media(max-width:560px) { +.dt-landing .feature-grid { +grid-template-columns:1fr +} +} + +.dt-landing .install { +max-width:920px;margin:0 auto;display:grid;grid-template-columns:248px 1fr;border:1px solid var(--rule);border-radius:16px;overflow:hidden;background:var(--paper);box-shadow:0 1px #fff9 inset +} + +.dt-landing .install-rail { +display:flex;flex-direction:column;border-right:1px solid var(--rule);background:#18181c04 +} + +.dt-landing .install-opt { +appearance:none;background:transparent;border:0;border-bottom:1px solid var(--rule);cursor:pointer;display:flex;align-items:center;gap:14px;padding:18px 22px;text-align:left;color:var(--ink);transition:background .18s ease +} + +.dt-landing .install-rail .install-opt:last-child { +border-bottom:0 +} + +.dt-landing .install-opt:hover { +background:#4d8fbf0d +} + +.dt-landing .install-opt.is-active { +background:var(--paper) +} + +.dt-landing .install-opt-mark { +font-family:var(--font-display);font-style:italic;font-size:18px;font-weight:400;line-height:1;color:var(--ink-faint);min-width:20px;transition:color .18s ease +} + +.dt-landing .install-opt.is-active .install-opt-mark { +color:var(--accent) +} + +.dt-landing .install-opt-text { +display:flex;flex-direction:column;gap:2px +} + +.dt-landing .install-opt-name { +font-family:var(--font-display);font-size:17px;font-weight:500;letter-spacing:-.01em;color:var(--ink) +} + +.dt-landing .install-opt-tag { +font-family:var(--font-mono);font-size:11px;letter-spacing:.02em;color:var(--ink-faint) +} + +.dt-landing .install-detail { +padding:26px 28px 22px;min-width:0 +} + +.dt-landing .install-panel { +display:none;animation:install-fade .25s ease +} + +.dt-landing .install-panel.is-active { +display:block +} + +@keyframes install-fade{0%{opacity:0;transform:translateY(2px)}to{opacity:1;transform:translateY(0)}} + +.dt-landing .install-blurb { +margin:0 0 18px;font-size:14px;color:var(--ink-soft);line-height:1.55 +} + +.dt-landing .install-code { +margin:0;padding:20px 22px;background:#f4f0e88c;border:1px solid var(--rule);border-radius:10px;font-family:var(--font-mono);font-size:13px;line-height:1.78;color:var(--ink);overflow-x:auto;white-space:pre +} + +.dt-landing .install-code code { +font-family:inherit;font-size:inherit;color:inherit;background:transparent;padding:0 +} + +.dt-landing .install-foot { +margin:16px 2px 0;display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:12px;font-size:13.5px;color:var(--ink-soft) +} + +.dt-landing .install-foot-note { +font-family:var(--font-mono);font-size:12px;color:var(--ink-faint);letter-spacing:.01em +} + +.dt-landing .install-foot-link { +display:inline-flex;align-items:center;gap:6px;color:var(--ink);text-decoration:none;font-weight:500;font-size:13.5px;border-bottom:1px solid var(--rule-strong);padding-bottom:1px;transition:border-color .15s ease,color .15s ease +} + +.dt-landing .install-foot-link:hover { +border-color:var(--ink) +} + +.dt-landing .install-foot-link svg { +transition:transform .2s ease +} + +.dt-landing .install-foot-link:hover svg { +transform:translate(1px,-1px) +} + +@media(max-width:720px) { +.dt-landing .install { +grid-template-columns:1fr +} + +.dt-landing .install-rail { +flex-direction:row;overflow-x:auto;border-right:0;border-bottom:1px solid var(--rule) +} + +.dt-landing .install-opt { +flex:1 0 auto;border-bottom:0;border-right:1px solid var(--rule);padding:14px 16px +} + +.dt-landing .install-opt-tag { +display:none +} +} + +.dt-landing .section-eco { +padding-top:96px;padding-bottom:64px +} + +.dt-landing .section-eco .section-head { +margin-bottom:48px +} + +.dt-landing .eco-list { +max-width:820px;margin:0 auto;border-top:1px solid var(--rule) +} + +.dt-landing .eco-row { +display:grid;grid-template-columns:180px 1fr auto;align-items:center;gap:24px;padding:18px 8px;border-bottom:1px solid var(--rule);text-decoration:none;color:var(--ink);transition:padding .2s ease,background .18s ease +} + +.dt-landing .eco-row:hover { +padding-left:16px;background:#4d8fbf06 +} + +.dt-landing .eco-name { +font-family:var(--font-display);font-style:italic;font-size:19px;font-weight:500;letter-spacing:-.014em;color:var(--ink);font-variation-settings:"opsz" 24 +} + +.dt-landing .eco-desc { +font-size:14px;color:var(--ink-soft);line-height:1.5 +} + +.dt-landing .eco-arrow { +color:var(--ink-faint);transition:color .18s ease,transform .22s ease;display:inline-flex +} + +.dt-landing .eco-row:hover .eco-arrow { +color:var(--accent);transform:translate(2px,-2px) +} + +@media(max-width:720px) { +.dt-landing .eco-row { +grid-template-columns:1fr auto;gap:6px 12px;padding:16px 8px +} + +.dt-landing .eco-desc { +grid-column:1 / -1 +} +} + +.dt-landing .footer-credo { +text-align:center;margin:0 0 32px +} + +.dt-landing .footer-tagline { +font-family:var(--font-display);font-size:22px;font-weight:500;letter-spacing:-.02em;line-height:1.25;color:var(--ink);margin:0 0 14px;font-variation-settings:"opsz" 32 +} + +.dt-landing .footer-tagline em { +font-style:italic;font-weight:400;color:var(--ink-soft) +} + +.dt-landing .dt-app { +display:grid;grid-template-columns:220px 1fr;background:var(--paper);height:620px;max-height:78vh;font-size:13.5px;color:var(--ink) +} + +.dt-landing .dt-side { +display:flex;flex-direction:column;background:#f1ece1;border-right:1px solid var(--rule);min-width:0 +} + +.dt-landing .dt-side-head { +display:flex;align-items:center;justify-content:space-between;padding:0 14px;height:56px +} + +.dt-landing .dt-side-brand { +display:inline-flex;align-items:center;gap:4px;text-decoration:none +} + +.dt-landing .dt-side-logo { +width:22px;height:22px +} + +.dt-landing .dt-side-banner { +height:22px;width:auto +} + +.dt-landing .dt-side-collapse { +appearance:none;background:transparent;border:0;padding:4px;border-radius:6px;color:var(--ink-faint);cursor:pointer;transition:background .15s ease,color .15s ease +} + +.dt-landing .dt-side-collapse svg { +width:15px;height:15px +} + +.dt-landing .dt-side-collapse:hover { +background:#18181c0f;color:var(--ink) +} + +.dt-landing .dt-side-nav { +padding:4px 8px;display:flex;flex-direction:column;gap:1px;min-height:0;overflow-y:auto +} + +.dt-landing .dt-side-nav::-webkit-scrollbar { +width:6px +} + +.dt-landing .dt-side-nav::-webkit-scrollbar-thumb { +background:#18181c1a;border-radius:3px +} + +.dt-landing .dt-side-item { +appearance:none;background:transparent;border:0;font:inherit;text-align:left;text-decoration:none;display:flex;align-items:center;gap:10px;padding:7px 12px;border-radius:8px;color:var(--ink-soft);cursor:pointer;transition:background .15s ease,color .15s ease;font-size:13.5px +} + +.dt-landing .dt-side-item:hover { +background:#fffcf7a6;color:var(--ink) +} + +.dt-landing .dt-side-item.is-active { +background:#fffcf7d9;color:var(--ink);font-weight:500 +} + +.dt-landing .dt-side-icon { +width:16px;height:16px;flex-shrink:0;color:currentColor +} + +.dt-landing .dt-side-newchat { +color:var(--ink-soft) +} + +.dt-landing .dt-side-sublist { +margin:2px 0 6px 18px;padding-left:8px;border-left:1px solid rgba(24,24,28,.08);display:flex;flex-direction:column;gap:1px +} + +.dt-landing .dt-side-sub-label { +font-family:var(--font-mono);font-size:10.5px;font-weight:600;letter-spacing:.1em;text-transform:uppercase;color:var(--ink-faint);padding:6px 6px 2px +} + +.dt-landing .dt-side-sub-item { +display:flex;align-items:center;gap:8px;padding:4px 6px;border-radius:6px;color:var(--ink-soft);text-decoration:none;font-size:12.5px;transition:background .15s ease,color .15s ease +} + +.dt-landing .dt-side-sub-item:hover { +background:#fffcf7b3;color:var(--ink) +} + +.dt-landing .dt-side-dot { +width:6px;height:6px;border-radius:50%;background:#5ec48a;box-shadow:0 0 0 2px #5ec48a2e;flex-shrink:0 +} + +.dt-landing .dt-side-sub-text { +flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis +} + +.dt-landing .dt-side-sub-flat { +justify-content:space-between;padding-left:10px +} + +.dt-landing .dt-side-sub-meta { +font-family:var(--font-mono);font-size:10.5px;color:var(--ink-faint);margin-left:8px +} + +.dt-landing .dt-side-foot { +margin-top:auto;border-top:1px solid rgba(24,24,28,.06);padding:8px;display:flex;flex-direction:column;gap:4px +} + +.dt-landing .dt-side-version { +display:flex;align-items:center;justify-content:space-between;padding:4px 12px 2px +} + +.dt-landing .dt-side-version-tag { +font-family:var(--font-mono);font-size:11px;color:var(--ink-faint);letter-spacing:.02em +} + +.dt-landing .dt-side-gh { +display:inline-flex;width:22px;height:22px;align-items:center;justify-content:center;border-radius:6px;color:#18181c66;transition:color .15s ease,background .15s ease +} + +.dt-landing .dt-side-gh:hover { +color:var(--ink);background:#fffcf7b3 +} + +.dt-landing .dt-side-gh svg { +width:13px;height:13px +} + +.dt-landing .dt-main { +display:flex;flex-direction:column;min-width:0;background:var(--paper) +} + +.dt-landing .dt-topbar { +display:flex;align-items:center;justify-content:space-between;padding:13px 24px;border-bottom:1px solid var(--rule);gap:16px +} + +.dt-landing .dt-thread-title { +font-size:14px;font-weight:600;color:var(--ink) +} + +.dt-landing .dt-topbar-actions { +display:flex;gap:6px;flex-wrap:wrap +} + +.dt-landing .dt-act { +appearance:none;background:transparent;border:1px solid rgba(24,24,28,.1);color:var(--ink-soft);font-family:inherit;font-size:12px;font-weight:500;padding:6px 11px;border-radius:8px;display:inline-flex;align-items:center;gap:6px;cursor:pointer;transition:background .15s ease,border-color .15s ease,color .15s ease +} + +.dt-landing .dt-act svg { +width:13px;height:13px +} + +.dt-landing .dt-act:hover { +border-color:#18181c38;color:var(--ink) +} + +.dt-landing .dt-act.is-muted { +color:var(--ink-faint);cursor:not-allowed;border-color:#18181c14 +} + +.dt-landing .dt-act.is-muted:hover { +border-color:#18181c14;color:var(--ink-faint) +} + +.dt-landing .dt-canvas { +flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:24px 24px 48px;gap:30px +} + +.dt-landing .dt-greeting { +display:inline-flex;align-items:center;gap:14px +} + +.dt-landing .dt-greeting-mark { +width:36px;height:36px;user-select:none +} + +.dt-landing .dt-greeting h1 { +margin:0;font-family:var(--font-display);font-size:clamp(26px,3.4vw,40px);font-weight:500;letter-spacing:-.018em;line-height:1.1;color:var(--ink);font-variation-settings:"opsz" 44 +} + +.dt-landing .dt-composer { +width:100%;max-width:640px;background:var(--paper);border:1px solid rgba(24,24,28,.1);border-radius:26px;padding:14px 18px 10px;box-shadow:0 1px 2px #18181c06,0 10px 28px -10px #18181c14;transition:border-color .18s ease,box-shadow .18s ease +} + +.dt-landing .dt-composer:focus-within { +border-color:var(--accent);box-shadow:0 0 0 4px var(--accent-soft) +} + +.dt-landing .dt-composer-input { +width:100%;border:0;outline:0;resize:none;background:transparent;font-family:inherit;font-size:15px;line-height:1.55;color:var(--ink);padding:4px 0 6px +} + +.dt-landing .dt-composer-input::placeholder { +color:var(--ink-faint) +} + +.dt-landing .dt-composer-row { +display:flex;align-items:center;gap:6px;margin-top:4px;flex-wrap:nowrap +} + +.dt-landing .dt-composer-spacer { +flex:1 +} + +.dt-landing .dt-pill { +appearance:none;background:var(--paper);border:1px solid rgba(24,24,28,.12);border-radius:999px;height:28px;padding:0 10px 0 11px;display:inline-flex;align-items:center;gap:10px;font-size:13px;font-weight:500;color:var(--ink);cursor:pointer;transition:border-color .15s ease,background .15s ease,box-shadow .15s ease;box-shadow:0 1px 2px #18181c08 +} + +.dt-landing .dt-pill:hover { +border-color:#18181c38 +} + +.dt-landing .dt-pill-left { +display:inline-flex;align-items:center;gap:6px;min-width:0 +} + +.dt-landing .dt-pill-icon, .dt-landing .dt-pill svg { +width:13px;height:13px;color:var(--ink-soft);flex-shrink:0 +} + +.dt-landing .dt-pill-caret { +opacity:.55 +} + +.dt-landing .dt-pill-mode { +min-width:110px;justify-content:space-between +} + +.dt-landing .dt-pill-mode.is-pulsing { +animation:dt-pulse .45s ease +} + +@keyframes dt-pulse{0%{transform:scale(1)}50%{transform:scale(1.03)}to{transform:scale(1)}} + +.dt-landing .dt-pill-model { +gap:8px;max-width:160px +} + +.dt-landing .dt-pill-model .dt-pill-label { +max-width:110px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap +} + +.dt-landing .dt-model-dot { +width:6px;height:6px;border-radius:50%;background:linear-gradient(135deg,#d8a974,#c8865e);box-shadow:0 0 0 2px #d8a9742e;flex-shrink:0 +} + +.dt-landing .dt-tool { +appearance:none;background:transparent;border:0;color:var(--ink-soft);font:inherit;font-size:12.5px;font-weight:500;padding:6px 8px;border-radius:8px;display:inline-flex;align-items:center;gap:6px;cursor:pointer;transition:background .15s ease,color .15s ease +} + +.dt-landing .dt-tool:hover { +background:#18181c0a;color:var(--ink) +} + +.dt-landing .dt-tool svg { +width:13px;height:13px +} + +.dt-landing .dt-tool-caret { +opacity:.55 +} + +.dt-landing .dt-send { +width:28px;height:28px;border-radius:50%;border:0;background:#d8a97459;color:var(--paper);display:inline-flex;align-items:center;justify-content:center;cursor:pointer;transition:background .18s ease,transform .15s ease,box-shadow .18s ease;box-shadow:0 4px 12px #d8a9742e +} + +.dt-landing .dt-send svg { +width:14px;height:14px +} + +.dt-landing .dt-send:hover { +background:#d8a9748c +} + +.dt-landing .dt-send.is-active { +background:var(--ink);box-shadow:0 4px 14px #18181c40 +} + +.dt-landing .dt-send.is-active:hover { +background:#000;transform:translateY(-1px) +} + +@media(max-width:880px) { +.dt-landing .dt-app { +grid-template-columns:1fr;height:auto;max-height:none +} + +.dt-landing .dt-side { +display:none +} +} + +@media(max-width:640px) { +.dt-landing .dt-topbar-actions .dt-act:nth-child(-n+2) { +display:none +} + +.dt-landing .dt-act span:not(.dt-act-glyph) { +display:none +} + +.dt-landing .dt-tool span { +display:none +} + +.dt-landing .dt-pill-model { +max-width:120px +} + +.dt-landing .dt-pill-model .dt-pill-label { +max-width:70px +} +} + +html[data-theme=dark] .dt-landing .nav { +background:#0d0d10c7 +} + +html[data-theme=dark] .dt-landing .hero-wordmark { +filter:invert(1) hue-rotate(180deg) brightness(1.12) +} + +html[data-theme=dark] .dt-landing .showcase-frame { +box-shadow:0 1px #ffffff0a inset,0 40px 80px -44px #000000b3 +} + +html[data-theme=dark] .dt-landing .btn-primary:hover, html[data-theme=dark] .dt-landing .dt-send.is-active:hover { +background:#f1ede4;color:#0d0d10 +} + +html[data-theme=dark] .dt-landing .feature:hover, html[data-theme=dark] .dt-landing .eco-row:hover, html[data-theme=dark] .dt-landing .dt-tool:hover { +background:#7bbeea14 +} + +html[data-theme=dark] .dt-landing .install-code { +background:#16161abd +} + +html[data-theme=dark] .dt-landing .install-tabs { +background:#f1ede40a;border-color:#f1ede40f +} + +html[data-theme=dark] .dt-landing .install-tab.is-active { +background:#f1ede41a;box-shadow:0 1px 1px #0003,0 2px 8px -2px #0000004d +} + +html[data-theme=dark] .dt-landing .dt-side { +background:#141418 +} + +html[data-theme=dark] .dt-landing .dt-side-item:hover, html[data-theme=dark] .dt-landing .dt-side-item.is-active, html[data-theme=dark] .dt-landing .dt-side-sub-item:hover, html[data-theme=dark] .dt-landing .dt-side-gh:hover { +background:#f1ede40f +} + +html[data-theme=dark] .dt-landing .dt-act, html[data-theme=dark] .dt-landing .dt-composer, html[data-theme=dark] .dt-landing .dt-pill { +border-color:var(--rule) +} + +.dt-landing .footer { +max-width:1280px;margin:96px auto 0;padding:64px 32px 48px +} + +.dt-landing .footer-inner { +display:grid;grid-template-columns:260px 1fr;gap:48px;margin-bottom:64px +} + +.dt-landing .footer-brand { +display:inline-flex;align-items:center;gap:10px;text-decoration:none;color:var(--ink);align-self:start +} + +.dt-landing .footer-brand img { +width:32px;height:32px +} + +.dt-landing .footer-brand span { +font-family:var(--font-display);font-style:italic;font-weight:500;font-size:22px +} + +.dt-landing .footer-cols { +display:grid;grid-template-columns:repeat(3,1fr);gap:40px +} + +.dt-landing .footer-col h4 { +margin:0 0 16px;font-family:var(--font-mono);font-size:11px;font-weight:600;letter-spacing:.18em;text-transform:uppercase;color:var(--ink-faint) +} + +.dt-landing .footer-col a { +display:block;margin-bottom:10px;text-decoration:none;color:var(--ink-soft);font-size:14px;transition:color .15s ease +} + +.dt-landing .footer-col a:hover { +color:var(--ink) +} + +.dt-landing .footer-rule { +height:1px;background:var(--rule);margin-bottom:28px +} + +.dt-landing .footer-pulse { +margin:0 0 24px;display:inline-flex;align-items:center;flex-wrap:wrap;gap:7px;font-family:var(--font-mono);font-size:11.5px;letter-spacing:.02em;color:var(--ink-faint);opacity:1;transition:opacity .35s ease +} + +.dt-landing .footer-pulse[data-hidden=true] { +opacity:0;pointer-events:none;position:absolute +} + +.dt-landing .footer-pulse-dot { +width:6px;height:6px;border-radius:50%;background:var(--accent);box-shadow:0 0 0 3px var(--accent-soft);animation:dtPulse 2.4s ease-in-out infinite +} + +@keyframes dtPulse{0%,to{opacity:1;transform:scale(1)}50%{opacity:.45;transform:scale(.85)}} + +.dt-landing .footer-pulse .sep { +color:var(--ink-faint);opacity:.5 +} + +.dt-landing .footer-pulse .num { +color:var(--ink-soft);font-weight:600;font-variant-numeric:tabular-nums +} + +.dt-landing .footer-pulse .num>[data-pulse] { +color:var(--ink) +} + +.dt-landing .footer-pulse-tag { +color:var(--ink)!important;font-weight:600;text-decoration:none!important;border-bottom:1px solid var(--rule);padding-bottom:1px;transition:border-color .15s ease +} + +.dt-landing .footer-pulse-tag:hover { +border-color:var(--ink) +} + +.dt-landing .footer-fine { +display:flex;justify-content:space-between;font-family:var(--font-mono);font-size:11.5px;color:var(--ink-faint);letter-spacing:.02em +} + +.dt-landing .footer-fine a { +color:var(--ink-soft);text-decoration:none +} + +.dt-landing .footer-fine a:hover { +color:var(--ink) +} + +@media(max-width:720px) { +.dt-landing .footer-inner { +grid-template-columns:1fr;gap:32px +} + +.dt-landing .footer-cols { +grid-template-columns:repeat(2,1fr);gap:24px +} + +.dt-landing .footer-fine { +flex-direction:column;gap:8px +} +} + +body:has(.dt-landing) .page { + display: block; +} +body:has(.dt-landing) header.header, +body:has(.dt-landing) .sidebar-pane, +body:has(.dt-landing) .right-sidebar, +body:has(.dt-landing) footer.sl-flex, +body:has(.dt-landing) #_top { + display: none !important; +} +body:has(.dt-landing) .main-frame, +body:has(.dt-landing) .main-pane, +body:has(.dt-landing) .content-panel, +body:has(.dt-landing) .sl-container, +body:has(.dt-landing) .sl-markdown-content { + max-width: none; + width: 100%; + margin: 0; + padding: 0; +} +body:has(.dt-landing) { + background: var(--paper); +} + +.dt-landing .prose-block { + max-width: 720px; + margin: 0 auto; + color: var(--ink-soft); + font-size: 16px; + line-height: 1.7; +} +.dt-landing .prose-block p { margin: 0 0 16px; } +.dt-landing .prose-block a { color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--rule-strong); } +.dt-landing .prose-block a:hover { border-color: var(--accent); } +.dt-landing .prose-block strong { color: var(--ink); font-weight: 600; } + +.dt-landing .cap-wrap { + overflow-x: auto; + border: 1px solid var(--rule); + border-radius: 16px; + background: var(--paper); +} +.dt-landing .cap-wrap table { + width: 100%; + border-collapse: collapse; + font-size: 13.5px; +} +.dt-landing .cap-wrap th, +.dt-landing .cap-wrap td { + text-align: left; + padding: 12px 14px; + border-bottom: 1px solid var(--rule); + vertical-align: top; + color: var(--ink-soft); +} +.dt-landing .cap-wrap tr:last-child td { border-bottom: 0; } +.dt-landing .cap-wrap th { + font-family: var(--font-mono); + font-size: 11px; + letter-spacing: .08em; + text-transform: uppercase; + color: var(--ink-faint); + font-weight: 600; + background: var(--paper-soft); +} +.dt-landing .cap-wrap a { color: var(--accent); text-decoration: none; } +.dt-landing .cap-wrap a:hover { text-decoration: underline; } +.dt-landing .cap-wrap code { + font-family: var(--font-mono); + font-size: 12px; + color: var(--ink); +} +.dt-landing .cap-note { + max-width: 720px; + margin: -28px auto 28px; + text-align: center; + color: var(--ink-soft); + font-size: 15px; + line-height: 1.6; +} diff --git a/docs/src/styles/starlight.css b/docs/src/styles/starlight.css index 218d59e33..833f3a288 100644 --- a/docs/src/styles/starlight.css +++ b/docs/src/styles/starlight.css @@ -346,6 +346,23 @@ dialog[aria-label="Search"] .dialog-frame { color: var(--accent); } +/* Welcome page: product shot plus three-column link cards, in the + spirit of the Cursor docs home. */ +.dt-welcome-shot { + display: block; + width: 100%; + height: auto; + margin: 0.25rem 0 1.75rem; + border: 1px solid var(--sl-color-gray-5); + border-radius: 0.75rem; +} + +@media (min-width: 50rem) { + .dt-welcome-grid .card-grid { + grid-template-columns: 1fr 1fr 1fr; + } +} + /* Brand icons (channel/provider) embedded in tables and lists: keep them inline and vertically centred against the text baseline. */ .sl-markdown-content img[src^="/channel-icons/"],