Commit Graph
70 Commits
Author SHA1 Message Date
Harsh Kashyap af61e3fcd6 fix(api): validate embedding check sample count (#19574)
Fix #19567 — validate check_num before sampler use. Non-integer/zero/negative values now return clear argument errors.
2026-09-14 13:53:11 +08:00
Yingfeng 1f5d33333a Add claim/evidence to tree/pageindex compilation pipeline (#19267) 2026-09-11 22:37:33 +08:00
Harsh Kashyap 19ec6245c4 fix(api): authorize task cancellation by dataset access (#19359) 2026-09-11 09:53:09 +08:00
euvre 3931c69a5b fix(api): return "search not found" instead of IndexError when updating a missing search (#19380) 2026-09-09 10:02:06 +08:00
buua436 7b01906d45 fix: filter structure alteration by document products (#19346) 2026-09-08 13:23:28 +08:00
MarMar Labs 6c280f10a0 fix(api): accept repeated memory_type and tenant_id filters when listing memories (#19281)
Fix GET /api/v1/memories list filters — memory_type, tenant_id, owner_ids, ids now read all repeated query keys (was only first). Matches /datasets//documents pattern.
2026-09-08 11:48:16 +08:00
Manan Bansal 03d861a926 fix(api): allow setting language on dataset creation (#15703) (#16242)
Fix #15703 — dataset create endpoint now accepts language.
2026-09-08 10:53:40 +08:00
MarMar Labs fa52804fa3 fix(api): return the full error tuple when both id and ids are given to list documents (#19280)
Fix dataset document list endpoint unpack error when both id and ids provided — helper returned 2 values but caller expects 4. Now returns 4.
2026-09-07 10:58:05 +08:00
buua436 f4bafa1596 fix: exclude empty documents from structure alteration (#19246) 2026-09-04 17:06:38 +08:00
Lynn 2f8dab2199 Fix: upload image to model in chat (#19257) 2026-09-04 16:37:25 +08:00
Sbaaoui Idriss f8fc130162 fix(searchbots): enforce KB authorization before retrieval (#19165) 2026-09-03 11:10:57 +08:00
Yingfeng a11c27e01d Adjust navigation tools for agentic search (#19172) 2026-09-03 10:43:00 +08:00
Wang Qi 6ec9c6a737 Fix: get rid of graphrag raptor in parser_config in REST API (#19161) 2026-09-03 09:40:52 +08:00
buua436 cf441d4c72 fix: align wiki alteration provenance (#19140) 2026-09-02 18:03:15 +08:00
MarMar Labs 5e1898e293 fix(dify): search the dataset owner's index, not the caller's (#18987)
Fix team-member Dify retrieval searching wrong tenant index. Changed tenant_id to kb.tenant_id in both retrieval_by_children and kg_retriever.
2026-08-31 17:11:40 +08:00
b149a392f4 fix(api): return parsing-status counts at the top level of each dataset (#17595) (#17611)
Fix #17595 — parsing status counts now return as top-level fields per documentation, not nested under parsing_status.

Signed-off-by: Anai-Guo <antai12232931@anaiguo.com>
Signed-off-by: Anai-Guo <antai12232931@outlook.com>
Co-authored-by: Anai-Guo <antai12232931@anaiguo.com>
Co-authored-by: Jin Hai <haijin.chn@gmail.com>
2026-08-31 13:52:08 +08:00
Lynn b224f338fa Fix: rm default model in create and display builtin model (#18875) 2026-08-27 19:00:05 +08:00
Souravrajvi0 004b3c4845 fix(web): surface dataset navigation tree load failures (closes #17301) (#17668)
Fix Artifacts Tree tab to show error message on navigation API failure instead of misleading "No navigation nodes". Added error handling in frontend, i18n strings, and backend unit tests. 6 tests pass.
2026-08-26 10:42:18 +08:00
Wang Qi 92c69db79e Refactor: expose knn top_k and knn num_candidaties (#18737)
Follow on #18300
2026-08-25 17:16:36 +08:00
Mpider-San aa57022bfd Fix: cross-KB document id collision in data source sync (#18116) (#18244)
### What problem does this PR solve?

Closes #18116.

Fix cross-KB document ID collision (#18116). Older ID derivation excluded kb_id, causing two KBs to fight over one row. Unified derivation to be KB-scoped, with fallback for existing rows. Stranded rows are reclaimed, dataset deletion now cleans up state, and upgraded instances update in place. Tests added.
2026-08-25 15:15:46 +08:00
Ali Farhan 03d2835731 fix(api): make the API-key subject carve-out on POST /messages reachable (#18026)
### Summary

Fix add_message so API-key callers can pass user_id (previously ignored because Python checked a Go-only flag). Now uses g.auth_type == AUTH_API. JWT/session callers stay bound to the authenticated principal. Tests added; backward compatible.
2026-08-25 12:06:51 +08:00
Lynn b8b35aa9ab Fix: kimi k3 temperature (#18564) 2026-08-21 10:11:06 +08:00
Ali Farhan ece9638f94 fix(api): report why provider model discovery failed instead of swallowing it (#18027)
### Summary

Providers whose static catalogue is empty discover their models by
calling the base URL the user typed. `verify_api_key` wrapped that call
in a bare `except Exception: pass` and then returned a flat `No models
found for provider 'X'`, so an unreachable host, a closed port, a wrong
scheme and a bad TLS setup all produced the same sentence, with the
actual error discarded and not even logged.
2026-08-19 18:24:10 +08:00
zws202606 d02723ca76 feat: Gaussdb adaptation (#17703) 2026-08-18 09:53:11 +08:00
buua436 024c35f085 fix: track wiki chunk changes incrementally (#18285) 2026-08-14 20:11:55 +08:00
buua436 15a63bc15c fix: exclude disabled documents from wiki compilation (#18261) 2026-08-14 13:45:14 +08:00
buua436 c10371d945 fix: refine structure graph keyword search (#18181) 2026-08-13 17:49:20 +08:00
qinling0210 a6dcc0f665 Add dataset navigation search for agentic RAG (#18218)
### Summary

Add dataset navigation search for agentic RAG.

dataset_navigation_search() calls
dataset_api_service.search_dataset_layers with mode as "nav_doc"
2026-08-13 17:35:24 +08:00
buua436 649b631cac fix: improve incremental wiki compilation (#18164) 2026-08-12 19:12:39 +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
a690078a24 test: extend /dify/retrieval unit test coverage (#17957)
## Summary
- Extends unit test coverage for
pi/apps/restful_apis/dify_retrieval_api.py (the Dify external knowledge
base endpoint).

Co-authored-by: zjm11902 <zjm11902@users.noreply.github.com>
Co-authored-by: Jin Hai <haijin.chn@gmail.com>
2026-08-10 15:30:52 +08:00
Lynn 02923bfc46 Fix: display embedding model name in list dataset api response (#17832) 2026-08-05 14:51:07 +08:00
Wang Qi f707cca074 Fix: Let delete dataset/document to a dedicated thread to avoid blocking othe APIs (#17800) 2026-08-04 19:04:16 +08:00
Lynn 11b2dfcfdd Fix: handle llm_setting switch (#17745) 2026-08-04 10:02:14 +08:00
Jin Hai 86021932ae Go: fix warnings (#17738)
Signed-off-by: Jin Hai <haijin.chn@gmail.com>
2026-08-03 21:30:01 +08:00
Wang Qi 0969c04eca Feature: GET /datasets to support ids array (#17606) 2026-07-31 13:23:02 +08:00
euvre f45f03a016 Add Go service/handler tests for API contract parity (#16905) 2026-07-20 20:02:41 +08:00
Harsh KashyapandHarsh23Kashyap cafbbd467d fix(api): honor include_parsing_status in List Datasets endpoint (#16913)
Fixes #16855.

## Problem

`ListDatasetReq` declares `include_parsing_status: bool = False` but
`dataset_api_service.list_datasets` ignored the flag, so callers passing
`include_parsing_status=true` got `null` for every parsing-status field.
The helper that produces the counts
(`DocumentService.get_parsing_status_by_kb_ids`) already existed and
returned the documented shape; it just wasn't being called.

## Fix

Read the flag in `list_datasets`, call the helper only when truthy, and
attach per-kb counts to each record before serialisation. The flag
follows the same string-coercion idiom already used for `desc` in this
function.

When the flag is false or absent, no new field is added to the response,
so the change is non-breaking and additive. Existing callers see
byte-identical responses.

## Tests

New file
`test/unit_test/api/apps/services/test_dataset_api_service_list_datasets.py`
(7 tests, all passing):

-
`test_list_datasets_without_include_parsing_status_does_not_call_helper`
- `test_list_datasets_with_include_parsing_status_true_attaches_counts`
- `test_list_datasets_with_include_parsing_status_string_true`
- `test_list_datasets_with_include_parsing_status_false_skips_helper`
-
`test_list_datasets_with_include_parsing_status_string_false_skips_helper`
-
`test_list_datasets_with_empty_kb_list_skips_helper_even_when_flag_true`
-
`test_list_datasets_with_include_parsing_status_missing_kb_gets_empty_dict`

```
$ uv run pytest test/unit_test/api/apps/services/test_dataset_api_service_list_datasets.py -v
============================== 7 passed in 0.19s ==============================
```

## Files changed

- `api/apps/services/dataset_api_service.py` (+15)
-
`test/unit_test/api/apps/services/test_dataset_api_service_list_datasets.py`
(new)

## Follow-up (out of scope)

Register the `parsing_status` field in the OpenAPI response schema at
`api/apps/restful_apis/dataset_api.py` so Swagger / generated clients
document it.

Co-authored-by: Harsh23Kashyap <harsh@example.com>
2026-07-18 20:50:00 +08:00
bd7a3bb878 Fix: align go provider apis with python apis (#16867)
### Summary

As title.

---------

Co-authored-by: Jin Hai <haijin.chn@gmail.com>
Co-authored-by: Wang Qi <wangq8@outlook.com>
2026-07-14 21:06:11 +08:00
Wang Qi 3087eb854c Fix Agent bot 2 permission bugs (#818) (#16909) 2026-07-14 20:11:16 +08:00
euvre 3bfad1f00e fix: correct model type mappings and improve system setting persistence (#16501) 2026-07-13 16:42:55 +08:00
buua436 74bbbba3e0 fix: align model default handling (#16782) 2026-07-10 10:34:19 +08:00
buua436 6a77523bf0 refa: resolve tenant model refs consistently (#16744) 2026-07-09 14:02:08 +08:00
qinling0210 ae96e636e9 Handle searching dataset without embedding model (#16742)
### Summary

Handle searching dataset without embedding model

In this PR, Searching datasets with different embedding models or
searching dataset with/without embedding models are not allowed. We will
improve the behavior later.
2026-07-09 11:38:55 +08:00
Lynn 0ae5961e1c Feat: v0.27.0 model provider (#16604) 2026-07-08 09:47:29 +08:00
S f477d3329d Fix: ValueError: too many values to unpack in list_tenant_added_models for model IDs containing '@' (#16467) (#16468) 2026-07-07 09:40:27 +08:00
7da4f200e5 fix(agent): enable MCP file preview via doc_id (#15399)
## Summary
MCP-wrapped agents could only force-download files looked up by
`doc_id`. This adds an explicit preview path and inline response headers
for previewable file types.

- **New** `GET /api/v1/agents/attachments/{attachment_id}/preview` —
inline preview for PDFs, images, and other safe types (pass `ext` and/or
`mime_type`)
- **Improved** `GET /api/v1/documents/{doc_id}/preview` — sets inline
disposition using the document filename
- **Improved** attachment download routing — resolves `mime_type` /
`ext` query params (no default `markdown`), supports
`disposition=inline`
- **DocGenerator output** — includes URL-encoded `preview_url` for MCP
clients
- **Legacy `/document/download/...` aliases** — still use download
semantics; MCP clients should call `/preview` explicitly

Fixes #15398

## Test plan
- [x] `pytest test/unit_test/api/utils/test_file_response_headers.py`
(6/6)

---------

Co-authored-by: MkDev11 <mkdev11@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Ling Qin <qinling0210@163.com>
2026-07-03 19:56:01 +08:00
Wang Qi 6a4b9be426 Refactor: reformat all code for lefthook using ruff and gofmt (#16585) 2026-07-03 12:53:39 +08:00
jony376andZhichang Yu 8fb692f10a fix(agent): enforce document access on POST /api/v1/agents/rerun (#15145)
## Related issues

Closes #15144

### What problem does this PR solve?

`POST /api/v1/agents/rerun` loaded a pipeline operation log by UUID via
`PipelineOperationLogService.get_documents_info` with no authorization,
then wiped chunks, reset document counters, deleted tasks, and re-queued
dataflow for the victim document.

Any authenticated user who knew a victim's pipeline log id could disrupt
parsing on documents they did not own.

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
- [ ] New Feature (non-breaking change which adds functionality)
- [ ] Documentation Update
- [ ] Refactoring
- [ ] Performance Improvement
- [ ] Other (please describe):

### Changes

| File | Change |
|------|--------|
| `api/apps/restful_apis/agent_api.py` | Call
`DocumentService.accessible(doc["id"], tenant_id)` before destructive
rerun operations; deny with generic `"Document not found."` |
|
`test/unit_test/api/apps/restful_apis/test_rerun_agent_authorization.py`
| Unit tests: cross-tenant log rejected, missing/unauthorized same
message, authorized rerun proceeds |

### Security notes

- **CWE-639:** Closes cross-tenant pipeline rerun / chunk wipe via
leaked log UUID.
- `tenant_id` from `@add_tenant_id_to_kwargs` is `current_user.id`;
`DocumentService.accessible` covers team-shared KBs.

### Test plan

- [ ] `pytest
test/unit_test/api/apps/restful_apis/test_rerun_agent_authorization.py`
- [ ] Manual: attacker cannot rerun victim pipeline log id

```bash
cd ragflow
uv run pytest test/unit_test/api/apps/restful_apis/test_rerun_agent_authorization.py -q
```

---------

Co-authored-by: Zhichang Yu <yuzhichang@gmail.com>
2026-06-29 09:45:17 +08:00
f0f10b6092 Fix: UserFillUp interactive forms not working in agent explore mode (#14589)
## Summary

- **Backend**: `_iter_session_completion_events` in `agent_api.py` was
filtering out `user_inputs` and `workflow_finished` SSE events, causing
agents with UserFillUp components to silently fail in explore mode — the
interactive form never appeared, while the same agent worked correctly
in run (editor) mode.
- **Frontend**: `SessionChat` component in explore mode was missing
`DebugContent` children rendering inside `MessageItem`, so even if the
backend forwarded the events, the form UI would not render. Added
`DebugContent`, `MarkdownContent`, `useAwaitCompentData` hook, and
input-disabling logic to match the run mode's `chat/box.tsx` behavior.

## What was changed

### Backend (`api/apps/restful_apis/agent_api.py`)
- Line 266: Added `"user_inputs"` and `"workflow_finished"` to the
allowed event filter in `_iter_session_completion_events`

### Frontend (`web/src/pages/agent/explore/components/session-chat.tsx`)
- Added imports: `DebugContent`, `MarkdownContent`,
`useAwaitCompentData`, `useParams`
- Added `sendFormMessage` from `useSendSessionMessage()` hook
- Added `useAwaitCompentData` hook for form state management
- Added `DebugContent` as `MessageItem` children for the latest
assistant message (renders UserFillUp form)
- Added `MarkdownContent` + submitted values display for previous
assistant messages
- Updated `NextMessageInput` disabled states to respect `isWaitting`
(form submission in progress)

## Test plan

- [x] Agent with UserFillUp component (e.g., email draft with
send/edit/cancel options) shows interactive form in **explore mode**
- [x] Same agent continues to work correctly in **run (editor) mode**
- [x] Form submission sends data back to the agent and workflow
continues
- [x] Input field is disabled while waiting for form submission
- [ ] Agents without UserFillUp components are unaffected in explore
mode

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Zhichang Yu <yuzhichang@gmail.com>
2026-06-29 09:45:17 +08:00