Commit Graph

8205 Commits

Author SHA1 Message Date
chanx
e195a25972 fix: prevent stale loading state on previous agent chat reply (#18124) 2026-08-12 09:36:45 +08:00
Aari
a0e091e750 fix(data_source): scope table and link state to ancestors in format_document_soup (#17045)
### Summary

`format_document_soup` tracks "am I inside a table" and "am I inside a
link" with sticky flags that are meant to be reset by `elif e.name ==
"/table"` and `elif e.name == "/a"`. BeautifulSoup's `.descendants` only
yields opening tags — a `Tag` named `/table` or `/a` never exists — so
both branches are dead code and neither flag is ever cleared.

Everything after the first `<table>` on a page is therefore formatted as
if it were still table content: paragraphs lose their newline, list
items lose their `- ` marker, headings lose their break, and the text is
glued onto the last table cell. Under
`HTML_BASED_CONNECTOR_TRANSFORM_LINKS_STRATEGY=markdown` the same bug
leaks a link's `href` into everything that follows it, including whole
subsequent paragraphs. The Confluence connector
(`confluence_connector.py:948`) goes through this path.

Real output for a Confluence-shaped page (heading, intro, spec table,
then the body) via the public `parse_html_page_basic`:

**Before**

```
	prod	us-east-1 Rollback procedure If the canary fails, run the rollback script immediately. Drain the load balancer Revert the deployment Escalate to the on-call rota if the rollback stalls. Do not skip the post-mortem.
```

**After**

```
	prod	us-east-1
Rollback procedure
If the canary fails, run the rollback script immediately.
- Drain the load balancer
- Revert the deployment
Escalate to [the on-call rota](http://oncall.example.com) if the rollback stalls.
Do not skip the post-mortem.
```

Every heading, paragraph and list marker after the table is lost, and
the whole body is indexed as one run-on line hanging off a table cell.

### Fix

Derive both scopes from each element's **ancestors** instead of from
flags that nothing can clear, and drop the two dead branches plus the
two that become redundant.

The scopes are resolved in one up-front pass into `id`-keyed maps
(`table_scope`, `href_scope`) and looked up in O(1) per element. Probing
per element with `find_parent` instead is O(depth) each, which measured
12–13× slower on table-heavy pages and up to 103× on deeply nested
markup; the map version costs a depth-independent 1.13–1.35× over
`main`. Numbers and method are in the round-2 comment below.

This also changes one adjacent behaviour worth calling out explicitly: a
link **inside** a table cell now renders as markdown, where before it
rendered as plain text. That previous behaviour was not by design — it
only held when no link preceded the table. With a link before the table,
`main` stamps the stale href onto every cell:

```
main:   '[pre](http://STALE.com)\n\t[cellA](http://STALE.com)\t[cellB](http://STALE.com)'
branch: '[pre](http://STALE.com)\n\tcellA\tcellB'
```

Those cells are not links. Both symptoms are the same sticky-state bug,
so they are fixed together rather than left half-done.

### Testing

`test/unit_test/data_source/test_html_utils.py` is new —
`format_document_soup` had no test coverage. 11 tests: 8 fail on `main`
and pass on this branch, 3 are controls that pass on both (the table
itself still separates rows and cells, anchor text is still linkified,
the default `strip` strategy still strips).

Representative failures on `main`:

```
assert '\nAfter' in 'Before\n\tA\tB After'
assert '\n- item1' in 'Before\n\tA\tB item1 item2'
assert 'see [link](http://x.com) [ after](http://x.com)' == 'see [link](http://x.com) after'
assert '[next paragraph]' not in '[link](http://x.com)\n[next paragraph](http://x.com)'
```

Reverting each clause of the fix independently keeps the anchors honest:
reverting only the table clause fails exactly the 4 table tests and
leaves the link tests green; reverting only the link clause fails
exactly the 3 link tests and leaves the table tests green.
(`test_link_inside_a_table_cell_is_linkified` needs both clauses broken
to fail, so it appears in neither single-clause revert — it is covered
by the 8-fail run against `main`.)

Full `test/unit_test/data_source/` suite: **3 failed, 199 passed**, and
the failure set is byte-identical to clean `main` (**3 failed, 188
passed**) — the 3 are `TestSSRFValidation::*`, which resolve
`api.example.com` against real DNS and are unrelated to this change.
`ruff check` and `ruff format --check` are clean on both touched files.

---

This PR was drafted with AI assistance (Claude). I reviewed the change,
independently reproduced both symptoms against `main`, and take
responsibility for it.
2026-08-11 22:28:40 +08:00
taek105
492d6d81a9 fix: honor dataset language in Go vision dispatch (#17892)
### Summary

- Propagate the dataset language through Go DOCX, Markdown, PDF
figure-enhancement, and standalone-image vision paths.
- Explicitly render the shared figure prompt's `{{ language }}`
placeholder in Go.
- Use English when the dataset language is empty.
- Make the default standalone-image prompt request the dataset language
while preserving visible text in its original language.
- Add focused tests for caller propagation, language fallback, prompt
rendering, and prompt-cache isolation.
2026-08-11 22:18:04 +08:00
Jack
875ca966e9 refactor(parser): preserve HTML <table> structure (inline + structured item) (#18129)
Stop flattening `<table>` into a single text blob. A `<table>` now emits:
1. an inlined `doc_type_kwd:"text"` item keeping the `<table>…</table>`
markup (row/column structure survives for embedding/retrieval/LLM rendering),
2. a structured `doc_type_kwd:"table"` / `ck_type:"table"` item appended
after the walk, consumed by the downstream chunker.
2026-08-11 22:15:15 +08:00
Jack
b4dd0f7a0c fix(pdf/layout): replace KMeans-only column detection with gap + KMeans hybrid (#18023) 2026-08-11 22:13:42 +08:00
Zhichang Yu
d9ed14ce9c feat: wiki incremental Mode A/B with durable rewrite barrier (#18122)
Port the wiki_incremental dataset-level merge and make its rewrite
barrier durable and concurrency-safe. Wiki pages merge replace-only; the
barrier persists a monotonic numeric generation, and a scheduler-backed
per-dataset lock closes the cross-process TOCTOU window. Adds the
Compiler Plan toggle (frontend) with Mode A grouping.
2026-08-11 22:10:49 +08:00
rayhan
646fd8c2a6 fix: remediate CVE-2026-33752 by constraining curl_cffi to >=0.15.0 (#18134)
## Summary
  
Remediates CVE-2026-33752 (HIGH) in `curl_cffi` by adding
`curl_cffi>=0.15.0` to `constraint-dependencies` in `pyproject.toml`.
  
  | CVE | Severity | Package | Installed | Fixed in |
  |---|---|---|---|---|
  | CVE-2026-33752 | HIGH | curl_cffi | 0.14.0 | 0.15.0 |
2026-08-11 21:47:16 +08:00
Charles
add00924e7 fix: replace editdistance with rapidfuzz for python 3.13 wheel support (#18132)
### Summary

Fixes #18107.

`editdistance==0.8.1` (the only recent release on PyPI) has no cp313
wheels for any platform. Since this project requires exactly Python
3.13, `uv`/`pip`/`poetry` fall back to building it from source (Cython),
which fails on Windows for anyone without a working C build toolchain —
that's the PEP 517 build error in the issue.

Swapped `editdistance` for `rapidfuzz`, which ships full cp313 wheels
(win32/win_amd64/win_arm64 included) and has no build-from-source step
on any of our target platforms. The only call site was
`EntityResolution.is_similarity` in `rag/graphrag/entity_resolution.py`,
using `editdistance.eval(a, b)` to get the unweighted Levenshtein
distance between two entity names.
`rapidfuzz.distance.Levenshtein.distance(a, b)` computes the same thing
(verified identical output on several string pairs) and is used as a
direct replacement.
2026-08-11 21:44:36 +08:00
Ziyang Guo
75363af54b fix(mistral): honor dataset language in figure prompts (#18021)
### Summary

Refs #17885.

Mistral figure enrichment now receives the dataset language through the
production parsing path. `by_mistral_ocr` forwards `lang` to
`MistralParser.parse_pdf`; the parser stores the normalized language and
passes it to the figure-description prompt. Empty or missing values
still fall back to English.
2026-08-11 20:38:24 +08:00
Carl Calaquian
ad6fdfd7b4 fix(sandbox): update Tenki SDKs and drop removed project_id (#18117)
### Summary

Brings both halves of the Tenki sandbox provider onto current SDKs and
removes `project_id`, which Tenki deleted from its API.

**Go:** `github.com/LuxorLabs/tenki-sdk-go/sandbox` `v0.5.2` → `v0.7.0`
(current latest).
**Python:** the provider's SDK was renamed on PyPI — `tenki-sandbox` is
frozen at 0.4.0 and everything from 0.5 ships as
[`tenki`](https://pypi.org/project/tenki/). The docs told operators to
`pip install tenki-sandbox`, which installs a stale SDK that no longer
matches this provider's expectations.

**`project_id` is gone.** Tenki removed project scoping from the sandbox
API in 0.5.x: `Client.create()` no longer accepts `project_id`, so the
current code path would raise `TypeError` against a current SDK. It was
also marked `required: True` in the config schema, so the Admin >
Sandbox Settings form asked for a value that no longer exists.
2026-08-11 20:37:21 +08:00
balibabu
ec63ab37b1 Fix: Remove the model from the wiki template. (#18119) 2026-08-11 20:29:08 +08:00
balibabu
1d81ca27cc Fix: A dataset-level tree can also view file-level data. (#18123) 2026-08-11 20:28:44 +08:00
buua436
0cfd8f41e4 fix: improve incremental wiki compilation (#18130)
### What problem does this PR solve?

Incremental Wiki compilation could lose provenance for claim-light
entities, produce unstable page groups across embedding models, route
entities to unrelated pages, and assign topics without sufficient
page-level context. Document removals and page membership changes could
also leave stale Wiki state.

This PR:

- preserves source document and chunk provenance throughout entity
matching, reduction, page generation, and deletion;
- uses embeddings to retrieve candidates and the LLM to make final page
grouping and incremental routing decisions;
- batches embedding and LLM operations with bounded concurrency and
deterministic fallbacks;
- selects source-scoped topic candidates with embeddings before the page
LLM chooses the final topic;
- rebuilds Wiki state when the compilation mode or embedding model
changes;
- normalizes Wiki array fields returned by the API and retains entities
without relations in graph responses.

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
2026-08-11 20:13:04 +08:00
Jin Hai
4386ff71b0 Go: fix context, part2 (#18133)
Signed-off-by: Jin Hai <haijin.chn@gmail.com>
2026-08-11 20:12:29 +08:00
Jack
93dca789b5 refactor(parser): make markdown golden meta-driven, drop generator script (#18125) 2026-08-11 19:53:56 +08:00
Haruko386
3ef6e45e43 fix: return error when chat-channel start has error (#18068) 2026-08-11 19:36:35 +08:00
Jin Hai
c75edbfbe8 Go: fix context (#18118)
Signed-off-by: Jin Hai <haijin.chn@gmail.com>
2026-08-11 19:19:29 +08:00
nikminer
8bd5768ebc Integrate MWS model with API support and enhance chat functionality (#17959)
## What

This pull request adds **MWS GPT Model Hub** as a built-in model
provider in RAGFlow.

The integration allows users to configure an MWS project endpoint and
token, discover the models available to that project, and use supported
MWS models for chat completion, embeddings, and reranking.

Co-authored-by: ilarionov_n <ilarionov_n@promis.ru>
2026-08-11 19:12:42 +08:00
chanx
5e2c0eee28 refactor: use CopyToClipboard in embed-app-modal (#18115) 2026-08-11 19:08:33 +08:00
chanx
dbe2bf8b8b fix: sanitize img tags in markdown via shared SafeImg component (#18112) 2026-08-11 19:08:15 +08:00
Lynn
cd6996b301 Fix: xinference asr (#18110) 2026-08-11 19:07:50 +08:00
Yingfeng
fbcb8656ca Revert "Refine agentic search & orchestration loop" (#18108) 2026-08-11 18:53:49 +08:00
Jack
4a8bb1b72a test(parser): add shared golden-doc + alignment helpers (#18098)
Centralize the shared golden-doc + alignment helpers in `align_test.go` so the format-specific PRs (text&code, markdown golden, HTML) reuse one implementation instead of each carrying their own copy of the scaffolding.
2026-08-11 18:00:25 +08:00
dependabot[bot]
f0d1ff52ab chore(deps): bump fast-uri from 3.1.0 to 3.1.5 in /web (#18103)
Bumps [fast-uri](https://github.com/fastify/fast-uri) from 3.1.0 to

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-08-11 17:52:30 +08:00
qinling0210
d49af7f218 Generate navigation, navigation search (#18096)
### Summary
2 API

POST /api/v1/datasets/{dataset_id}/navigation

GET
/api/v1/datasets/{dataset_id}/navigation/search?q={query}&mode={mode}&top_k={topk}


2 cli

uv run --no-sync python3 admin/client/ragflow_cli.py -h 127.0.0.1 -p
9380 -t user

ragflow> GENERATE NAVIGATION OF DATASET 'frames tree';

ragflow> NAVIGATION SEARCH 'Christie introduced blockchain-based digital
passports' IN DATASET 'frames tree' MODE 'all' topk 20;

(mode: chunk, nav_cluster, nav_doc, navigation_tree, all)
2026-08-11 17:48:24 +08:00
Jack
a399b93143 Test(chunker): add golden parity harness, fixtures, and live Go<->Python tool (#17735)
Golden-parity test infrastructure for the **Go `TokenChunker` ↔ Python alignment**.
It runs the Go chunker over a committed case set (`testdata/parity/cases/`) and diffs each output against a captured Python golden (`testdata/parity/golden/`), honoring a `known_diffs.json` ratchet (`extra_fields` / `chunk_count` / `chunk_text`) so accepted divergences are tracked rather than silently widening.
2026-08-11 17:46:34 +08:00
chanx
ba671861e2 Fix: stabilize agent log handleSearch and preserve page_size on reset (#18087) 2026-08-11 17:25:24 +08:00
balibabu
7793d3c01c Fix: Retrieve the latest timeline data after cancelling the timeline task. (#18102) 2026-08-11 17:25:09 +08:00
balibabu
5dde775e19 Fix: If a message contains multiple files, they need to be displayed with automatic line wrapping. (#18109) 2026-08-11 17:24:47 +08:00
Lynn
59a524de70 Fix: remove some deprecated model (#18105) 2026-08-11 17:24:23 +08:00
Wang Qi
8e04f95773 Fix to force logout user when set user as inactive (#893) (#18104) 2026-08-11 17:00:57 +08:00
Jin Hai
d7661b676d Go: fix context and warnings (#18097)
Signed-off-by: Jin Hai <haijin.chn@gmail.com>
2026-08-11 16:18:49 +08:00
chanx
2409248801 fix: show filtered session count in session list header (#18094) 2026-08-11 16:14:08 +08:00
chanx
d33f87d3ca feat: rename agent log export button to export current page (#18090) 2026-08-11 16:13:56 +08:00
euvre
82d038543a fix: wrap long log messages in agent pipeline log sheet (#17782) 2026-08-11 16:08:43 +08:00
Haruko386
dd52dee600 feat[Go]: monitoring NATs and refactoring concurrency logic (#18049)
### Summary

As title
2026-08-11 14:36:11 +08:00
Jin Hai
25b579ac6c TS: more license declarations (#18081)
Signed-off-by: Jin Hai <haijin.chn@gmail.com>
2026-08-11 14:21:14 +08:00
balibabu
61fa96ee06 Fix: Click the blank area to prevent UpdateLogSheet from closing. (#18085) 2026-08-11 14:09:54 +08:00
balibabu
398d81f587 Fix: Move the content of the "Token Size" tab from the token chunker operator to the "Delimiter" tab. #17888 (#17975) 2026-08-11 14:07:15 +08:00
euvre
d33b937be6 fix(web): prevent column shift in data source log table (#17940) 2026-08-11 13:59:51 +08:00
buua436
5fd66154f3 fix: improve structure keyword search (#18055) 2026-08-11 13:58:00 +08:00
Zhichang Yu
64533e5b5e Refactor splitByTokens and wire wiki incremental compile (#18083)
Port dataset-level wiki incremental compile and refactor splitByTokens
token budgeting. Includes replace-only wiki merge, KNN dedup routing,
and template/config wiring.
2026-08-11 13:46:55 +08:00
balibabu
f83c4f97c1 Fix: After creating a wiki template and deleting the model instance, the default model appears empty, but it can still be edited and saved successfully. (#18075) 2026-08-11 13:45:04 +08:00
Yingfeng
f1641228e2 Refine agentic search & orchestration loop (#18057)
## Summary

This PR improves the RAGFlow agentic-search path in three areas: it
stops the outer agent from re-looping over the same rag call, lets the
medium thinking mode discover and follow new sub-claims mid-loop, and
strengthens retrieval by having the LLM emit synonym-rich queries with
time/date/number terms boosted.

1. Avoid the outer re-loop — keep all multi-hop cycles inside agentic
RAG

2. Dynamic claims in medium mode — keep querying newly discovered
sub-questions
medium now enables allows_dynamic_claims. During orchestration, when
claim analysis discovers a new required sub-question
(discovered_claims), the loop spawns it as a new ClaimTarget and
continues searching it in subsequent cycles (bounded by the
dynamic-claim budget) instead of stopping. Also added:

3. Stronger query strategy — synonym-rich queries + time/date/number
weighting

LLM-generated synonyms: the claim-analysis prompt now instructs the
model to write each next_queries entry as a retrieval-boosted query that
actively folds in entity aliases, DATE/TIME synonyms (e.g. 1994 → 1994,
66th Academy Awards), and number/unit variants (e.g. 1.95 m → 6 ft 5
in).

Time/date/number boosting: query.py boosts numeric/date tokens to a high
weight (_NUM_DATE_TOKEN_RE).
2026-08-11 13:40:11 +08:00
chanx
f930b1c1bc Fix: New sessions will automatically carry over messages from the previous session by default. (#18078) 2026-08-11 13:38:46 +08:00
chanx
e0d199ea7b fix(floating-selection-toolbar): adjust dropdown direction based on available space (#18053) 2026-08-11 13:31:42 +08:00
chanx
11c9649a6c Fixed: Updated the text color style of the copy button. (#18062) 2026-08-11 13:30:57 +08:00
Wang Qi
bd876c796e Fix: restrict xxx_ids to limit 100 (#18074) 2026-08-11 13:28:52 +08:00
Wang Qi
d7d6bb5b6a Fix max chunk_ids = 100 (#18080) 2026-08-11 13:13:08 +08:00
Jin Hai
fc44d2fe3f Go: fix context (#18076)
Signed-off-by: Jin Hai <haijin.chn@gmail.com>
dev-20260811-2
2026-08-11 11:54:57 +08:00