4771 Commits

Author SHA1 Message Date
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
Dryice Liu
c84ff4daf4 test(settings): cover code block preview wrapping
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-07-18 16:34:35 +08:00
Dryice Liu
2bd9ce1538 feat(settings): preview selected code block theme
Add a live Python code-block preview to Settings → Appearance that uses the real RichCodeBlock renderer, so selected syntax theme, line numbers, and wrapping are visible immediately. Dynamically load the preview client-side to avoid server/client style mismatches from persisted AppShell preferences. Also use wordWrap consistently in RichCodeBlock to avoid React shorthand/non-shorthand style warnings when wrapping changes.
2026-07-18 15:47:20 +08:00
Dryice Liu
13899be20d fix(web): allow 127.0.0.1 as dev origin so hydration completes
Next.js 16 blocks cross-origin access to /_next/* dev resources (HMR
WebSocket, dev-only fonts and scripts) unless the host is on
allowedDevOrigins. Browsing http://127.0.0.1:<port>/ against a dev
server bound to localhost was silently breaking client hydration:
SSR HTML rendered, but no React fibers, event handlers, or effects
attached — every page looked loaded but controls were inert and
settings never fetched. Allow 127.0.0.1 to restore hydration.
2026-07-18 15:23:42 +08:00
Dryice Liu
9cf8829f3b test(web): cover code block appearance preferences
Add node tests for the theme registry (completeness, invalid-theme
fallback, label formatting), RichCodeBlock (background derivation,
line numbers, wrapping, plain-text routing), SettingsContext
(boolean hydration, backend sync, partial-update persistence),
AppShell storage (SSR defaults, event sync), the appearance page
(syntax-theme select, two toggles), and the markdown fallback
path. Register module aliases so the node tests can resolve
web-path imports.
2026-07-18 14:52:06 +08:00
Dryice Liu
1ce246a546 feat(settings): add code block appearance controls and renderer
Add a Code blocks section to Settings → Appearance with one Prism
theme dropdown and two toggles (line numbers, wrap long lines).
Update RichCodeBlock to derive background/color from the selected
Prism style via getCodeBlockThemeBackground, route plain text
through SyntaxHighlighter so line numbers and wrapping stay
consistent, and remove the hardcoded #1f2937 dark panel so light
themes remain readable.
2026-07-18 14:51:55 +08:00
Dryice Liu
7ff6b23c2b feat(web): add code block theme registry and shell distribution
Add a registry of every installed Prism theme (46 options) using
individual module imports rather than the barrel, plus type
declarations for the style modules. Extend AppShell storage and
context so code-block preferences are available synchronously to
renderers outside /settings/*. Sync backend-loaded values from
SettingsContext into AppShell storage and add update helpers that
PUT only the changed field.
2026-07-18 14:51:47 +08:00
Dryice Liu
b893d0a2b2 feat(settings): persist code block appearance options in backend
Add code_block_theme, code_block_show_line_numbers, and
code_block_wrap_long_lines to UI settings with defaults (oneDark,
false, false). The Pydantic update model uses Optional fields with
exclude_none=True so existing {theme, language} saves do not reset
saved code-block preferences.
2026-07-18 14:51:34 +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
huy
6ae7a68120 fix(knowledge): persist linked folder sync state updates
update_folder_sync_state() mutated the loaded metadata dict and
returned without writing it back, so last_sync/synced_files never
reached metadata.json while the API layer logged success. Future
scans re-treated already-synced files as new.

Write back through a same-directory temp file + os.replace so
readers never observe a truncated metadata.json.
2026-07-11 23:01:04 +07:00
mikezobern
a1d5f6a55b fix: count streamed LLM usage once per completion
Providers such as Gemini's OpenAI-compat API attach usage to multiple
stream chunks. Recording each frame inflated total_calls and tokens for
a single agent-loop round. Keep the latest usage and record it once,
matching run_labeled_step, and cover the regression with a test.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-10 16:56:47 +04:00
Bingxi Zhao (Frank)
3e3b9a6ecb release: v1.5.1
Knowledge Center: remove a single raw document from a knowledge base —
even one stuck in an error state — instead of deleting and rebuilding
the whole base. A file that failed to parse (e.g. one over the cloud
parser's page limit) can now be dropped in place, with replace/retry.

- backend: remove_raw_document() decoupled from DocumentAdder (needs no
  ready index) + DELETE /{kb_name}/files/{filename:path}; shared
  _read_metadata / _write_metadata / _raw_hash_key helpers so indexing
  and removal agree on the hash key. Connected/legacy KBs still rejected.
- web: deleteKbFile() API, per-file delete in the Files tab, and
  error-state KBs unlocked for drop / upload-replacement / retry.
- release notes ver1-5-1.md (old notes archived to past_releases/),
  __version__ bump to 1.5.1, README Releases row + one-week fold.
- README KB prose + all 10 translations synced; docs knowledge page
  updated separately in site/.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
v1.5.1
2026-07-09 23:23:27 +08:00
FourWindff
57243142da fix(webui): send edited user message on Enter, keep Shift+Enter as newline
The message edit textarea previously only submitted on Ctrl/Cmd+Enter,
so both Enter and Shift+Enter inserted newlines. Align it with the
composer behavior: Enter submits, Shift+Enter inserts a newline. Also
guard against IME composition to avoid accidental submissions while
selecting candidates.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-09 22:52:16 +08:00