Repository navigation
Feat: add gbrain compile template for session/memory data - #16613
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
💤 Files with no reviewable changes (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughTwo new session templates define knowledge-graph extraction and synthesis settings, and the document-structure executor adds a gated post-merge synthesis pass that plans and refines output pages from that config. ChangesSynthesis templates and executor integration
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant run_document_structure_compile
participant TemplateConfig
participant wiki_plan_from_reduction
participant wiki_refine_from_plan
run_document_structure_compile->>TemplateConfig: read synthesis.enabled, example, compile_kwd
alt synthesis enabled and example present
run_document_structure_compile->>wiki_plan_from_reduction: build plan
wiki_plan_from_reduction-->>run_document_structure_compile: plan
run_document_structure_compile->>wiki_refine_from_plan: refine with example
wiki_refine_from_plan-->>run_document_structure_compile: refined pages
end
Possibly related PRs
Suggested labels: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@rag/svr/task_executor_refactor/chunk_post_processor.py`:
- Line 1099: The synthesis path in chunk_post_processor.py only checks
cancellation once before entering the loop, so long-running PLAN/REFINE work can
continue after a task is cancelled. Update the synthesis flow around
wiki_plan_from_reduction and wiki_refine_from_plan to consult
ctx.has_canceled_func(ctx.id) again immediately before starting PLAN and again
before starting REFINE, or pass an equivalent cancel_check through those calls
like merge_compiled_structures does. Keep the check tied to the existing
synthesis_cfg["enabled"] branch so the task stops promptly during synthesis.
- Around line 1098-1126: The synthesis planner currently ignores the configured
plan filters, so the `synthesis.plan.*` knobs are dead config; update
`chunk_post_processor.py` in the synthesis block around
`wiki_plan_from_reduction` to read `plan_cfg` from `synthesis_cfg` and pass the
supported filter values into the planner call. If `wiki_plan_from_reduction`
does not yet accept `entity_type_filter` and `mention_count_threshold`, either
extend that function to take them or remove the unused comment/template
references so the config and code stay aligned.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 866e52a3-b522-45bb-91ce-32bb2682eaf7
📒 Files selected for processing (3)
api/db/init_data/compilation_templates/session_essence.yamlapi/db/init_data/compilation_templates/session_graph.yamlrag/svr/task_executor_refactor/chunk_post_processor.py
| synthesis_cfg = (parser_cfg or {}).get("synthesis") or {} | ||
| if synthesis_cfg.get("enabled"): | ||
| example = synthesis_cfg.get("example") | ||
| compile_kwd = synthesis_cfg.get("compile_kwd", "artifact_page") | ||
|
|
||
| if not example: | ||
| logging.warning( | ||
| "synthesis: template %s has synthesis.enabled but no example; skipping", | ||
| template_id, | ||
| ) | ||
| else: | ||
| try: | ||
| from rag.advanced_rag.knowlege_compile.wiki import ( | ||
| wiki_plan_from_reduction, | ||
| wiki_refine_from_plan, | ||
| ) | ||
|
|
||
| # PLAN — entity_type_filter and mention_count_threshold | ||
| # are read from plan_cfg. | ||
| progress_cb( | ||
| msg=f"Synthesis PLAN for template {template_id} (kind={compile_kwd}) ..." | ||
| ) | ||
| plan = await wiki_plan_from_reduction( | ||
| chat_mdl=chat_mdl_by_tid[template_id], | ||
| embd_mdl=embedding_model, | ||
| tenant_id=ctx.tenant_id, | ||
| kb_id=ctx.kb_id, | ||
| callback=progress_cb, | ||
| ) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '\n== chunk_post_processor synthesis block ==\n'
sed -n '1080,1165p' rag/svr/task_executor_refactor/chunk_post_processor.py
printf '\n== wiki_plan_from_reduction / wiki_refine_from_plan definitions ==\n'
rg -n "def (wiki_plan_from_reduction|wiki_refine_from_plan)\(" rag/advanced_rag/knowlege_compile/wiki.py
sed -n '2160,2215p' rag/advanced_rag/knowlege_compile/wiki.py
sed -n '3235,3305p' rag/advanced_rag/knowlege_compile/wiki.py
printf '\n== synthesis template configs ==\n'
rg -n "synthesis:|plan:|mention_count_threshold|top_n|compile_kwd|entity_type_filter" -n . -g '!*node_modules/*' -g '!*dist/*' -g '!*build/*'Repository: infiniflow/ragflow
Length of output: 50374
Planner filters aren’t wired
plan_cfg is never read here, and wiki_plan_from_reduction(...) doesn’t accept the filter fields referenced in the comment. That makes synthesis.plan.* in session_essence.yaml and session_graph.yaml dead config. Wire those values into the planner, or remove the comment/template knobs if they aren’t supported yet.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@rag/svr/task_executor_refactor/chunk_post_processor.py` around lines 1098 -
1126, The synthesis planner currently ignores the configured plan filters, so
the `synthesis.plan.*` knobs are dead config; update `chunk_post_processor.py`
in the synthesis block around `wiki_plan_from_reduction` to read `plan_cfg` from
`synthesis_cfg` and pass the supported filter values into the planner call. If
`wiki_plan_from_reduction` does not yet accept `entity_type_filter` and
`mention_count_threshold`, either extend that function to take them or remove
the unused comment/template references so the config and code stay aligned.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #16613 +/- ##
=======================================
Coverage 93.16% 93.16%
=======================================
Files 10 10
Lines 717 717
Branches 118 118
=======================================
Hits 668 668
Misses 29 29
Partials 20 20 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
No description provided.