Commit Graph

24 Commits

Author SHA1 Message Date
Bingxi Zhao (Frank)
a7c30a588f release: v1.6.8
Twenty-two community pull requests and the reports behind them. Where
v1.6.7 chased a token budget spent on hidden thinking, this one answers
a different complaint: I did a thing and the app quietly did nothing.

New surfaces: a recycle bin that makes a deleted chat recoverable,
search across the full text of your conversation history, and
`knowledge_frontier` — a tool that reads a knowledge base and goes
looking for what is not in it.

Fixes worth naming: a reasoning model that stops mid-thought now fails
with the counters that prove it rather than an opaque error; deep book
URLs open the book instead of the library; the reading outline tracks
the page again; an EPUB that macOS re-zipped reads as the book it is; a
file whose extraction produced nothing is listed with the reason instead
of skipped in silence; the launcher stops killing a backend that is
merely still starting.

Also in this commit: README prose plus all eleven translations, the
v1.6.8 release notes with v1.6.5 archived past the one-week line, three
duplicate keys removed from the locale files (`Delete permanently` had
two different zh values, and the wrong one was winning), and the mypy
annotation that made every `conn.execute` in the new file library look
like a call on None.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 14:54:16 +08:00
evan188199-tech
2e9629785a fix(config): bump probe budget for reasoning models (#1401)
* fix(config): bump probe budget for reasoning models

Reasoning models (o1/o3, gpt-5.x) require max_completion_tokens, and
the API rejects the test-connection probe when the completion budget
is too low to cover the internal reasoning pass. Bumps the default
probe budget to 4096 for models that use max_completion_tokens.

* fix(config): preserve probe token overrides

* review: seed the probe knob, and test the thing this PR changes

The raised fallback is unreachable. `get_agent_params` always returns both
keys — it falls back to `DEFAULT_AGENTS_SETTINGS`, then to a generic
0.5/4096 — so `_test_llm`'s constant never decides anything and the probe has
been running at 4096 all along. This PR, as written, changes nothing for
anyone.

What does change it is the seed, which had no `diagnostics` section at all: a
fresh agents.yaml never showed the knob, and a stale one kept whatever it
already said. Seeded at the same number the fallback names, because two lists
of the same value is how a default and its seed drift apart (#1316). The
temperature moves 0.5 -> 0.1 as a result, which is what `test_runner` always
meant to ask for: a diagnostic wants a reproducible answer.

`tests/config/test_reasoning_probe_budget.py` tested
`uses_max_completion_tokens()`, a function this PR does not touch. It now
pins the floor, that agents.yaml still wins over it, that an unusable value
falls back rather than raising, and that the seed and the floor agree.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: XZH <cto@xzh.ai>
Co-authored-by: Bingxi Zhao (Frank) <13051345080@163.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 01:43:26 +08:00
Bingxi Zhao (Frank)
c31bed8aeb refactor(llm): one rule for a structured call a reasoning model starved
Four defects this month were the same failure: a step asks a model for a
whole payload in one shot, the model spends its whole max_tokens on
hidden thinking, and the provider returns a truncated body or none at
all — with no error. Book's spine collapsed to a single "Overview"
chapter (#1316), the quiz plan emitted zero templates (#1318), the
non-streaming path handed the scratchpad back as the answer (#1352).

Each fix grew its own retry. Book got `book/json_retry.py`; question got
`LabeledStepResult.reasoning_only`; research got nothing, so its
decompose step still degraded a topic to one sub-topic in silence, and
its report outline still lost the whole report structure.

Moves the rule out of `book/` — it was never Book's — into
`services/llm/structured_retry.py`, and points it at the streaming-side
detector so the two halves read as one rule: two ways to notice a budget
spent on hidden tokens, one remedy, which is to ask again with thinking
turned down.

Applies it to research's two one-shot payloads, which needed the step
wrapper to accept a per-call reasoning effort the way question's already
did.

The generic entry point takes the caller's own `is_usable` rather than
imposing the object shape. Research's decompose accepts a bare array of
sub-topics; judging that unusable would have retried a good answer and
then discarded it — a regression the object-shaped helper would have
caused as the only entry point. The object form still guarantees a dict,
because its callers index the result directly.

6902 passed, 24 skipped.
2026-09-11 12:43:41 +08:00
Bingxi Zhao (Frank)
ed85fe9bc2 refactor(config): put every LLM budget in agents.yaml, one entry per stage
A capability that makes several different LLM calls cannot be described
by one max_tokens: the step emitting a whole JSON plan and the step
writing one paragraph need different room. `chat` has said so since it
grew `exploring`/`responding`. `question` and `research` said the same
thing in module constants instead, where no user could reach them.

The cost of that was not theoretical. `capabilities.question.max_tokens`
governed exactly one of question's six LLM calls — the follow-up agent —
while the pipeline's five steps used constants that ignored it. The plan
step's constant sat below the capability's own ceiling, which is how
#1318 shipped a step that could spend its whole allowance thinking and
emit zero templates without an error. `EXPLORE_FINISH_MAX_TOKENS` had
been dead since it was written.

Generalises the seam that already worked rather than adding a parallel
one: `get_chat_params` becomes `get_capability_params(capability)` over a
table of per-stage defaults, and `question`, `research` and
`explore_context` get tables of their own holding the numbers they
already ran on. The pipelines resolve once in `__init__` beside the
budget they already cached. Unknown keys are dropped, so a misspelled
stage cannot become a silent no-op that reads like a setting.

The rule this establishes, stated in the tables: **agents.yaml owns every
LLM budget** (temperature, max_tokens, per stage); **main.yaml owns
runtime behaviour** (iteration caps, timeouts, retry policy, modes). A
budget in main.yaml is a bug. `tool_summarizer.max_tokens` still reads
its main.yaml value first so nobody's existing configuration moves; new
installs reach the same number through agents.yaml like everything else.
GraphRAG's reachability probe is the one documented exemption — tuning it
could only make a health check lie.

Seeds are derived from the same tables the pipelines read, because two
lists of the same numbers is how a default and its seed drift apart —
the shape of #1316. Tests pin both halves: the shipped values, and that
every stage in code is present in the seeded file.

No behaviour change: every default is the constant it replaced.
6902 passed, 24 skipped.
2026-09-11 12:43:41 +08:00
Bingxi Zhao (Frank)
5ac8e2c9d3 fix(book): give Book a reachable token budget, and retry a starved plan
A book built with a reasoning model arrives as a single "Overview"
chapter, or with the right chapter count and every learning objective
and summary empty (#1316). Two independent faults compose into that.

`get_agent_params` maps a module name to a section of agents.yaml, and
`book` was not in the map — so the function returned the source-level
`global_defaults` of 4096 *before* ever opening the file. That budget
was therefore not the shipped default and not overridable: adding a
`capabilities.book` block did nothing, and only editing the source could
change it. It is now mapped, seeded at 12000 in DEFAULT_AGENTS_SETTINGS
(so a stale agents.yaml still gets it), and honoured from the yaml.
12000 rather than a larger figure matches `research`, the closest
analogue, and keeps the request under the output cap of providers that
enforce one.

The budget is the trigger, not the fault. A reasoning model pays for its
hidden tokens out of the same `max_tokens` as its answer, so on a large
prompt asking for a whole JSON object it can spend the lot and emit
nothing. The provider does not raise — it returns a truncated body, or
none — and `parse_json_response` hands back the caller's fallback, which
in `SpineSynthesizer._materialise` is one placeholder chapter. Where the
budget ran out *mid*-object, json-repair closes the fragment and the
caller gets chapters whose objectives never arrived: the same failure
wearing a different face.

`blocks/_llm_writer.llm_json` already knew the escape hatch — ask again
with thinking turned down — but only block generators went through it.
The four pipeline agents each parsed their own response and had no retry
at all. `book/json_retry.py` is now the one place that rule lives, and
ideation, both source-explorer calls, all three spine rounds and the
page planner go through it; `llm_json` shares its predicate so the two
cannot drift. Each caller names the key that proves the payload arrived,
which is what lets a repaired-but-gutted object trigger the retry rather
than settle the stage.

`BaseAgent.call_llm` / `stream_llm` gained the `reasoning_effort`
parameter this needs; it was already the shape `llm_text` used.
2026-09-10 22:50:45 +08:00
Bingxi Zhao (Frank)
04040a2c06 release: v1.6.5
Ship a content workspace you choose, one exec tool for every language,
Mastery Path modes that gate its tools, and Settings that grades
readiness instead of listing faults.

Release notes: assets/releases/ver1-6-5.md
2026-09-06 13:46:29 +08:00
Bingxi Zhao (Frank)
fc39543bc0 feat: integrate frontend backend and canonical routes 2026-09-01 22:24:29 +08:00
Bingxi Zhao (Frank)
100bfd596d fix(persona): seed peer/teacher/research-assistant presets (#659)
Fresh installs showed an empty Persona list although the docs advertise
three presets. The presets now ship as package data and are seeded into
the admin workspace on first run (idempotent, non-destructive), so they
appear as read-only presets for every user.
2026-07-24 00:42:28 +08:00
Bingxi Zhao (Frank)
c9d387e2b6 super super great great update 2026-06-17 00:56:27 +08:00
Bingxi Zhao (Frank)
46093e5e2b update msg 2026-06-11 20:03:34 +08:00
Bingxi Zhao (Frank)
44564b077b Merge pull request #490: fix(visualize): unblock Gemini 2.5+ and harden Visualize pipeline
Squash-merge of #490 (skinred78) with two non-trivial conflict resolutions:

* `openai_compat_provider.py`: PR inlined reasoning_effort logic that has since
  been refactored into `build_openai_compatible_reasoning_kwargs`. Keep the
  helper call; the Gemini default-down will be folded into the helper in a
  follow-up commit instead of duplicating it inline.

* `capabilities/visualize.py`: i18n was applied to the review-stage messages
  after the PR forked. Kept the new try/except review-fallback structure but
  routed all three messages through `i18n.t(...)`; added `review_skipped_error`
  key to en/zh visualize.yaml.

Other PR changes applied as-is:
* `executors.py` / `cloud_provider.py`: inline Gemini 2.5/3.x default-down
* `loader.py`: section_map entry for `visualize`
* `init.py`: `capabilities.visualize` default with max_tokens=16384
* `code_generator_agent.py`: defensive root-tag trim for svg/html

Closes #489.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-28 17:50:56 +08:00
Bingxi Zhao (Frank)
90a2c14c81 chore: backend + frontend follow-ons for v1.4.0-beta
Wires the new memory / capability / settings / quiz subsystems into
existing surfaces and finishes the chat-pipeline follow-on work.

Backend:
- Session services pick up the cumulative source inventory + new tool
  tags (turn_runtime, sqlite_store, pocketbase_store, protocol,
  base_session_manager).
- LlamaIndex RAG pipeline config / document_loader / retrievers
  tightened; rag/service.py routed to match.
- Sessions / unified_ws / settings / notebook routers updated for
  delete-chat-turn, multi-user, and the new tool surface.
- TutorBot manager + Zulip channel + openai_compat_provider follow-on
  fixes layered on top of the v1.3.10 SSL/Zulip sweeps.
- runtime/{banner, launcher, orchestrator}, services/setup/init,
  prompt/manager, json_parser refined for the runtime-settings
  rewrite.

Frontend:
- Co-Learn pages and session-surfaces removed (folded into chat).
- Chat composer / messages / trace / session panels, sidebars,
  common modals, markdown renderers, and i18n updated for the new
  ask_user / write_note / source-inventory flow.
- Admin, agents, co-writer, playground, book pages picked up the
  shared updates.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 18:08:22 +08:00
Sam
6c2615df39 fix(visualize): unblock Gemini 2.5+, harden Visualize pipeline
Six bugs that combined to break the Visualize capability on Gemini 2.5
Flash (and similar thinking-by-default models). Each is independently
useful, but the user-visible symptom — Visualize "kind of works but
output is randomly truncated at ~370 chars" — needs all of them.

1. Gemini 2.5/3.x reasoning-tokens default (root cause)

   Gemini 2.5+ models burn most of `max_tokens` on internal "thinking"
   tokens by default. With `max_tokens=4096`, ~3900 went to reasoning
   and only ~160 came out as actual content, causing finish_reason=length
   on every multi-step pipeline (Visualize codegen + review, Deep Solve,
   anything that asks for a structured output beyond a sentence).

   Default `reasoning_effort="none"` for Gemini 2.5/3.x models when the
   caller doesn't specify, in all three execution paths:
   - provider_core/openai_compat_provider.py:_build_kwargs (live path)
   - executors.py:sdk_complete / sdk_stream (legacy SDK path)
   - cloud_provider.py:_openai_complete / _openai_stream (aiohttp fallback)

2. visualize capability had no agents.yaml entry

   `get_agent_params("visualize")` silently fell through to the 4096
   default because there was no section_map entry and no
   DEFAULT_AGENTS_SETTINGS entry. Added both, with a 16384-token budget
   appropriate for full HTML pages.

3. Review stage crashed hard on JSON parse failure

   `ReviewAgent.process` does `ReviewResult.model_validate(extract_json_object(response))`.
   When the model returned prose instead of JSON (common with large SVGs
   that the model can't escape into a JSON string), the parse raised and
   killed the entire turn. Wrapped pipeline.run_review() in try/except
   so review failure falls back to the unreviewed draft and the user
   still gets a rendered result.

4. Codegen output not trimmed to the root tag

   Models often wrap SVG/HTML in prose ("Here you go: <svg>…</svg>
   Enjoy!") or emit a closing code fence on the same line as `</html>`,
   which `extract_code_block`'s regex (requiring a leading \n before
   the fence) doesn't strip. Added defensive root-tag trimming for
   render_type=="svg" and render_type=="html".

Verified end-to-end on Gemini 2.5 Flash via the CLI and headless
Playwright: full 22 KB long-division HTML page, no truncation, all
interactive elements present, multi-step walkthrough completes
correctly (7852 ÷ 6 → 1308 R 4).
2026-05-17 16:36:05 +09:00
Bingxi Zhao (Frank)
85779c846b refactor env settings and installation 2026-05-11 12:59:56 +08:00
Bingxi Zhao (Frank)
eff1c0dff6 prepare v1.3.6 release
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-03 16:35:52 +08:00
Bingxi Zhao (Frank)
49661211ce prepare v1.3.5 release
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-02 20:16:07 +08:00
Bingxi Zhao (Frank)
824bf778df fix: lint & logging system 2026-05-01 01:39:08 +08:00
Roman Barlos
444b12a6d9 feat(chat): make per-stage token limits and temperature configurable via agents.yaml (#348)
Rebased onto latest dev (post-#352) to pull in the lazy loguru import in `deeptutor/tutorbot/channels/manager.py`, which was the root cause of the smoke-test failures (unrelated to this PR's own diff).

Merging: adds per-stage `max_tokens` and `temperature` knobs under `capabilities.chat` in `agents.yaml`, bumps the `responding`/`answer_now` defaults from 1800 → 8000 to fix mid-sentence truncation on long answers, and keeps safe fallbacks in `_ChatLimits.from_config` for legacy configs. 10 new unit tests covering loader resolution and dataclass coercion.
2026-04-21 00:13:07 +08:00
Bingxi Zhao (Frank)
2745e8bde9 feat(book): introduce book capability and restructure guide/co_writer modules
- Add new `deeptutor/book/` module with multi-agent pipeline
  (ideation, spine, page planner, source explorer, synthesizer)
  and rich block system (text, code, figure, quiz, flash cards,
  callout, deep dive, timeline, animation, concept graph, etc.)
- Add `/api/routers/book.py` and `deeptutor_cli/book.py` entry points
- Add web UI under `web/app/(workspace)/book/` with sidebar,
  chat panel, page reader, spine editor, progress timeline, and
  block renderers
- Move `deeptutor/agents/co_writer` -> `deeptutor/co_writer` and
  `deeptutor/agents/guide` -> `deeptutor/guide` (then remove guide
  entirely now superseded by book)
- Remove legacy guide UI, hooks, types, and API router
- Update visualize agents/prompts, notebook service, prompt manager,
  session turn runtime, and shared services to support new flows
- Refresh chat composer, sidebar, notebook selector, and locales

Made-with: Cursor
2026-04-20 00:33:33 +08:00
Bingxi Zhao (Frank)
100576da69 release: v1.1.2 — schema-driven channels, secret masking, RAG simplification, KB-consistency hardening
* TutorBot Channels tab is now schema-driven across every built-in & plugin channel
  (GET /api/v1/tutorbot/channels/schema), with per-field secret reveal toggles.
* Channel secrets are masked end-to-end; raw values only surface via the explicit
  ?include_secrets=true edit-form route. PATCH validates ChannelsConfig at the API
  boundary and returns 422 on bad payloads. reload_channels is serialised by an
  asyncio.Lock and records last_reload_error for the UI.
* Collapsed services/rag/ to a single LlamaIndex pipeline: removed ~2.6k lines of
  unused components/* + pipeline.py + types.py + utils/ + parsers/. rag_provider
  is now a stub; legacy values silently coerce to llamaindex.
* Centralised file routing into services/rag/file_routing.py (FileTypeRouter /
  DocumentType / FileClassification); dropped per-provider extension helpers.
* Defensive RAG/KB consistency: deep_solve / deep_research strip rag/kb when no
  KB is attached; SolveToolRuntime + ResearchPipeline + DecomposeAgent
  short-circuit instead of falling back to non-existent default KBs (DE-all,
  ai_textbook).
* Externalised AgenticChatPipeline prompts into agentic_chat.yaml (zh + en).
* Added Thai README (#337).
* New test modules: file_routing, knowledge_base_config, channel_schema,
  channel_secrets, rag_consistency, research_pipeline_rag.

Full notes: assets/releases/ver1-1-2.md

Made-with: Cursor
2026-04-18 11:33:53 +08:00
Bingxi Zhao (Frank)
4010a33aa3 fix: simplify search consolidation and use explicit runtime config in test runner
- Remove CONSOLIDATION_TYPES and explicit consolidation parameter;
  auto-consolidate for providers without native answer support.
- Build LLM/Embedding/Search configs directly from resolved runtime
  config in ConfigTestRunner instead of relying on global cache.
- Clean up default settings by removing unused consolidation fields.

Made-with: Cursor
2026-04-11 12:54:38 +08:00
Bingxi Zhao (Frank)
c15e22a4b3 chore: stable fix, add tutorbot 2026-03-20 20:27:17 +08:00
Bingxi Zhao (Frank)
f3779138ae fix: remove lightrag and unify llm & search config 2026-03-13 23:48:49 +08:00
Bingxi Zhao (Frank)
9c18bf0705 codebase cleanup and decoupled, introduce cli operation 2026-03-13 20:42:16 +08:00