Repository navigation
feat: impl dao - #1
Merged
Merged
Conversation
yingfeng
pushed a commit
that referenced
this pull request
Feb 5, 2024
Co-authored-by: kould <2435992353@qq.com>
4 tasks done
4 tasks done
4 tasks done
4 tasks done
4 tasks done
1 task done
KevinHuSh
pushed a commit
that referenced
this pull request
Nov 27, 2025
### What problem does this PR solve? ##### Problem Description When parsing HTML files, some page content may be lost. For example, text inside nested `<font>` tags within multiple `<div>` elements (e.g., `<div><font>Text_1</font></div><div><font>Text_2</font></div>`) fails to be preserved correctly. ###### Root Cause #1: Block ID propagation is interrupted 1. **Block ID generation**: When the parser encounters a `<div>`, it generates a new `block_id` because `<div>` belongs to `BLOCK_TAGS`. 2. **Recursive processing**: This `block_id` is passed down recursively to process the `<div>`’s child nodes. 3. **Interruption occurs**: When processing a child `<font>` tag, the code enters the `else` branch of `read_text_recursively` (since `<font>` is a Tag). 4. **Bug location**: The first line in this `else` branch explicitly sets **`block_id = None`**. - This discards the valid `block_id` inherited from the parent `<div>`. - Since `<font>` is not in `BLOCK_TAGS`, it does not generate a new `block_id`, so it passes `None` to its child text nodes. 5. **Consequence**: The extracted text nodes have an empty `block_id` in their `metadata`. During the subsequent `merge_block_text` step, these texts cannot be correctly associated with their original `<div>` block due to the missing ID. As a result, all text from `<font>` tags gets merged together, which then triggers a second issue during concatenation. 6. **Solution:** Remove the forced reset of `block_id` to `None`. When the current tag (e.g., `<font>`) is not a block-level element, it should inherit the `block_id` passed down from its parent. This ensures consistent ownership across the hierarchy: `div` → `font` → `text`. ###### Root Cause #2: Data loss during text concatenation 1. The line `current_content += (" " if current_content else "" + content)` has a misplaced parenthesis. When `current_content` is non-empty (`True`): - The ternary expression evaluates to `" "` (a single space). - The code executes `current_content += " "`. - **Result**: Only a space is appended—**the new `content` string is completely discarded**. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
levischd
pushed a commit
to levischd/ragflow
that referenced
this pull request
Dec 8, 2025
Implemented CI/CD Reviewed Dockerfile Created docker-compose confiuration
clifftseng
pushed a commit
to clifftseng/ragflow
that referenced
this pull request
Feb 9, 2026
### What problem does this PR solve? ##### Problem Description When parsing HTML files, some page content may be lost. For example, text inside nested `<font>` tags within multiple `<div>` elements (e.g., `<div><font>Text_1</font></div><div><font>Text_2</font></div>`) fails to be preserved correctly. ###### Root Cause infiniflow#1: Block ID propagation is interrupted 1. **Block ID generation**: When the parser encounters a `<div>`, it generates a new `block_id` because `<div>` belongs to `BLOCK_TAGS`. 2. **Recursive processing**: This `block_id` is passed down recursively to process the `<div>`’s child nodes. 3. **Interruption occurs**: When processing a child `<font>` tag, the code enters the `else` branch of `read_text_recursively` (since `<font>` is a Tag). 4. **Bug location**: The first line in this `else` branch explicitly sets **`block_id = None`**. - This discards the valid `block_id` inherited from the parent `<div>`. - Since `<font>` is not in `BLOCK_TAGS`, it does not generate a new `block_id`, so it passes `None` to its child text nodes. 5. **Consequence**: The extracted text nodes have an empty `block_id` in their `metadata`. During the subsequent `merge_block_text` step, these texts cannot be correctly associated with their original `<div>` block due to the missing ID. As a result, all text from `<font>` tags gets merged together, which then triggers a second issue during concatenation. 6. **Solution:** Remove the forced reset of `block_id` to `None`. When the current tag (e.g., `<font>`) is not a block-level element, it should inherit the `block_id` passed down from its parent. This ensures consistent ownership across the hierarchy: `div` → `font` → `text`. ###### Root Cause infiniflow#2: Data loss during text concatenation 1. The line `current_content += (" " if current_content else "" + content)` has a misplaced parenthesis. When `current_content` is non-empty (`True`): - The ternary expression evaluates to `" "` (a single space). - The code executes `current_content += " "`. - **Result**: Only a space is appended—**the new `content` string is completely discarded**. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
4 tasks done
2 tasks done
Oldcircle
added a commit
to Oldcircle/ragflow
that referenced
this pull request
Apr 24, 2026
Once the sidebar / new-session dialog / SSE path got exercised end-to-end
on real DeepSeek, five independent bugs surfaced. All fixed + tob_acceptance
script to catch regressions without a browser.
1. **model_resolver crashed the TenantLLM branch** (api/agent_v2/model_resolver.py)
`llm_config.get("api_key")` treated a peewee TenantLLM *Model instance*
like a dict — but peewee.Model.get() is a classmethod that reinterprets
"api_key" as a column filter and runs a new SELECT, raising
TenantLLMDoesNotExist. Every new session created from the workbench
(which always passes {llm_name, factory}) hit this path and got an
SSE stream with zero events. Switched to attribute access
(`getattr(llm_config, "api_key", None)`). Regression covered by
scripts/tob_acceptance.py::S15.
Why it slipped past M1.5: those runs used the env-var fallback
(AGENT_V2_DEEPSEEK_KEY), which never entered the TenantLLM branch.
2. **Citation validator was 100% false-positive on every live turn**
(api/agent_v2/runner.py::_collect_evidence_from_tool)
Claude Agent SDK namespaces tool names as `mcp__ragflow__rag_retrieve`.
The evidence collector matched on the bare name `rag_retrieve`, so
EvidenceIndex stayed empty forever. Result: every Markdown answer got
"Citation [1] does not map to any chunk returned in this turn (only 0
chunks available)" plus a "number_unsupported" storm, turning the
citation-warning UI into noise. Now does `rsplit("__", 1)[-1]` so both
MCP-prefixed and bare names match.
3. **Chinese-numeral normalization inverted** (api/agent_v2/validators/evidence_index.py)
The old `_cn_to_num` iterated reversed and accumulated "十八" as 80,
"二十五" as 70, "三十五" as 80. Because the age regex captures both
"十八周岁" and "18周岁", rule 2 then compared normalized=80 against
an evidence that only had normalized=18 and screamed
"number_unsupported" on a totally correct answer.
Rewrote as a straight left-to-right digit/small-unit/big-unit state
machine. 12/13 target cases pass (the only residual is the colloquial
ellipsis "两百三" = 203 vs 230; policy text doesn't use that form).
4. **Streaming not actually streaming** (api/agent_v2/runner.py)
AgentRunner never set `include_partial_messages=True` on
ClaudeAgentOptions, so AssistantMessage arrived as one final block and
the frontend got a single text_delta with the entire answer — visually
"appears all at once". Now enabled; StreamEvent handler yields
text_delta / thinking for each content_block_delta. To avoid doubling,
AssistantMessage path stops yielding TextBlock/ThinkingBlock (the same
content would then follow the streamed tokens). Verified: one question
on DeepSeek went from 12 SSE events to 1222.
5. **Assistant message rendered twice** (web/src/pages/agent-chat/index.tsx)
After `send()` drained the SSE stream, `turn.text` was still non-empty;
the handler then called `refetchSessionDetail()` which pulled the newly
persisted assistant message into `historyMessages`, so `MessageList`
rendered both the history entry AND the streaming turn — identical
text displayed twice in a row. Now calls `reset()` after refetch
so the streaming turn clears once history takes over.
Plus a UX fix:
- **max_turns / max_budget_usd inputs were unclearable** in
NewSessionDialog. `Number("") || 20` snapped the state back to 20
mid-type, so the field was effectively read-only. Switched to string
state + parse-on-submit with sane fallbacks.
And one operational tool:
- **scripts/tob_acceptance.py** (new) — one-shot self-check hitting real
MySQL / ES / Redis / (optional) DeepSeek. Runs 19 checks across
definition registry, citation validator three rules, EvidenceIndex
extraction, rewrite bailouts, compactor logic, session+history+summary
persistence, audit log, tenant quota/usage, rate-limit memory+Redis
paths, dedup, bot secret encryption, subagent trace persistence,
cross-tenant RBAC deny, model_resolver regression (bug infiniflow#1 above),
HTTP blueprint registration, ruff, and pytest. Optional
`--live-llm` flag adds one real AgentRunner run (~$0.02) verifying
bugs infiniflow#2, infiniflow#3, infiniflow#4 stay fixed end-to-end. All 18 checks currently green.
Verification:
- `.venv/bin/python scripts/tob_acceptance.py --live-llm` → 18 pass 0 fail
- `pytest test/agent_v2/test_validators.py test/agent_v2/test_compactor.py test/agent_v2/test_definitions.py`
→ 72 passed
- Live DeepSeek run (保障房 "公租房申请条件" prompt) → 1222 streamed
events, rag_retrieve+rag_read_doc called, no citation_warning false
positives, single non-duplicated assistant turn rendered.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Oldcircle
added a commit
to Oldcircle/ragflow
that referenced
this pull request
Apr 27, 2026
旧实现 [...streamingToolCalls, ...historyToolCalls] + Set 首位保留 把当前轮调用强行顶到列表最前,多轮会话时上面是当前轮 infiniflow#1/infiniflow#2/infiniflow#3、 下面才接上一轮的 infiniflow#1/infiniflow#2/infiniflow#3 —— 视觉乱序。 后端 list_by_session 已按 start_time asc 排好,问题在前端。 改用 Map 合并:history 覆盖同 id 的 streaming(history 是 canonical 真值 + 服务端时钟一致),用 ...(existing ?? {}) 保留 streaming 上 subagent_start/end 注入的内联 trace(history 没有这字段),最后按 startTs 升序排,与左侧消息流"老→新 自上而下"对齐。 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
KevinHuSh
pushed a commit
that referenced
this pull request
May 19, 2026
…#14849) ## What problem does this PR solve? Closes #12582. When a Retrieval component sits inside an Iteration with a **manual** metadata filter that references the iteration variable (e.g. `{IterationItem:abc@item}`), every iteration reuses the value resolved on the **first** pass. Root cause: [`_resolve_manual_filter` in `agent/tools/retrieval.py`](https://github.com/infiniflow/ragflow/blob/main/agent/tools/retrieval.py#L144-L171) mutated `flt["value"]` in place. The `filters` list passed in is the live `self._param.meta_data_filter["manual"]` (see [`apply_meta_data_filter` in `common/metadata_utils.py:257-261`](https://github.com/infiniflow/ragflow/blob/main/common/metadata_utils.py#L257-L261)), so after the first iteration the param dict permanently held the resolved string instead of the original variable reference. ```text iter #1: flt["value"] = "{IterationItem:abc@item}" → resolved to "AI" after mutation: flt["value"] = "AI" ← written back into _param iter #2: flt["value"] = "AI" ← no {…} matches retrieval keeps filtering by "AI" forever ``` This PR returns a shallow copy with the resolved value instead, leaving the original filter (and its variable reference) intact for the next iteration. ## Type of change - [x] Bug fix (non-breaking change which fixes an issue) ## Test plan - [ ] Build an agent: `Agent (structured output → list of areas) → Iteration → Retrieval (manual filter: Area = {IterationItem/Item}) → Message`. Run with a multi-area query and confirm each iteration's Retrieval result matches its own item, not the first item. - [ ] Regression: Retrieval with a manual metadata filter outside an Iteration still resolves the variable correctly on each request. - [ ] Regression: Retrieval with no metadata filter and with `auto` / `semi_auto` filters behave unchanged.
Merged
3 tasks done
4 tasks done
4 tasks done
This was referenced Sep 2, 2026
This was referenced Sep 4, 2026
Taranum01
referenced
this pull request
in Taranum01/ragflow
Sep 10, 2026
…red (infiniflow#16978 review) Per xugangqiang's follow-up review of infiniflow#16978 (fold #1, infiniflow#2, infiniflow#4; deferring infiniflow#3): 1. CHART blocks now count toward images_chunked on the raw-mode text path too. Previously a chart-only raw PDF would report detected > 0, chunked = 0 even though the chart's caption/footnote was emitted into a real section — a systematic false positive on the headline detected - chunked gap. The condition at mineru_parser.py:~970 now matches {IMAGE, CHART}, mirroring images_described at :913 and images_chunked in _transfer_to_tables. New regression test test_raw_mode_counts_chart_block_as_chunked pins this. 2. Split the test that pinned a non-production counter value (raw + _transfer_to_tables in the same fixture — parse_pdf never calls _transfer_to_tables in raw mode). Replaced with two realistic-path tests: - test_raw_mode_counts_unreadable_resource_in_sections: raw mode only, pins the realistic counter values for that path. - test_app_media_mode_counts_unreadable_resource: naive/manual/paper path, which is the only path that runs _transfer_to_tables in production. The old test_readable_image_chunks assertion (chunked == 3) was the artifact of the increment-then-decrement pattern, which is now replaced by count-on-confirmed-emit. 3. Pre-seeded vlm_configured in both coverage dicts (MinerUParser.last_image_coverage in __init__ and the local image_coverage dict in _transfer_to_sections) so callers that read it after only _transfer_to_sections returns get False instead of KeyError. parse_pdf still overwrites it with the real vision_model status. New regression test test_initial_last_image_coverage_has_vlm_configured_key pins this. Tests: pytest test/unit_test/deepdoc/parser/test_mineru_parser.py -v -> 57 passed (54 pre-existing + 3 new). The 3 pre-existing failures (RagTokenizer.set_language / grpcio-status) are unrelated to this change.
1 task done
This was referenced Sep 11, 2026
3 of 8 tasks
3 tasks done
This was referenced Sep 22, 2026
This was referenced Oct 10, 2026
4 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.