Commit Graph

7750 Commits

Author SHA1 Message Date
Yingfeng
9460e6ba03 Fix parsing log display of infinity (#17479) 2026-07-28 23:04:56 +08:00
Abhay Yadav
e91da6b214 fix(go): implement Anthropic streaming (ChatStreamlyWithSender) (#17380)
### Summary

The Go Anthropic driver's `ChatStreamlyWithSender`
(internal/entity/models/anthropic.go) was a stub that always returned
`"no such method"`, so any caller requesting a streamed response from a
Claude model via the Go path failed outright — diverging from the Python
`AnthropicCV` driver, which already supports streaming.

This implements the method by opening the Messages API with
`stream=true` and parsing the SSE response via the shared
`ParseSSEStream` helper, forwarding `text_delta`/`thinking_delta`
content through the `sender` callback and treating `message_stop` as the
terminal event — consistent with the other Go drivers in this package
(e.g. Cohere).

Fixes #17333

---------

Co-authored-by: Abhay Yadav <abhayyadav@Abhays-MacBook-Air.local>
2026-07-28 21:10:28 +08:00
jay77721
b02df503ac Refactor(go-models)/llm token usage for longcat (#17480)
### Summary

Add token usage reporting for the LongCat (Meituan) model provider.
Related
  to #17284.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-28 21:08:51 +08:00
euvre
996c5156e5 Fix: go back to previous page when last card on the last page is deleted (#17409) 2026-07-28 19:30:28 +08:00
euvre
679bce8f8d fix: reset selected documents on new search in search page (#17454) 2026-07-28 19:29:51 +08:00
yiming wang
dcadd8d837 feat: add Tenki sandbox provider (#17305)
### Summary

Adds a `tenki` sandbox provider that runs each agent code execution in a
disposable Tenki (https://tenki.cloud) microVM (create → exec → destroy,
no volumes or snapshots).
Registration mirrors PR #15039, configure `api_key` and `project_id` in
Admin > Sandbox Settings.

Both runtimes are covered:
- Python: `agent/sandbox/providers/tenki.py` (structured results +
artifact collection).
- Go: `internal/agent/sandbox/tenki.go`, mirroring the e2b provider and
wired into the provider manager.

`tenki-sandbox` is an optional dependency (it requires `protobuf>=6.31`,
which differs from RAGFlow's pinned gRPC stack), lazily imported with a
clear error when missing; installation is documented in the sandbox
quickstart.

Unit tests cover execution, structured results, artifacts
(symlink/size/extension limits), non-zero exit, timeout, error mapping,
and idempotent destroy.

---------

Co-authored-by: yiming.wang <yiming.wang@luxor.com>
2026-07-28 19:24:39 +08:00
euvre
73860170ae fix(admin): use POST for admin logout API (#17482) 2026-07-28 19:22:57 +08:00
Jack
76aaecc284 fix(ingestion): improve Extractor/LLM robustness and Python->Go parity (#17470)
## Summary

This PR hardens the Go ingestion **Extractor** and **LLM retry** paths
and closes several Python->Go parity gaps in the keyword/question/tag
extraction flow.

- **Generic retry utility** (`internal/common/retry.go`):
`RetryWithBackoff` with exponential backoff (default 3 retries, 2s
initial delay, capped at 1m), context-aware sleep, and a `maxRetries<=0`
fast path. Covered by `internal/common/retry_test.go`.
- **LLM retry reuse**: `agent/component/llm_retry.go` now delegates to
`common.RetryWithBackoff` instead of an inline loop (behavior preserved:
ctx cancellation short-circuits the backoff).
- **Extractor LLM calls** (`extractor.go`):
- `call()` now retries transient LLM failures via `RetryWithBackoff`
(retry exhaustion fails the chunk instead of silently skipping).
  - Sets `temperature = 0.2`, matching Python `generator.py:230,245`.
- Runs keyword and question extraction **concurrently** per chunk when
both are enabled (`task_executor.py:444-448`), with mutex-guarded map
writes to avoid data races.
- Substitutes `{field_name}` placeholders (including `{chunks}` -> chunk
text) in `prompt`/`system_prompt` before the call, mirroring Python
`string_format` (`extractor.py:102-103`); unmatched placeholders are
left as-is.
- Falls back to the **tenant default chat model** when `llm_id` is empty
(`task_executor.py:573-574`).
- Strips `` **greedily** (`strings.LastIndex`) in
`cleanExtractionResult`.
- **Auto-tagging** (`extractor_tag.go`): drops the `in.llmID != ""`
guards so an empty `llm_id` no longer skips tagging (uses the tenant
default model), and strips `` greedily in `parseTaggerResponse`.
- **Docs**: fixes a misleading `PresentationChunker` docstring that
claimed per-slide `image`/`position` output (the PPTX path emits none —
unlike PDF), and removes a stale `docs/migration_python_go_diff.md`
reference in `media_dispatch.go`.

## Test plan

- `bash build.sh --test ./internal/common/...` — passes (new retry
utility + tests).
- `bash build.sh --test ./internal/ingestion/component/...` — passes
(extractor/chunker/schema).
- `gofmt` and lefthook pre-commit checks pass.

Note: the personal `docs/migration_python_go_diff.md` working notebook
in the tree is intentionally **not** part of this PR.

---------

Co-authored-by: CodeBuddy <noreply@codebuddy.ai>
2026-07-28 19:22:18 +08:00
Robert Keus
7e1ab9741b feat: add GreenPT model provider (#17447)
## Summary

GreenPT is a European AI provider with an OpenAI-compatible API,
optimized infrastructure, and datacenters powered by 100% renewable
energy.

This adds native GreenPT support across RAGFlow’s Go-first provider
system and its Python compatibility layer:

- discovers the current catalog from `GET /v1/models`
- features `glm-5.2` and `kimi-k2.7-code` for chat and coding
- supports `green-embedding` through `/v1/embeddings`
- supports `green-rerank` through `/v1/rerank`
- supports `green-s` and `green-s-pro` speech-to-text through
`/v1/listen`
- adds provider configuration, UI icon, and supported-provider
documentation
2026-07-28 19:19:00 +08:00
Hz_
55a5254045 fix(go-agent): return configured retrieval empty responses (#17484)
## Summary

- Return the configured `empty_response` when retrieval has no query or
no chunks.
- Preserve `formalized_content` for downstream Message nodes.

## Testing

- `bash build.sh --go`
- `ok    ragflow/internal/agent/tool`
- `ok    ragflow/internal/agent/component`
2026-07-28 19:17:33 +08:00
rayhan
823e3dd871 fix: remediate CVE's by upgrading pdfplumber to 0.11.10 (#17489)
## Summary
  
Remediates two HIGH severity CVEs in `pdfminer.six` by upgrading its
parent dependency `pdfplumber` from `==0.10.4` to `==0.11.10` in
`pyproject.toml`.
  
  | CVE | Severity | Package | Installed | Fixed in |
  |---|---|---|---|---|
  | CVE-2025-64512 | HIGH | pdfminer.six | 20221105 | 20251107 |
  | CVE-2025-70559 | HIGH | pdfminer.six | 20221105 | 20251230 |

`pdfminer.six` is a transitive dependency exact-pinned by `pdfplumber`.
Version 0.10.4 pins `pdfminer.six==20221105` (vulnerable); version
0.11.10 pins `pdfminer.six==20260107` (patched).
2026-07-28 19:17:17 +08:00
Haruko386
e0ad4f8339 Go: implement embed, rerank for PPIO provider (#17486)
### Summary

As title #17284

#### verified from CLI
```
RAGFlow(api/default)> embed text 'walkerwhat' 'jumperwho' with 'qwen/qwen3-embedding-0.6b@test@ppio' dimension 16
+-----------+-------+
| dimension | index |
+-----------+-------+
| 1024      | 0     |
| 1024      | 1     |
+-----------+-------+

RAGFlow(api/default)> rerank query 'what is rag' document 'rag is retrieval augment generation' 'rag need llm' 'famous rag project includes ragflow' with 'baai/bge-reranker-v2-m3@test@ppio' top 3
+-------+-----------------+
| index | relevance_score |
+-------+-----------------+
| 0     | 0.9830034       |
| 2     | 0.06399203      |
| 1     | 0.04665664      |
+-------+-----------------+
```
2026-07-28 19:16:31 +08:00
Haruko386
e5c038a411 Go: add token usage for orcarouter, baichuan, cohere and novita (#17455)
As title #17284
2026-07-28 19:14:05 +08:00
balibabu
5274e1df4d Fix: The documentation for setting page slicing methods in the Go version of a dataset is not displayed. (#17478) 2026-07-28 19:14:02 +08:00
Haruko386
4885dda32a fix: failed to set right status in memory (#17472)
As title

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2026-07-28 19:13:22 +08:00
Jin Hai
7f21a7ba18 Go: add context, part14 (#17446)
Signed-off-by: Jin Hai <haijin.chn@gmail.com>
2026-07-28 19:05:59 +08:00
Wang Qi
b4170d0dfd Dev/enhance dev script (#17487) 2026-07-28 17:47:45 +08:00
Wang Qi
795bd7c00f Fix: expose the real error when ingest error (#17485) 2026-07-28 17:32:32 +08:00
buua436
b7ddf45774 fix: stabilize wiki planning and artifact graph rendering (#17473) 2026-07-28 17:08:40 +08:00
Yash Raj Pandey
730de9cc7f Fix tag CSV parser splicing wrong text after a multi-line quoted field (#17131) 2026-07-28 17:04:11 +08:00
Yash Raj Pandey
b08e5f5647 Fix: RAGFlowJsonParser crashes with IndexError on top-level JSON scalars (#16877) 2026-07-28 16:58:42 +08:00
Wang Qi
b8bb2297f9 Fix Markdown parser, the table should be inside chunk (#17477) 2026-07-28 16:00:52 +08:00
Lynn
675c35a2de Fix: rm tenant llm call (#17476) 2026-07-28 15:54:44 +08:00
balibabu
fe38d5f246 Feat: Delete dataset level graph. (#17474)
### Summary

Feat: Delete dataset level graph.
2026-07-28 15:27:08 +08:00
qinling0210
ad2102c1a8 fix(infinity): parent_kwd incorrectly split as keyword list causing orphaned clusters (#17475)
…rphaned clusters

### Summary

**Problem**
When deleting a document from the knowledge base, the parent cluster
could never be located and was therefore never cleaned up, leaving
orphaned clusters in Infinity indefinitely.

**Root Cause**
InfinityConnection.field_keyword() treats all _kwd-suffixed columns as
keyword lists and applies .split("###") to them in get_fields().
parent_kwd was missing from the exclusion list. This caused a parent
cluster name like "Toronto Transit & Authority Control 5e8d5eb6" to
become ['Toronto Transit & Authority Control 5e8d5eb6'] (a
single-element list). When that list was fed into _nav_cluster_id(), it
produced a different hash than the actual cluster's hash (computed from
the plain string), so every deletion-time cluster lookup silently
failed.

**Fix**
Added "parent_kwd" to the exclusion list in field_keyword(), alongside
docnm_kwd, important_kwd, question_kwd, etc.
2026-07-28 15:26:40 +08:00
Hz_
19b60132da fix(go-agent): use session IDs for cancellation and context flow (#17462)
## Summary

- Propagate request contexts through Agent Canvas execution and external
calls.
- Replace internal task IDs with session IDs while retaining `task_id`
as a wire alias.
- Complete session-scoped cancellation with Redis lease and token
validation.

## Testing

- Go backend tests passed.

<img width="1176" height="574" alt="image"
src="https://github.com/user-attachments/assets/b86560be-9b8d-45bb-97e9-921dffab8ebe"
/>
2026-07-28 14:59:34 +08:00
balibabu
cc0fbd37ef Fix: Unable to navigate from the agent list page to the compilation editing page. (#17460) 2026-07-28 13:59:57 +08:00
Wang Qi
0fdefb284e Sandbox: bump rate limit from 5/second to 60/second (#928) (#17469) 2026-07-28 13:53:56 +08:00
Jack
9b0719fa94 fix: Go ingestion migration batch 5 (Parser 1.1/1.7/2.11, Chunker 1.7/1.8/2.6/2.7, Tokenizer 6x fixes) (#17419)
## Summary

Continuation of the Python→Go ingestion pipeline migration (File →
Parser → Chunker → Extractor → Tokenizer). Fixes cover Parser, Chunker,
and Tokenizer gaps identified. Fix page number (0-indexed and 1-index
mixed before fix; use 1-indexed after fix) and chunk order issues.

### Parser
- **Slides TCADP (1.7):** `pptx_tcadp.go` + TCADP branch in
`pptx_parser.go`/`ppt_parser.go` — PowerPoint files now support
`parse_method="tcadp"` via the TCADP cloud service, matching the
spreadsheet-family TCADP pattern. PPT containers pass `"PPT"` as
fileType (not hardcoded `"PPTX"`).
- **Audio default output_format (2.11):** `defaultSetups()` audio
default changed from `"text"` to `"json"`, aligning with Python
`parser.py:232` and `AllowedOutputFormat["audio"]={"json"}`.
- **PDF VLM enhancement (1.1):** `maybeDispatchPDFVisionEnhancement` in
`pdf_vision_dispatch.go` enriches image/table items with IMAGE2TEXT
model descriptions after PDF parsing, mirroring Python
`enhance_media_sections_with_vision`. Semaphore fix: acquire before
goroutine start to prevent unbounded goroutine creation.
- **json family (2.3):** reclassified as Keep Go — `json_parser.go` is a
functional enhancement, not a parity gap.
- **page number:** changed from "mixed use of 1-indexed & 0-indexed" to
"1-indexed"

### Chunker
- **BULLET_PATTERN fallback (1.7):** 4th-level fallback in
`resolveTitleLevels` (`title.go`) detects bullet/numbered-list patterns
(Chinese legal, numbering, English) when outline + regex levels produce
only bodyLevel. Guarded by `allBodyLevel` to never override existing
structure.
- **Tag/One chunker fields (1.8):** `tag.go` sets `TopInt` from source
row index; `one.go` preserves `Positions`/`PDFPositions` from source
items. TSV multi-line RowNum fix: tracks `contentStart` for correct row
attribution.
- **Overlapped_percent normalization (2.6):**
`NormalizeOverlappedPercent` in `schema/chunker.go` mirrors Python
`common/float_utils.py:50-58` — accepts `[0,1)` fraction or `[0,90]`
percent, normalizes to canonical `[0,90]`.
- **Paragraph splitting (2.7):** aligned to Python flow `naive_merge` —
`CRLF` normalization, `splitKeepingDelimiter` preserves sentence
delimiters, single-section merge with token-budget-governed chunking.
- **chunk order:** sort by reading order

### Tokenizer
- **Phantom chunk filtering (Omission 2):** `isPhantomChunk` + filter
loop in `chunksFromTokenizerUpstream` skips zero-value ChunkDocs.
- **Batch size env var (Omission 3):** `embeddingBatchSize()` reads
`TOKENIZER_EMBEDDING_BATCH_SIZE`, defaults to 16.
- **Summary empty check (Diff 5):** `TrimSpace(s) != ""` → `s != ""`,
matching Python truthy check.
- **chunk_order_int all paths (Diff 8):** set unconditionally before
full_text/embedding branching.
- **Timeout default (Diff 10):** `600s` → `60s`, matching Python
`@timeout(60)`.
- **Small maxTokens truncation (Diff 14):** `truncateForEmbedding`
returns `""` when `maxTokens <= 10`, matching Python.

### Code review fixes
- Semaphore acquire moved before goroutine in `pdf_vision_dispatch.go`
(concurrency control)
- Context propagation in `pptx_tcadp.go` (cancellation support)
- Test resolver leak fix in `media_dispatch_test.go` (defer restore)
- Migration history comments removed per AGENTS.md

## Test plan
```
bash build.sh --test ./internal/parser/parser/... ./internal/ingestion/component/...
```

## Notes
- Migration diff tracking: `docs/migration_python_go_diff.md`
- Remaining gaps: Extractor component only (21 items)
2026-07-28 11:12:52 +08:00
chanx
326893811a fix(web): identify provider instances by id and skip clean cards on save (#17424) dev-20260728 2026-07-28 09:49:57 +08:00
Wang Qi
619b58faef Add {date} replacement to chat (#17430) 2026-07-28 09:49:17 +08:00
Lynn
15f8ef7409 Fix: code review (#17442) 2026-07-28 09:47:22 +08:00
rayhan
8b793ee148 fix: remediate litellm CVEs by upgrading from 1.82.5 to 1.84.0 (#17448)
## Summary
  
Remediates nine litellm CVEs (3 CRITICAL, 6 HIGH) by upgrading the exact
pin from `==1.82.5` to `==1.84.0` in `pyproject.toml`.
  
  | CVE | Severity | Fixed in |
  |---|---|---|
  | CVE-2026-35030 | CRITICAL | 1.83.0 |
  | CVE-2026-42208 | CRITICAL | 1.83.7 |
  | CVE-2026-49468 | CRITICAL | 1.84.0 |
  | CVE-2026-35029 | HIGH | 1.83.0 |
  | CVE-2026-40217 | HIGH | 1.83.10 |
  | CVE-2026-42203 | HIGH | 1.83.7 |
  | CVE-2026-42271 | HIGH | 1.83.7 |
  | CVE-2026-47101 | HIGH | 1.83.14 |
  | CVE-2026-47102 | HIGH | 1.83.10 |
  
`litellm` was pinned to `==1.82.5` because versions 1.82.6 - 1.82.8 had
a broken `litellm.caching.caching` import chain, and 1.88.0 had a broken
`litellm.integrations.custom_logger` import.
  Both issues are resolved in 1.84.0.
The exact pin is retained (rather than a range) due to litellm's history
of introducing regressions on minor bumps.
2026-07-28 00:25:05 +08:00
Jack
76acd499d4 Fix: use independent fixtures in ClampsOverlappedPct test (#17416)
## Problem
`TestMergeByTokenSizeFromJSON_ClampsOverlappedPct` reused a single
`items` fixture across four calls to `mergeByTokenSizeFromJSON`.

`mergeByTokenSizeFromJSON` mutates its `perItem` argument in place and
returns the same backing array (token.go: `perItem[idx] = merged`). As a
result:
- The 2nd and later calls merged already-merged chunks instead of the
original input.
- Because the returned slice aliases the input, later calls silently
overwrote the earlier results (`at100`, `at0`, ...).
- `reflect.DeepEqual(at100, at150)` was therefore vacuously true — the
test was a **false positive** that never actually exercised the clamp.
It would still pass even if the clamp were broken.

This is exactly the defect flagged in the review comment on PR #17396.

## Fix
Add a `clampOverlapFixture()` factory and build a fresh fixture for
every call, so that 150 / 1e300 / -5 / -1e300 are applied to the
original input.

## Verification
- The test passes after the fix.
- When the clamp logic was temporarily disabled, the test **failed**
(panic at token.go:768 — the negative index produced by an out-of-range
pct), proving the fixed test is no longer a false positive and can catch
a clamp regression.

## Scope
Test file only. No production code change (verified `token.go` is
identical to `upstream/main`).

Refs: review comment on PR #17396.
2026-07-27 22:02:41 +08:00
Jin Hai
1436fcaca5 Go: add context, part13 (#17445)
Signed-off-by: Jin Hai <haijin.chn@gmail.com>
2026-07-27 21:19:39 +08:00
balibabu
1cce9b64f1 Feat: Search for knowledge-base-level graph nodes. (#17444) 2026-07-27 21:03:30 +08:00
rayhan
1ae1dd1edb fix: remediate nltk CVEs by constraining to >=3.10.0 (#17443)
## Summary
  
Remediates five nltk CVEs by adding `nltk>=3.10.0` to
`constraint-dependencies` in `pyproject.toml`.
  
  | CVE | Severity | Installed | Fixed in |
  |---|---|---|---|
  | CVE-2025-14009 | CRITICAL | 3.9.2 | 3.9.3 |
  | CVE-2026-0846 | HIGH | 3.9.2 | 3.9.3 |
  | CVE-2026-0847 | HIGH | 3.9.2 | — |
  | CVE-2026-33231 | HIGH | 3.9.2 | 3.9.4 |
  | CVE-2026-33236 | HIGH | 3.9.2 | — |
  | CVE-2026-54293 | HIGH | 3.9.2 | 3.10.0 |
  | CVE-2026-33230 | MEDIUM | 3.9.2 | 3.9.4 |
  
  CVE-2026-0847 and CVE-2026-33236 have no confirmed fixed version.
 
`nltk` is a transitive dependency (pulled in by `crawl4ai` and
`infinity-sdk`). No package in the graph caps it below 3.10.0. It was
stuck at 3.9.2 simply because the lockfile had never been re-resolved.
2026-07-27 20:38:49 +08:00
Kevin Hu
f9e47ae0b9 Feat: More APIs for compiler list and deletion of compilation result. (#17425)
### Summary

 More APIs for comliler list and deletion of compilation result.
2026-07-27 20:11:18 +08:00
Jin Hai
f73f4cb720 Go: add context, part12 (#17435)
Signed-off-by: Jin Hai <haijin.chn@gmail.com>
2026-07-27 19:30:41 +08:00
buua436
5bfd59f894 fix: delete navigation subtrees correctly (#17434) 2026-07-27 19:13:02 +08:00
euvre
f6464c909d fix: prevent child delimiter add from submitting form (#17421) 2026-07-27 19:11:05 +08:00
euvre
246c40c4e6 fix: show resolved embedding model display name in dataset list (#17415) 2026-07-27 19:09:16 +08:00
Haruko386
0a8f28ff36 Go: add token usage for baidu, minimax, moonshot and mistral (#17413)
### Summary

As title, related to #16990

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2026-07-27 18:04:36 +08:00
Haruko386
27801cfe84 fix: updable to get update-time when forgot the message (#17395)
### Summary

As title

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2026-07-27 18:03:58 +08:00
Jin Hai
19d861b797 Go: add context, part11 (#17426)
Signed-off-by: Jin Hai <haijin.chn@gmail.com>
2026-07-27 17:48:44 +08:00
euvre
30b40caff8 Fix agentbot embedded chat streaming envelope (#17420) 2026-07-27 17:39:44 +08:00
Zhichang Yu
61d58f598e Introduced oxfmt (#17431)
Introduced oxfmt
2026-07-27 17:38:52 +08:00
chanx
4551f945fc fix: improve model merging logic in useModelsDerived for better instance-specific values (#17422) 2026-07-27 17:37:20 +08:00
chanx
b5633eb6f0 fix: update delimiter form field layout for better alignment (#17432) 2026-07-27 17:34:13 +08:00
chanx
4231db78e7 fix: add document name display in testing result cards (#17427) 2026-07-27 17:28:22 +08:00