Commit Graph

7585 Commits

Author SHA1 Message Date
euvre
2f7dc60337 fix: restore download button when file type is selected in agent message (#17184) 2026-07-22 19:21:17 +08:00
euvre
1aaa200471 fix: use FormLabel required prop for consistent asterisk color in search settings (#17223) 2026-07-22 19:20:59 +08:00
euvre
c1aff8c710 fix: prevent empty-state flash on knowledge-base and chat list loading (#17221) 2026-07-22 19:20:48 +08:00
euvre
769bd50363 fix: restore empty model warning in dataset creating dialog (#17220) 2026-07-22 19:20:33 +08:00
euvre
e411f91938 fix: Go backend builtin chunk method list not showing (#17180) 2026-07-22 19:14:51 +08:00
Jack
8669c469d5 fix(ingestion): align laws DSL with Python — heading fallback, colon-title, short-line filter, remove_toc, and image extension mapping (#17200)
## Summary

This PR aligns the Go ingestion pipeline's **Laws** DSL template with
the Python implementation by fixing heading-detection gaps, adds
image-extension support, refactors the **Extractor** component's LLM
resolution, hardens heading detection for CJK text, and makes the
Extractor accept the Python DSL prompt key names
(`sys_prompt`/`prompts`) alongside the Go names.

## Changes

### 1. Picture file-type detection (`internal/utility/file.go`)

Adds explicit mapping for common image extensions (png, jpg, jpeg, gif,
bmp, tiff, tif, webp, svg, ico, avif, heic, apng) → `FileTypeVISUAL`,
with regression tests.

### 2. Laws DSL heading-detection alignment
(`internal/ingestion/component/chunker/`)

Four fixes to `resolveTitleLevels`:

| Fix | What changed | Why |
|-----|-------------|-----|
| **DOCX `ck_type` fallback** | `ckType` field on `lineRecord`,
propagated from `ChunkDoc.CKType` in `recordsFromStructured`. When
`ck_type=="heading"`, assign `fallbackLevel`. | office_oxide extracts
DOCX heading metadata, but the info was lost before reaching the heading
detector. Word headings whose text doesn't match any regex (e.g.
"Introduction") were treated as body. |
| **`make_colon_as_title` promotion** | `isColonTitle()`: promotes lines
ending with `:`/`:` that have sentence-ending punctuation before the
colon and ≥32 runes between them. | Mirrors Python's
`make_colon_as_title` in `rag/nlp/__init__.py`. Triple guard prevents
false positives. |
| **Short/numeric line filter** | Lines with ≤1 rune or purely numeric
are pinned to body level. | Mirrors Python `tree_merge`'s filter of
`sections` where `len(...) <= 1` or `re.match(r"[0-9]+$", ...)`. |
| **PDF `remove_toc`** | `"remove_toc": true` added to the PDF parser
setup in `ingestion_pipeline_laws.json`. | The Go PDF parser already
supports TOC removal; the Book template already enables it. |

### 3. Extractor llm_id resolution
(`internal/ingestion/component/extractor.go`)

Refactored to handle both **bare tenant_model UUIDs** and **composite
model@provider** strings via the shared `resolveModelConfig`
(`dispatch_model.go`):

- **`resolveExtractorChatConfig`** — UUID path calls
`resolveModelConfigByID` directly (one DB hit); composite path goes
through `resolveModelConfig`. Added `isBareTenantModelID` pre-check for
clear errors when a UUID doesn't exist.
- **`resolveExtractorChatTarget`** — propagates resolution errors
instead of silently returning empty driver.
- **`Chat()`** — removed `driver = "dummy"` fallback. Missing driver is
now an explicit error.
- **Removed dead code**: `splitExtractorLLID`,
`findExtractorSoleActiveInstance`.

### 4. `InjectExtractorLLMID` — fallback when no user config
(`internal/common/parser_config.go`)

Injects the tenant's global default LLM into extractor components **only
when their `llm_id` is empty**. Preserves user-selected UUID or
model@provider values.

Priority: user-configured llm_id > tenant global default > error (no
silent dummy fallback).

### 5. `ResponseHeaderTimeout` increase
(`internal/entity/models/base_model.go`)

`ResponseHeaderTimeout` 60s → 120s in `NewDriverHTTPClient`. Reasoning
models with large extraction prompts can take longer than 60s to produce
the first response token.

### 6. CJK rune-aware heading detection
(`internal/ingestion/component/chunker/title.go`)

Two byte-vs-rune bugs that only manifest on CJK text:

| Fix | What changed | Why |
|-----|-------------|-----|
| **`isColonTitle` byte offset** | `body[lastPunct+1:]` →
`body[lastPunct+runeLen:]` via `utf8.DecodeRuneInString` |
`strings.LastIndexAny` returns a byte index; `+1` skips only 1 byte,
corrupting multi-byte CJK punctuation (e.g. `。` = 3 bytes) and inflating
the rune count past the 32-rune threshold → false-positive heading
promotion. |
| **Short-line filter byte count** | `len(text) <= 1` →
`utf8.RuneCountInString(text) <= 1` | Go `len` is UTF-8 bytes; a single
CJK char (3 bytes) passed the filter, but Python's `len` returns 1 →
mismatch. |

### 7. `extractor_tag.go` — log error when llm fails

When `resolveExtractorChatTarget` returned an error, `runAutoTags` will
log error.

### 8. Python DSL prompt-key compatibility
(`internal/ingestion/component/extractor.go`)

The Resume DSL template uses Python-side key names (`sys_prompt`,
`prompts`). `NewExtractorComponent` now accepts them as fallbacks
alongside the Go names:

- `system_prompt` (Go) ← `sys_prompt` (Python) as fallback
- `prompt` (Go string) ← `prompts` (Python array `[{"role","content"}]`,
takes `[0].content`) as fallback

Mirrors the alias pattern already in `internal/agent/component/llm.go`.
`resolveInputs` accepts per-call `sys_prompt` override too.

## Remaining gaps vs Python

| Gap | Scope | Impact |
|-----|-------|--------|
| **TOC removal for TXT/MD/HTML** | Python's `remove_contents_table`
works on all text formats; Go's `remove_toc` is PDF-only. | Low —
plain-text documents rarely contain structured TOCs. |
| **Regex pattern details** | Minor differences in quantifiers, missing
H5/H6 markdown patterns, missing 4-level numbering pattern. | Low — Go's
variants are stricter; DOCX headings are covered by `ck_type` fallback.
|

## Testing

- `TestHierarchyTitleChunker_CKTypeHeadingFallback` — DOCX `ck_type`
heading promotion
- `TestHierarchyTitleChunker_ColonTitlePromotion` /
`_ColonTitleShortLine_Negative` — colon-title promotion + guard
- `TestIsColonTitle_CJKEdgeCase` / `TestIsColonTitle_ASCII_NoRegression`
— CJK byte-offset fix + ASCII regression
- `TestHierarchyTitleChunker_ColonTitlePromotion_CJK_EdgeCase` — CJK
colon edge case through full pipeline
- `TestHierarchyTitleChunker_ShortSingleCJKLineFilter` — single CJK char
filtered to body
- `TestHierarchyTitleChunker_ShortNumericLineFilter` — purely numeric
lines filtered
- `TestGetFileType_ImageExtensions` / `_ExistingFormats_NoRegression` —
image extension mapping
- `TestInjectExtractorLLMID_SkipWhenUUID` / `_SkipWhenComposite` /
`_InjectWhenEmpty` — llm_id injection guard
- `TestIsBareTenantModelID` — UUID detection
- `TestResolveExtractorChatTarget_AtSplitFallback` / `_NoDriver` — @
split fallback without DB
- `TestNewExtractorComponent_SysPromptAlias` / `_PromptsArray` /
`_PromptsArray_PromptWins` / `_SystemPromptWinsOverSysPrompt` — Python
key compatibility
- `TestBuildDOCXJSONSections_List` / `_TextBox` / `_MixedWithList` —
DOCX list/text_box parsing
- Full ingestion test suite passes (chunker, pipeline, task, service,
component packages)
2026-07-22 19:14:32 +08:00
euvre
a40d5f841b fix: eliminate one-frame flash of title without form content in data source pages (#17214) 2026-07-22 19:06:38 +08:00
Lynn
32ddf59ac6 Fix: go restful api tests (#17247) 2026-07-22 19:06:08 +08:00
Wang Qi
4d772a9365 Fix update 'Child chunk are used for retrieval' does not take effect (#900) (#17251) 2026-07-22 19:05:32 +08:00
Haruko386
db18766027 fix: unable use agent as a tool in agent component (#17228)
### Summary

As title

<img width="3774" height="2128" alt="image"
src="https://github.com/user-attachments/assets/b1ce69b0-2298-4c0c-92de-8d840938e4f0"
/>
2026-07-22 19:04:55 +08:00
Hz_
45ca5f9a3d fix(go-agent): route graph step errors through exception outputs (#17167)
## Summary

- Route ReAct graph step-limit errors through the Agent `_ERROR` output.
- Align the Go Agent default max rounds with Python by using five
rounds.
- Preserve cancellation, timeout, and configuration errors as real
failures.

## Testing

- `bash build.sh --test ./internal/agent/component/...`

<img width="2050" height="1409" alt="image"
src="https://github.com/user-attachments/assets/108e2d27-e115-4595-91a2-21f90c2531ae"
/>
2026-07-22 19:00:53 +08:00
euvre
ffccf0b0fa fix(web): preserve MCP authorization token across edits (#17177) 2026-07-22 17:25:18 +08:00
Jin Hai
df963cf4a1 Doc: fix typo and format (#17249)
### Summary

As title.

Signed-off-by: Jin Hai <haijin.chn@gmail.com>
2026-07-22 17:14:32 +08:00
Muhammad Zuhaib Zahid
d5ff75746c docs: point begin/message component links at .md, not .mdx (#17237)
### Summary

Most files in `docs/guides/agent/agent_component_reference/` are `.mdx`,
but `begin` and
`message` are `.md`. Four links use the `.mdx` extension for those two,
so Docusaurus cannot
resolve the reference and they render as broken links.

Co-authored-by: Muhammad Zuhaib Zahid <288755265+muhzuhaib@users.noreply.github.com>
2026-07-22 17:08:42 +08:00
Muhammad Zuhaib Zahid
de978c5302 docs: fix invalid chunk_method value and NameError in Python SDK reference (#17238)
### Summary

Docs-only, two single-line changes.

Co-authored-by: Muhammad Zuhaib Zahid <288755265+muhzuhaib@users.noreply.github.com>
2026-07-22 17:07:16 +08:00
euvre
53d0613bb2 fix: Make MCP bulk-manage select-all checkbox reflect selection state (#17174) 2026-07-22 17:06:36 +08:00
Muhammad Zuhaib Zahid
073fa123b3 docs: correct firecrawl README paths to tools/firecrawl (#17239)
### Summary

`tools/firecrawl/README.md` documents the integration as living in
`intergrations/firecrawl`,

Co-authored-by: Muhammad Zuhaib Zahid <288755265+muhzuhaib@users.noreply.github.com>
2026-07-22 17:06:21 +08:00
euvre
58127f594c fix: MCP import now processes all files instead of only the first (#17179) 2026-07-22 17:04:37 +08:00
euvre
21e5f00a53 fix: i18n for data source internal configuration fields (#17217) 2026-07-22 16:13:20 +08:00
euvre
dabe426c36 fix: render documentation URLs as hyperlinks in model tooltips (#17224) 2026-07-22 16:03:03 +08:00
euvre
86113fb7d4 fix(web): fix team member status badge hover text readability (#17178) 2026-07-22 15:35:47 +08:00
euvre
35595c9183 Feat: add open-in-new-tab button to search share embed dialog (#17159) 2026-07-22 15:29:43 +08:00
euvre
a81b5057bb fix(web): show builtin chunk methods in file pipeline dialog under Go backend (#17169) 2026-07-22 15:14:02 +08:00
euvre
e0ae22e83b fix(agent): prevent double reply when Agent node is followed by Message node (#17233) 2026-07-22 14:59:29 +08:00
euvre
ade2f3a5ab fix(web): use outline-none instead of outline-0 on focusable controls (#17165) 2026-07-22 14:57:23 +08:00
euvre
f2a48df56b Fix flickering document count and total when toggling file filter on search page (#17161) 2026-07-22 14:57:04 +08:00
euvre
ff1274895f fix: prevent collapse button from overlapping expanded content in next-search (#17157) 2026-07-22 14:56:20 +08:00
Dexterity
18ea0fb7f9 fix(deepdoc): prevent figure and equation crops from merging on scientific PDFs (#15873)
### What problem does this PR solve?

Closes #15872 

On pages that contain both a textless equation and a figure, the layout
recognizer could merge the two unrelated regions into a single cropped
image with concatenated captions. This shows up most often on scientific
and technical PDFs.

The cause is a `layoutno` namespace collision in
`deepdoc/vision/layout_recognizer.py`. Text-overlapping boxes are tagged
per type by `findLayout`: figures become `figure-{ii}` using the
figure-only index, and equations become `equation-{ii}` using the
equation-only index. The fallback loop that handles textless regions,
however, indexes the combined figure plus equation list and always uses
a `figure` prefix.

Because the two paths use different index spaces and prefixes, a page
laid out as `[textless equation, figure with text]` produces two boxes
tagged `figure-0`. `_extract_table_figure` in
`deepdoc/parser/pdf_parser.py` buckets boxes by `f"{page}-{layoutno}"`,
so both fall into the same `page-figure-0` bucket, and `cropout`
stitches the disjoint regions into one image.

**Fix**

The fallback loop now iterates per type, indexes within each type's own
list, and reuses the type as the `layoutno` prefix (`figure-{i}` or
`equation-{i}`). This matches the namespace that `findLayout` already
assigns to text-overlapping boxes. Since the `visited` flag is shared by
reference, each layout is tagged by exactly one path, so per-type
indices stay collision free. Textless equations now land under
`equation-N`, consistent with text-overlapping equations, instead of the
old `figure-N`.

The same fix is applied to `AscendLayoutRecognizer`, which shared the
identical defect.

Downstream consumers of `layoutno` were checked and all treat it as an
opaque equality or bucketing key, so no other code paths are affected.
When a page has no equations, the combined index equals the figure-only
index and the output is unchanged.

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
2026-07-22 14:28:44 +08:00
maoyifeng
863dec759c CI update lefthook and gitee to github (#17230)
### Summary

CI update lefthook and gitee to github
2026-07-22 14:26:00 +08:00
euvre
bab7302265 fix(go): nil pointer dereference in ZhipuAI Embed method (#17219) 2026-07-22 13:59:06 +08:00
euvre
e8f4584fec Fix punctuation in useKnowledgeGraphTip tooltip (#17226) 2026-07-22 13:56:04 +08:00
Wang Qi
c6d9f848bc Fix CVE-2026-42533 (#17218) 2026-07-22 13:18:33 +08:00
Lynn
fc7d4bdf98 Feat: openrouter embedding (#17213) 2026-07-22 13:17:52 +08:00
dependabot[bot]
675c86a7c3 build(deps-dev): bump pillow from 12.2.0 to 12.3.0 (#17208) 2026-07-22 12:25:54 +08:00
euvre
8408f9a4e2 Go: only unlink file-manager files when deleting documents from a knowledge base (#17175) 2026-07-22 12:14:22 +08:00
euvre
4697ee29aa fix: avoid duplicate document names when linking files to datasets (#17181) 2026-07-22 12:12:23 +08:00
euvre
fe3e87361d fix(agent): restrict permission field edits to canvas owner only (#17185) 2026-07-22 12:09:22 +08:00
euvre
03e583f9bc fix: add create_date field to APIKeyResponse for token list display (#17186) 2026-07-22 12:08:16 +08:00
Hz_
b175ed582f fix(go-agent): support Tavily tool names (#17163)
## Summary

- Register `TavilySearch` and `TavilyExtract` Canvas component names in
the Go Agent tool registry.
- Add regression coverage for building both tools by their Python
component names.

## Testing

- `bash build.sh --test ./internal/agent/tool/...`
- `bash build.sh --test ./internal/agent/component/...`
2026-07-22 10:38:26 +08:00
chanx
744ae77290 feat(model): forward instance_id on per-model verify and auto-populate models (#17055) 2026-07-22 10:22:18 +08:00
Wang Qi
a08d203ce7 Fix: enhance ragflow-client (#17206) 2026-07-22 10:07:23 +08:00
rayhan
6a85d1c5c4 migrate: replace zhipuai with zai-sdk to unblock pyjwt CVE fix (#17197)
## Summary

Old `zhipuai==2.0.1` SDK (MetaGLM/zhipuai-sdk-python-v4) requires
`pyjwt~=2.8.0`, which blocks upgrading pyjwt past 2.8.0 to address
active CVEs. The upstream project now recommends the maintained
successor [`zai-sdk`](https://github.com/zai-org/z-ai-sdk-python).

`zai-sdk` relaxes the pyjwt constraint to `>=2.9.0,<3.0.0`, allowing
pyjwt 2.13.0+. The embedding API surface (`client.embeddings.create`) is
identical, no functional changes required.

Related CVE's:

- CVE-2026-48522
- CVE-2026-48524
- CVE-2026-48525
- CVE-2026-48526
- CVE-2026-32597
dev-20260722
2026-07-21 22:24:29 +08:00
rayhan
6c22310582 fix: remediate CVE-2025-69534, upgrade Markdown from 3.6 to >=3.8.1 (#17198) 2026-07-21 22:23:27 +08:00
Jin Hai
9f080a4f45 Py: ruff format (#17193)
### Summary

format issue

Signed-off-by: Jin Hai <haijin.chn@gmail.com>
2026-07-21 21:04:09 +08:00
Wang Qi
1c5a22e226 Enrich the ragflow_client.py (#17189) 2026-07-21 20:18:20 +08:00
Haruko386
b9de586043 fix: add accessible check for datasets (#17116)
### Summary

As title:

Some operations on datasets have been fixed as they previously lacked
authentication, preventing team members from proper or correct usage.

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
dev-20260721-2
2026-07-21 19:20:56 +08:00
Haruko386
d57edee9c3 Go: add funASR provider (#17171)
### Summary

As title

verif ied from CLI

```
RAGFlow(api/default)>  asr with 'paraformer@test@funasr' audio './internal/test.wav' param '{"language": "en"}'
+----------------------------------------------------------------------------------------------------------------------+
| text                                                                                                                 |
+----------------------------------------------------------------------------------------------------------------------+
| The examination and testimony of the experts enabled the commission to conclude that five shots may have been fired. |
+----------------------------------------------------------------------------------------------------------------------+
```
---

<img width="2876" height="1377" alt="image"
src="https://github.com/user-attachments/assets/4cee62c6-1c71-43ce-b398-4d9fbff33c3c"
/>

```bash
INFO:     127.0.0.1:51910 - "POST /v1/audio/transcriptions HTTP/1.1" 200 OK██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00,  2.19it/s]
INFO:     127.0.0.1:60934 - "GET /v1/models HTTP/1.1" 200 OK%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00,  2.10it/s]
```

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2026-07-21 19:20:34 +08:00
Lynn
340d30eb12 Fix: verify model api (#17183) 2026-07-21 19:09:46 +08:00
euvre
3f9d9529b3 fix(file2document): batch link should add to existing KBs, not replace them (#17172) 2026-07-21 19:05:02 +08:00
Lynn
3f5b765a5f Fix(go): check model availability (#17156) 2026-07-21 19:02:14 +08:00