1075 Commits

Author SHA1 Message Date
Bingxi Zhao (Frank)
b728354863 release: v1.5.2
Configurable chat attachment limits, PageIndex retrieval by reasoning
over your documents, broader Anthropic/OpenAI model support, and a
sweep of Book / Knowledge Base / chat-UI reliability fixes. Drop-in —
no migrations.

- attachments: size caps + extraction budgets editable in Settings →
  Chat → Attachments (admin), stored in system.json with CHAT_ATTACHMENT_*
  env overrides; the WebSocket frame ceiling is now derived from the
  total cap, fixing large uploads silently dropping the connection.
- pageindex: chat retrieves via an internal MCP server (agentic tool
  calls over the document tree); search() returns the outline; ingestion
  accepts PDF/Office/Markdown/text/CSV.
- llm: newer Anthropic/OpenAI models via official SDKs incl. Codex native
  tools; effort-based Claude → adaptive thinking; corrected temperature-
  rejection set; streamed usage counted once per completion.
- book/knowledge: rescue stuck GENERATING/PLANNING pages + reset on
  failure; KB status updates on upload/sync; atomic manager writes.
- web/channels: full-width chat + single scrollbar, aligned composer,
  Enter sends edited message, malformed-markdown crash fix; WeCom aligned
  with SDK 1.0.8; Mastery recency weighting restored (#618).
- release notes ver1-5-2.md (v1.5.0/v1.5.1 archived to past_releases/),
  __version__ bump to 1.5.2, README Releases row + one-week fold.
- README Settings/config prose + all 10 translations synced; docs
  settings/knowledge/chat pages updated separately in site/.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
v1.5.2
2026-07-19 17:15:36 +08:00
Bingxi Zhao (Frank)
c0037dfb58 fix chat attatchments 2026-07-19 16:56:34 +08:00
Bingxi Zhao (Frank)
b030697df7 refactor(web): shared IME-composing hook + citation-anchor helper; symmetric scrollbar gutter
Follow-up to #615/#608/#634: the isComposingRef + composition-handler
trio duplicated across five textareas (ComposerInput,
SimpleComposerInput, ChatMessages edit, BookChatPanel, PartnerComposer)
becomes one useImeComposing() hook; the citation-anchor fallback chain
+ <details> auto-open duplicated in both markdown renderers moves to
lib/markdown-anchors.ts; and the chat scrollport reserves the
scrollbar gutter on both edges so the message column centers on the
same axis as header and composer on classic-scrollbar platforms.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-19 01:38:06 +08:00
Bingxi Zhao (Frank)
9d285f1078 fix(wecom,parsing): bound the reply-frame cache; harden img_path anchoring
Follow-up to #631/#628: wecom's _chat_frames now uses the same
LRU-bounded OrderedDict idiom as the dedup cache (cap 1000) so
long-running bots can't grow it unboundedly, frame-body extraction is
deduped into one helper, and the dead _loop attribute is gone.
_absolutize_img_paths now skips non-string entries and refuses to
anchor traversal paths ('..' components) with a warning, so a crafted
content_list cannot point the vision stage outside the cache dir.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-19 01:38:06 +08:00
Bingxi Zhao (Frank)
2407c7cc16 refactor(agentic/auth): builder table couples native adapters to the tool allowlist; cookie name constant
Follow-up to #626/#625: _build_native_provider_adapter becomes a
_NATIVE_ADAPTER_BUILDERS dispatch table with the invariant documented
(every backend in _NATIVE_TOOL_BACKENDS must have an adapter branch)
and pinned by a test; ws_require_auth reads the dt_token cookie via
_COOKIE_NAME instead of a string literal.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-19 01:38:06 +08:00
Bingxi Zhao (Frank)
1a0c316625 refactor(knowledge): atomic JSON writes everywhere; reindex shares the pre-dispatch helper
Extends the #619 follow-up to the remaining plain truncate-writes of
metadata.json (add_documents, initializer, reindex task) and replaces
progress_tracker's hand-rolled fixed-name temp+replace with the shared
atomic_write_json. _mark_kb_queued_for_processing gains a status kwarg
so the reindex endpoint's pre-dispatch write uses the same seam as
upload/sync instead of an 11-line inline block.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-19 01:37:47 +08:00
Bingxi Zhao (Frank)
294849d1e5 fix(book): rescue PLANNING pages too; contain storage I/O in the worker loop
Follow-up to #636: _mark_page_error now also resets pages stranded at
PLANNING (plan_blocks_async can throw after the status is persisted),
and the background worker's log-append and finalize check are wrapped
so a storage hiccup can neither skip the page reset nor kill the
worker task.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-19 01:37:47 +08:00
Bingxi Zhao (Frank)
3f03d4eabd refactor(agentic): one shared once-per-stream usage recorder
Follow-up to #617, which fixed the N× inflation at three call sites and
left the pattern triplicated. record_streamed_usage() +
message_content_chars() in core/agentic/usage.py now serve
run_labeled_step, chat's _call_llm, and the question summarizer; the
redundant _UsageShim (UsageTracker already unwraps .usage), the dead
before_usage_calls guard, and both private _message_content_chars
copies are gone, along with an unreachable try/except around a dict
assignment. Accounting failures are now swallowed and debug-logged at
every site — usage bookkeeping can never break a completed stream.
Adds contract tests for the shared recorder.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-19 01:37:47 +08:00
Bingxi Zhao (Frank)
6718d04540 fix(llm): route effort-based Claude families to adaptive thinking instead of budget_tokens
Follow-up to #642: _build_kwargs still emitted thinking={enabled,
budget_tokens} for any configured reasoning_effort, which the same
families that reject temperature (Opus 4.7/4.8, Sonnet 5, Fable 5)
reject with a 400 — so the exact setups #642 enabled failed on every
request once an effort level was set. Real effort levels now map to
adaptive thinking there (no budget headroom inflation), thinking-off
sentinels (none/minimal/minimum) omit the param entirely (explicit
disabled is itself rejected on Fable 5), and Opus 4.6/Sonnet 4.6 keep
the enabled+budget_tokens path unchanged. The constant is renamed to
_EFFORT_BASED_FAMILIES since it now gates both removed params.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-19 01:25:59 +08:00
Bingxi Zhao
11f8262826 Merge pull request #634 from Alanaysis/fix/chat-full-width-scroll
fix: chat page not full width, scrollbar only works in middle area
2026-07-19 01:10:03 +08:00
Bingxi Zhao (Frank)
9781583455 fix: restore composer/message column alignment and loading-view height
The full-width refactor removed the parent px-6 inset the composer used
to sit inside, leaving the composer card 48px wider than the message
column. The composer root now carries its own px-6 (with the empty-state
cap bumped 720->768 so content width is unchanged in both states), and
the session-loading wrapper passes full height through so
SessionLoadingView's absolutely-positioned cancel button stays at the
chat-area corner instead of collapsing next to the spinner.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-19 01:09:47 +08:00
Bingxi Zhao (Frank)
c2e5eaf506 Merge remote-tracking branch 'origin/dev' into fix/chat-full-width-scroll 2026-07-19 01:06:53 +08:00
Bingxi Zhao
709c859307 Merge pull request #635 from Marnie0415/fix/kb-upload-status
fix(knowledge): update KB status to processing on file upload and sync-folder
2026-07-19 01:05:49 +08:00
Bingxi Zhao (Frank)
c463ab8387 refactor: shared pre-dispatch status helper + valid live-progress stage + regression test
Rebased onto dev (the original base, multi-user, is a stale v1.3.8
ancestor). The two duplicated inline update_kb_status blocks become one
_mark_kb_queued_for_processing helper, and the progress stage changes
from 'processing' (not a member of the frontend's LIVE_PROGRESS_STAGES
set, so the UI would not render live progress) to 'starting', matching
the reindex endpoint's pre-dispatch convention. Adds a router regression
test pinning status/stage/task_id before background dispatch.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-19 01:05:38 +08:00
Bingxi Zhao (Frank)
4a9db5e418 Merge remote-tracking branch 'origin/dev' into fix/kb-upload-status 2026-07-19 01:02:21 +08:00
Bingxi Zhao
28670a5b0c Merge pull request #642 from ShiGaChenTW/fix/anthropic-newer-model-support
fix: support newer Anthropic models via the official SDK
2026-07-19 01:00:28 +08:00
Bingxi Zhao (Frank)
2116ae8ca2 fix: correct temperature-rejection model set + skip tests where anthropic SDK absent
Opus 4.6 and Sonnet 4.6 still accept `temperature` — omitting it there
silently dropped the user's configured setting; and `opus-5`/`haiku-5`
matched no real model id. The set is now a documented module constant
covering exactly the effort-based families that 400 on temperature
(opus-4-7/4-8, sonnet-5, fable-5, mythos-5), with regression coverage
both ways. The new test file also gains pytest.importorskip('anthropic')
so it skips cleanly in environments without the optional [cli] SDK
(e.g. the CI python-tests job) instead of erroring on construction.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-19 01:00:12 +08:00
Bingxi Zhao
9c8b6b5333 Merge pull request #636 from Marnie0415/fix/book-page-stuck-generating
fix(book): reset page status on compilation failure (worker + inline)
2026-07-19 00:56:26 +08:00
Bingxi Zhao (Frank)
68aa57cff9 fix(book): harden worker-loop error reset — per-iteration page binding + shared best-effort helper
The except handler referenced `page`, which is bound only after the
loaders succeed: a loader failure on the first queue item raised
UnboundLocalError inside the handler and killed the worker task, and on
later iterations the handler could flip the previous iteration's stale
page to ERROR. `page` is now re-bound to None every iteration, both
reset paths share one _mark_page_error helper, and the save is
best-effort so a failing save cannot mask the original error or kill
the worker either. Adds regression tests for the helper's contract.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-19 00:56:01 +08:00
Bingxi Zhao
1d6b741270 Merge pull request #617 from mikezobern/fix/stream-usage-double-count
fix: count streamed LLM usage once per completion
2026-07-19 00:51:48 +08:00
Bingxi Zhao
94acb597b5 Merge pull request #629 from nyxst4ck/nyxst4ck/auto-quote-pip-extras-20260715-094558
docs: quote pip extras install examples
2026-07-19 00:50:56 +08:00
Bingxi Zhao (Frank)
7e763036ec chore: name the native-tool backend set; move wecom test beside other channel tests
Follow-up to #626/#631: the anthropic/openai_codex backend allowlist in
can_use_native_tool_calling becomes a documented module constant
mirroring _NATIVE_TOOL_BLOCKED_BINDINGS, and the WeCom regression test
moves to tests/services/partners/ where every other channel test lives.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-19 00:50:07 +08:00
Bingxi Zhao (Frank)
7f5092ec60 refactor(auth): single source of truth for session cookie attributes
Follow-up to #625: login's two set_cookie calls and logout's
delete_cookie now share one _cookie_attrs() helper, so the
create/delete attribute sets can never drift apart again (the drift
that caused #623). Reads module globals at call time to keep the
regression tests' monkeypatching working.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-19 00:50:07 +08:00
Bingxi Zhao (Frank)
96a3b5db6b refactor(knowledge): unify all manager JSON writes on services.file_io atomic writer
Follow-up to #619: every kb_config.json / metadata.json write in
KnowledgeBaseManager now goes through atomic_write_json (temp file +
fsync + os.replace) instead of the truncate-then-lock pattern, so a
crash mid-write can no longer leave a truncated config and concurrent
readers always see a complete previous or new file. The JSON variant
in services.file_io gains the same tolerant fsync as its text sibling,
the now-redundant private helper and dead file_lock_exclusive are
removed, and the atomicity-contract test moves next to the shared
writer in tests/services/test_file_io.py.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-19 00:50:07 +08:00
Bingxi Zhao
d344f95f65 Merge pull request #615 from FourWindff/fix/edit-message-enter-send
fix(webui): send edited user message on Enter, keep Shift+Enter as newline
2026-07-19 00:32:39 +08:00
Bingxi Zhao
42fc682e41 Merge pull request #608 from VectorPeak/codex/markdown-safe-hash-decode
fix(web): avoid crashes on malformed Markdown hash links
2026-07-19 00:32:35 +08:00
Bingxi Zhao
3528dd071f Merge pull request #631 from tianrking/agent/fix-wecom-sdk-startup
fix(partners): align WeCom with SDK 1.0.8
2026-07-19 00:32:32 +08:00
Bingxi Zhao
9379e78018 Merge pull request #628 from xor-xe/fix/624-mineru-image-paths
fix: resolve relative img_path in parsed content lists to absolute paths
2026-07-19 00:32:28 +08:00
Bingxi Zhao
8192029519 Merge pull request #626 from NoxsMedia/fix/openai-codex-native-tools
fix(llm): enable OpenAI Codex native tool calls
2026-07-19 00:31:38 +08:00
Bingxi Zhao
ae3c71ab98 Merge pull request #625 from whm8016/fix/logout-cookie-secure-samesite
fix: set Secure attribute when clearing dt_token on logout
2026-07-19 00:31:34 +08:00
Bingxi Zhao
f8ede5e20f Merge pull request #622 from whm8016/fix/mastery-recency-weighting
fix: restore recency weighting in compute_mastery (#618)
2026-07-19 00:31:31 +08:00
Bingxi Zhao
38f2e8cf1d Merge pull request #619 from huytg2610/fix/persist-linked-folder-sync-state
fix(knowledge): persist linked folder sync state updates
2026-07-19 00:31:27 +08:00
Bingxi Zhao (Frank)
fb3c568697 fix pageindex & minor bugs 2026-07-18 19:47:03 +08:00
Bingxi Zhao
d905d8f40b Merge pull request #627 from BukeLy/feat/pageindex-mcp-retrieval
feat(pageindex): retrieval via MCP tools + full document-endpoint format support
2026-07-18 19:35:58 +08:00
Bingxi Zhao (Frank)
02483a72f4 fix(pageindex): align EngineDetail i18n key with source string
The engine-prerequisite line rendered via t() ends at "…Markdown
formats.", but the en/zh locale keys carried an extra "Chat retrieval
only." clause. The lookup missed, so both locales fell back to the
English source and the zh translation never rendered.

Drop the trailing clause from the locale keys (and the matching zh
value) rather than adding it to the source: search() still returns
document outlines to programmatic callers, so retrieval is not
chat-only.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-18 19:33:36 +08:00
ShiGa Chen
b0d1b3ad04 fix: support newer Anthropic models via the official SDK
Three issues prevented configuring an Anthropic profile (e.g. Claude
Opus 4.8) through the official `anthropic` SDK path:

1. base_url doubling: the SDK always appends its own `/v1/...`, so a
   base_url ending in `/v1` (as shown in Anthropic's REST docs and
   commonly entered by users) produced `/v1/v1/messages` -> 404
   not_found_error. Strip a trailing `/v1` before handing it to the SDK.

2. temperature: effort-based models (Opus 4.6/4.7/4.8, Sonnet 4.6/5,
   etc.) reject `temperature`, but only `opus-4-7` was exempted, so
   Opus 4.8 failed with `invalid_request_error: temperature is
   deprecated for this model`. Extend the omit list.

3. cache_control limit: system + message + per-tool markers could
   exceed Anthropic's hard cap of 4 cache_control breakpoints once
   ~11+ tools were registered -> `A maximum of 4 blocks with
   cache_control may be provided`. Budget markers across all sections.

Adds tests/services/llm/test_anthropic_provider_fixes.py covering all
three.
2026-07-18 17:28:02 +08:00
Marnie0415
fc73ef6d87 fix(book): also handle compile_page inline path for stuck GENERATING
The compile_page method (user-triggered via HTTP/WebSocket) calls
self.compiler.compile_page() without try/except. If the compiler throws,
the page status is left in GENERATING permanently — same bug as _worker_loop.

Added exception handling that resets page status to ERROR on failure, then
re-raises so the caller still sees the error.
2026-07-17 02:56:48 +08:00
Marnie0415
e460db38a9 fix(knowledge): also update KB status on sync-folder dispatch
The sync_folder endpoint calls run_upload_processing_task without updating
KB status first, same race condition as upload_files. Added the same
status update before background task dispatch.
2026-07-17 02:55:23 +08:00
Marnie0415
24bd4d93d3 fix(book): reset page status on background compilation failure
When a Book page fails to compile in the background worker (e.g. LLM timeout,
network error), the page status is left stuck in GENERATING permanently. The user
sees the page spinning forever with no way to retry.

Added a status reset in the exception handler: when compilation fails, the page
status is set to ERROR with the error message. This allows the user to see the
failure reason and the page becomes eligible for retry on the next resume_book
call.
2026-07-17 02:44:35 +08:00
Marnie0415
93c50ce49e fix(knowledge): update KB status to processing on file upload
When files are uploaded to an existing knowledge base via POST /{kb_name}/upload,
the KB status remains ready until the background indexing task starts. This creates
a window where the user sees the KB as ready but newly uploaded files are not yet
searchable.

Added a manager.update_kb_status() call before the background task is dispatched,
matching the behavior of create_knowledge_base which already sets status=initializing.
2026-07-17 02:42:04 +08:00
AIanaysis
31d72be98c fix: chat page not full width, scrollbar only works in middle area
- Remove max-width constraint on chat scroll container to make it fill full width
- Keep message content and input box original centered 960px width for readability
- Scrollbar now appears at the far right of the page, works on entire area
2026-07-16 20:23:11 +08:00
tianrking
8cf604577e fix(partners): align WeCom with SDK 1.0.8 2026-07-16 13:23:36 +08:00
nyxst4ck
0c6b7f1518 docs: quote pip extras install examples 2026-07-15 09:46:14 -03:00
BukeLy
7d270b3956 fix(pageindex): update stale provider description in factory list_pipelines 2026-07-15 18:35:07 +08:00
BukeLy
3288ce7931 refactor(pageindex): trim review findings — drop redundant dir resolution in search, dedupe deferred_tools() call, inline blocklist, fix stale docstrings 2026-07-15 18:30:04 +08:00
BukeLy
2e82ad4d27 feat(pageindex): agentic retrieval via MCP tools + full document-endpoint format support
PageIndex deprecated its REST retrieval endpoint; deep retrieval is now
agentic through the hosted PageIndex MCP server, while search() serves
programmatic callers with real document tree outlines.

- New built-in "pageindex" MCP server entry, code-injected at manager load
  when an API key is configured (never persisted to mcp.json; user-defined
  entry wins; hot-reloads on key change). remove_document is blocked via a
  new MCPServerConfig.disabled_tools blocklist.
- Chat turns with a PageIndex KB attached get the server's tools preloaded
  under a narrowed implicit grant (KB access = permission), plus a system
  prompt block listing the KB's file -> doc_id manifest with usage notes.
  The rag tool's kb_name enum excludes PageIndex KBs (a pure-PageIndex
  conversation doesn't mount rag), so the agent reads those docs via MCP.
- PageIndexPipeline.search() now returns each document's tree outline
  (titles / pages / summaries) fetched over REST (GET /doc/{id}/?summary=true)
  as honest structural context for programmatic callers (book, co-writer,
  seed, CLI). No new error_type; existing not_configured / retrieval_error /
  needs_reindex semantics are unchanged. The dead REST retrieval client
  methods are deleted. Existing KBs need no migration.
- SUPPORTED_EXTENSIONS now mirrors POST /doc/: pdf, md, markdown, txt, docx,
  doc, pptx, ppt, xlsx, xls, csv (zip stays a local container); frontend
  format list + copy updated (en/zh).
2026-07-15 18:21:43 +08:00
xor_xe
68613a6418 fix: resolve relative img_path in parsed content lists to absolute paths
MinerU emits img_path entries like images/x.png relative to the
content-list file inside the parse cache. RAG-Anything resolves them
against its own working directory, so the vision stage cannot open the
images when indexing with LightRAG. Anchor relative img_path values at
the content dir when loading the cached IR; the cached JSON itself stays
relative so cache dirs remain relocatable.

Fixes #624
2026-07-15 13:53:50 +04:00
NoxsMedia
c6b6d87651 fix(llm): enable OpenAI Codex native tool calls 2026-07-15 15:59:37 +08:00
whm
ec3b12c4f2 fix: set Secure attribute when clearing dt_token on logout
logout() called delete_cookie() with only samesite, which defaults
secure=False. When cookie_secure=true (SameSite=None), that produces
an invalid SameSite=None-without-Secure expiry header that browsers
reject, leaving the original dt_token cookie in place after sign-out.

Closes #623

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-14 19:59:23 +08:00
whm
5d7647002e fix: restore recency weighting in compute_mastery (#618) 2026-07-12 16:36:02 +08:00