1713 Commits

Author SHA1 Message Date
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
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
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
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
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
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
Lynn
15ab2b3ee2 Fix: update tree when delete skill node (#18063) 2026-08-11 09:49:22 +08:00
Lynn
7ac59d1a36 Fix: set column type priority (#18054) 2026-08-10 20:08:06 +08:00
Ziyang Guo
eb184c839c chore(wiki): remove stray debug print (#18020)
### Summary

Remove a stray `print()` from the Wiki source-context fallback.
2026-08-10 18:22:44 +08:00
buua436
6f50e478e0 fix: exclude disabled documents from dataset structures (#18041) 2026-08-10 17:50:34 +08:00
黑墨水鱼
4eaad55efe fix: align LocalAI vision constructor arguments (#16920)
## What problem does this PR solve?

`TenantLLMService.model_instance` constructs vision providers with
`lang` as the third positional argument and `base_url` as a keyword
argument.

`LocalAICV` declared `base_url` as its third parameter, causing:

```text
TypeError: LocalAICV.__init__() got multiple values for argument 'base_url'
```

This prevents LocalAI vision models from being used during document
parsing.

Co-authored-by: Jin Hai <haijin.chn@gmail.com>
2026-08-10 15:59:06 +08:00
buua436
c0582b8e18 fix: handle disabled documents in dataset structures (#18033) 2026-08-10 13:52:49 +08:00
Yingfeng
b5bffa0fa3 Refine sufficient check using LLM draft (#18028) 2026-08-10 11:44:47 +08:00
Wang Qi
3d41ebdded Fix naive ask report error (#18030) 2026-08-10 11:21:23 +08:00
S
99110c2df0 chore(rag/app): remove stray debug print() calls (#17943)
chore(rag/app): remove stray debug print() calls

Two hot-path debug print() calls were leaking content/error text to
stdout in production code paths.

* rag/app/naive.py: TxtParser branch in chunk() was printing the entire
  parsed sections list (formatted via repr()) wrapped in 150-char banner
  lines. For large text documents (e.g. a 1000+-page book ingest) this
  dumped tens of thousands of lines per ingest into the docker logs.
  Replaced with a structured
  `logging.info("TxtParser produced %d sections for %s", len(sections),
  filename)` so the parse count is still observable without the content
  leak.

* rag/app/presentation.py: Pdf.position parsing had a debug
  `print(f"Error parsing position: {e}")` inside an except clause in the
  ingest hot path. Replaced with
  `logging.warning(f"Error parsing position in {filename}: {e}")` to
  match the file's existing logging pattern and add filename context.

Both call sites already had logging imported; no new imports added.
logging was used throughout the surrounding code in the same
logging.{info,warning,error}(...) style.
2026-08-08 15:53:16 +08:00
Yingfeng
4cc2dbc067 More stable sufficient check for agentic search (#17962) 2026-08-07 22:10:22 +08:00
Jack
4b4a6e72f0 fix(chunker): unify TokenChunker merge and strip coord tags in Python JSON path (#18002)
Unifies the Go TokenChunker merge path on a single `mergeUnits` core and
fixes coordinate-tag drift in the Python JSON merge at `overlap > 0`.
Rebased on top of #17979 (delimiter_mode convergence).
2026-08-07 21:55:07 +08:00
Wang Qi
ba7d65a4ec Fix medium thinking chat failed in thinking (#18008) 2026-08-07 21:39:24 +08:00
Zhichang Yu
f12c0ec08a feat(knowledge_compile): materialize wiki page graph (wiki_entity/wiki_relation) (#17976)
Re-materialize wiki page graph from merged wiki_page rows after each
batch merge. Adds ProjectWikiGraph/DropWikiGraph, full page_type/slug
identity, delete-then-insert, tests.
2026-08-07 17:47:59 +08:00
Jack
869da9c7ad test(token_chunker): drop unsupported chunk_token_size=0 case from delimiter-mode test (#17997) 2026-08-07 17:43:04 +08:00
alex-makang
8562623bef fix(rerank): set NvidiaRerank base_url for all models (#17988)
### What problem does this PR solve?

`NvidiaRerank.__init__` only assigned `self.base_url` inside two
model-specific
`if` branches:

```python
if self.model_name == "nvidia/nv-rerankqa-mistral-4b-v3":
    self.base_url = urljoin(base_url, "nv-rerankqa-mistral-4b-v3/reranking")
if self.model_name == "nvidia/rerank-qa-mistral-4b":
    self.base_url = urljoin(base_url, "reranking")
```

Any other NVIDIA rerank model therefore left the attribute unset, and
the first
`_compute_rank()` call died with `AttributeError: 'NvidiaRerank' object
has no
attribute 'base_url'`.

This is reachable in normal use: `conf/llm_factories.json` ships no
NVIDIA
rerank entries at all, so every NVIDIA rerank model has to be added by
hand,
and any name other than those two hardcoded strings crashes.

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

Co-authored-by: Alex Ma <alex_makang@hotmail.com>
2026-08-07 16:49:24 +08:00
Jack
1aa4e3c1f3 refactor(chunker): converge delimiter_mode to {delimiter, one}, drop token_size (#17979)
Converge `TokenChunker.delimiter_mode` from three values (`token_size`,
`delimiter`, `one`) to two (`delimiter`, `one`). The unified `delimiter`
mode now carries the old `token_size` semantics: when no active
(backtick) delimiter is present, text/JSON chunks are merged up to
`chunk_token_size`; when a backtick delimiter is present, the text is
split by it and not merged. `one` continues to be handled by the
separate `OneChunker`.
2026-08-07 16:11:42 +08:00
Wang Qi
993b41b7b1 Append attachments content to last message (#17993) 2026-08-07 16:04:19 +08:00
Kevin Hu
a25ff22aca Refactor: check the evidences while formalize answer. (#17951)
### Summary

Check the evidences while formalize answer.
2026-08-07 14:51:54 +08:00
Wang Qi
550283c356 Fix generate graph error (#17966) 2026-08-07 14:29:01 +08:00
buua436
48b2d3b914 fix: preserve page index chapter chunk provenance (#17963) 2026-08-07 13:47:04 +08:00
Yingfeng
1b8151a1f6 Refine agentic search (#17900) 2026-08-06 19:42:05 +08:00
Lynn
2e0b82be30 Fix: recognize data type in parse method table (#17946) 2026-08-06 19:37:57 +08:00
Wang Qi
23b20a098a Fix ragflow server hung after parsing a big file (#17936) 2026-08-06 17:01:53 +08:00
buua436
8379165c12 fix: record generated wiki page versions (#17931) 2026-08-06 16:49:50 +08:00
Zhichang Yu
2e37997ab9 Go knowledge compiler with scheduler-driven dataset compilation (#17913)
Ports dataset knowledge compilation (wiki/graph/tree/mindmap) to the Go
scheduler with a status contract, aligns wiki storage/retrieval with
Python, sizes prompts by content_length, and resolves embedding batch
size from provider capability.
2026-08-06 15:54:00 +08:00
buua436
97f9ae5896 refa: unify wiki example naming (#17910) 2026-08-06 13:24:27 +08:00
Wang Qi
e35956bcc4 Fix attachments not take effect in agentic chat (#17895) 2026-08-06 11:12:22 +08:00
buua436
d16b2556a2 fix: split wiki template instruction and example (#17891) 2026-08-06 09:41:57 +08:00
Jin Hai
cf13082a1a Revert "feat: Go knowledge compiler with scheduler-driven dataset compilation" (#17897)
Reverts infiniflow/ragflow#17881
2026-08-05 21:50:28 +08:00
Zhichang Yu
14b943a04a feat: Go knowledge compiler with scheduler-driven dataset compilation (#17881)
Ports the dataset knowledge compilation (wiki/graph/tree/mindmap) to the
Go scheduler with a status contract, aligns wiki storage/retrieval with
Python, and sizes prompts by content_length.
2026-08-05 20:00:42 +08:00
Kevin Hu
d2183e610d Fix: Adjust ExecutionStrategy of THINKING_MODES. (#17862)
### Summary

Adjust ExecutionStrategy of THINKING_MODES.
2026-08-05 19:41:00 +08:00
buua436
502921159a fix: use updated RAPTOR options for skill generation (#17859) 2026-08-05 19:27:17 +08:00
taek105
b7966c98f2 fix: honor dataset language across VisionFigureParser paths (#17227) 2026-08-05 18:40:10 +08:00
buua436
cd6e73bcb5 fix: stream agentic reasoning and answers correctly (#17849) 2026-08-05 15:59:19 +08:00
Kevin Hu
510e1197c6 Fix: graph explore bug. (#17829)
### Summary

Fix: graph explore bug.
2026-08-05 14:00:45 +08:00
Jack
9b05e5c67e Fix: delimiter is chunk boundary, drop token_size atom-split (OVER_CAP default) (#17808)
## Summary

Fixes a regression introduced by #17203 (strict-cap atom-split) and a
secondary delimiter-handling bug from #17723.

**Root cause:**
- #17203 added `_split_oversized_unit` / `_compute_chunk_update`, which
split oversize units into ≤ token_size pieces. This collapsed
`token_size=1` into 1-token chunks and set the cap at 512, mismatching
the model-layer truncation boundary (embedding ~8191 / rerank
500/4096/8192/2048). Atom-split is unnecessary: oversize units stay
whole and the model layer truncates.
- #17723's delimiter handling dropped consecutive delimiters (`A####B`
-> `A##B`), glued JSON items with `"".join`, ignored
`children_delimiters`, and stripped whitespace delimiters.

## Changes

- New pure helper `merge_paragraphs(paragraphs, token_size, strategy)`
with a `MergeStrategy` enum (`UNDER_CAP` / `OVER_CAP`); **default
`OVER_CAP`**. `UNDER_CAP` is a strict cap (never overflows
`token_size`); `OVER_CAP` greedily accumulates adjacent paragraphs while
the projected total stays within `token_size`, merging one
boundary-overflow paragraph before closing. Oversize paragraphs stand
alone.
- `naive_merge` / `naive_merge_with_images` /
`RAGFlowTxtParser.parser_txt` now use `merge_paragraphs`; atom-split
removed. `naive_merge` / `naive_merge_with_images` always split a
section on the delimiter whenever one is present (even when the section
already fits `token_size`), so delimiter text never leaks into a chunk.
Only the empty-delimiter (size-only) mode skips splitting.
- `token_chunker`: delimiter text is dropped (not stripped); JSON flush
joins buffered items with `"\n"`; `children_delimiters` and
`PDF_POSITIONS_KEY` are preserved on the delimiter path. PDF positions
are now attributed **per segment** — each split chunk carries only the
positions of the item(s) that contributed to it — fixing a leak where
page-N coordinates were attached to page-M chunks and all segments
shared one preview image.
- `test_txt_parser.py` rewritten to assert the new contract (not the old
strict cap); `naive_merge` and delimiter-case-sensitive matrices
updated.

## Contract (refs #17799)

- user specified delimiter = chunk boundary; user specified delimiter
text never enters a chunk.
- `token_size` = soft target + merge strategy; no atom-split.
- Default strategy = `OVER_CAP`; migration can switch to `UNDER_CAP`
(strict cap).
- `OVER_CAP` has no hard cap; the model layer truncates oversize units.
`UNDER_CAP` enforces a strict cap.

## Notes

- Closes the wrong-object revert in #17774 (revert #17723 would
re-introduce delimiter-in-chunk and the strict cap).
- Go-side alignment (`internal/ingestion/component/chunker/token.go`) is
a follow-up PR.

---------

Co-authored-by: CodeBuddy <noreply@tencent.com>
2026-08-05 11:50:07 +08:00
EthanZhang
bdcd8aadde feat(chat): add Querit web search provider (#17813) 2026-08-05 09:54:46 +08:00
rayhan
166758cb0f fix: migrate mistralai to 2.x and remediate CVE-2025-67221 (orjson) (#17810)
## Summary
  
Migrates `mistralai` from `==0.4.2` to `>=2.7.2,<3.0.0` to unblock the
orjson CVE fix. The old SDK pinned `orjson>=3.9.10,<3.11`, preventing
upgrade to the patched version.
  
  | CVE | Severity | Package | Installed | Fixed in |
  |---|---|---|---|---|
  | CVE-2025-67221 | HIGH | orjson | 3.10.18 | 3.11.6 |

`mistralai` 2.x (the current maintained version) drops the orjson
dependency entirely. Added `orjson>=3.11.6` to `constraint-dependencies`
to pin the floor for remaining parent packages (`langgraph-sdk`,
`langsmith`, `ranx`).
2026-08-05 09:52:30 +08:00
Kevin Hu
fac40e5103 Refactor: Make wiki and web searchable. (#17789)
### Summary

Refine wiki and web searchable.

Closes #17638
2026-08-04 18:02:13 +08:00
buua436
0f04f4c3b9 fix: separate raptor node target from output limit (#17792) 2026-08-04 15:14:04 +08:00
deadtrickster
197b142cef feat(serenedb): add SereneDB doc-store engine (Go + Python connectors) (#17375)
## What

Adds [**SereneDB**](https://serenedb.com) as a selectable doc-store
engine on **both** RAGFlow paths:
- the **Go** `DocEngine` (`internal/engine/serenedb`), alongside
Elasticsearch and Infinity;
- the **Python** `DocStoreConnection` (`rag/utils/serenedb_conn.py`) +
`DOC_ENGINE=serenedb` registration.

SereneDB is a PostgreSQL-wire engine (DuckDB execution) whose single
inverted index carries **both** a scored text column (`@@`, BM25) and an
IVF vector column (`<#>`, inner product), so hybrid search is one SQL
statement. The Go engine connects with `database/sql` + `lib/pq`
(already a dependency, no new module); the Python connector uses
psycopg2 (already a dependency).

## Storage model

One table per tenant with `kb_id` as a filter column - the
**Elasticsearch / OceanBase** model, not Infinity's per-dataset tables.
This keeps BM25 statistics (IDF, avgdl) computed over the whole tenant
corpus (global IDF). Both connectors use this identical layout, so they
are storage- and retrieval-compatible: `hybrid` proxy routing and
Python↔Go switching are safe. On the Python side the connector is wired
as OceanBase's plain-SQL sibling (chunk_data JSON metadata, inline chunk
vectors, verbatim ES field names); the ES tokenizer path is unchanged.
Metadata stays one table per tenant (`ragflow_doc_meta_<tenant>`).

The query shapes mirror the Python connector, including the five
empirically-found landmines: the scored dictionary needs `frequency +
norm` (else `BM25()` silently returns 0.0), the `@@` query is the
tokenized query, the scored lexical branch matches one column, vectors
use an L2-normalized shadow column with `ip`/`sq8`, and the similarity
threshold goes directly in the ANN scan's `WHERE`. **Minimum engine
version: SereneDB 26.07.4.**

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-04 14:16:39 +08:00
buua436
3e11914144 fix: normalize legacy parser configuration (#17761) 2026-08-04 13:49:44 +08:00
buua436
bccbd7492c fix: preserve raptor tree titles (#17772) 2026-08-04 13:24:36 +08:00