Skip to content

Feat: Put some wiki templates. - #16617

Merged
yingfeng merged 2 commits into
infiniflow:mainfrom
KevinHuSh:feat/knowledge_compilation_backend
Jul 3, 2026
Merged

yingfeng merged 2 commits into
infiniflow:mainfrom
KevinHuSh:feat/knowledge_compilation_backend

Conversation

@KevinHuSh

Copy link
Copy Markdown
Contributor

Summary

Add a few of wiki templates.

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. 💞 feature Feature request, pull request that fullfill a new feature. labels Jul 3, 2026
@KevinHuSh KevinHuSh added the ci Continue Integration label Jul 3, 2026
@coderabbitai

coderabbitai Bot commented Jul 3, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a new authenticated GET endpoint /compilation_templates/wiki_presets backed by a new CompilationTemplateService.load_wiki_presets_from_files() method that reads wiki preset YAML files from disk. Adds six new preset YAML files and updates wikilink formatting text in an existing template. Includes an unrelated formatting tweak in dialog_service.py.

Changes

Wiki Presets Loading and Templates

Layer / File(s) Summary
Preset loading service method
api/db/services/compilation_template_service.py
New load_wiki_presets_from_files() classmethod reads YAML files from a wiki presets directory, validates mappings, skips malformed files, and returns a list of preset dicts with id, topic, instruction, page_example.
Wiki presets REST endpoint
api/apps/restful_apis/compilation_template_api.py
New GET /compilation_templates/wiki_presets route calls the service loader and returns JSON, wrapping exceptions with server_error_response.
New and updated wiki preset YAML files
api/db/init_data/compilation_templates/wiki/brand.yaml, .../engineering.yaml, .../general.yaml, .../market.yaml, .../product.yaml, .../user_interview.yaml, api/db/init_data/compilation_templates/wiki.yaml
Adds six new preset templates with instruction and page_example content, and updates existing wiki.yaml wikilink formatting text.
Unrelated formatting tweak
api/db/services/dialog_service.py
Adjusts keyword-argument spacing in a DeepResearcher.research(...) call with no functional change.

Estimated code review effort: 2 (Simple) | ~12 minutes

Possibly related PRs

  • infiniflow/ragflow#16515: Both PRs extend the compilation-template layer, touching compilation_template_api.py route handlers and CompilationTemplateService for loading/listing template definitions.

Poem

A rabbit hops through YAML fields so wide,
Brand, market, product — presets side by side.
A new route opens, JSON hops on through,
Wikilinks now bracket words anew.
🐇✨ Hooray for templates, tried and true!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is on-topic but too sparse; it lacks the background context and purpose requested by the template. Expand the Summary with the problem/background, what wiki templates were added, and why this change is needed.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title matches the PR’s main change by describing the addition of wiki templates.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@KevinHuSh
KevinHuSh marked this pull request as draft July 3, 2026 10:23
@KevinHuSh
KevinHuSh marked this pull request as ready for review July 3, 2026 10:23
@dosubot dosubot Bot added the python Pull requests that update python code label Jul 3, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (1)
api/db/init_data/compilation_templates/wiki/product.yaml (1)

33-39: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Malformed/outdated Rust snippet in example content.

The fenced code block is missing a closing } for quick_task, and await!(...) is obsolete pre-stabilization async syntax (current Rust uses .await). Since this is example content fed as an LLM prompt, a malformed snippet may degrade generation quality.

✏️ Suggested fix
     ```
     async fn quick_task() -> Result<&'static str> {
         println!("START quick_task");
-        await!(delay(10)).context("delay failed")?;
+        delay(10).await.context("delay failed")?;
         println!("END quick_task");
         Ok("quick_task result")
+    }
     ```
🤖 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 `@api/db/init_data/compilation_templates/wiki/product.yaml` around lines 33 -
39, The example Rust snippet is malformed and uses outdated async syntax, so
update the fenced `quick_task` snippet to be valid current Rust. In the
`quick_task` example, close the function body with the missing brace and replace
the obsolete `await!(delay(10))` usage with the modern `.await` form. Keep the
snippet consistent with the surrounding documentation so the prompt content
remains syntactically correct and up to date.
🤖 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 `@api/db/init_data/compilation_templates/wiki.yaml`:
- Around line 9-11: The wiki template text includes a stray literal "\n" at the
end of the “See also” instruction, which will be rendered verbatim in the
prompt. Remove the escaped newline from the YAML block scalar content in
wiki.yaml so the instruction text ends cleanly; check the affected bullet in the
template string and keep the formatting consistent with the surrounding entries.

In `@api/db/init_data/compilation_templates/wiki/engineering.yaml`:
- Around line 39-40: The task list item in the wiki template is malformed
because the checkbox syntax is missing the required list marker, so it will not
render correctly in GitHub-Flavored Markdown. Update the Open questions entry in
the engineering template so the checked item uses proper task-list formatting,
keeping the existing text but adding the correct list prefix around the [x]
item.

In `@api/db/init_data/compilation_templates/wiki/general.yaml`:
- Around line 2-8: The instruction text in the YAML block scalar contains a
stray literal backslash-n sequence, so the parsed content will include “\n”
verbatim instead of a real line break. Update the general.yaml instruction block
to remove the escaped newline from the See also bullet in the instruction
string, keeping the content as plain multiline prose under the instruction key.
Refer to the instruction field in the YAML block literal and ensure the final
rendered text does not contain any literal escape sequences.

---

Nitpick comments:
In `@api/db/init_data/compilation_templates/wiki/product.yaml`:
- Around line 33-39: The example Rust snippet is malformed and uses outdated
async syntax, so update the fenced `quick_task` snippet to be valid current
Rust. In the `quick_task` example, close the function body with the missing
brace and replace the obsolete `await!(delay(10))` usage with the modern
`.await` form. Keep the snippet consistent with the surrounding documentation so
the prompt content remains syntactically correct and up to date.
🪄 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: 2f3b4539-a6c9-4c14-8420-65d69ebc19a6

📥 Commits

Reviewing files that changed from the base of the PR and between 706fa4e and bb2f8d3.

📒 Files selected for processing (10)
  • api/apps/restful_apis/compilation_template_api.py
  • api/db/init_data/compilation_templates/wiki.yaml
  • api/db/init_data/compilation_templates/wiki/brand.yaml
  • api/db/init_data/compilation_templates/wiki/engineering.yaml
  • api/db/init_data/compilation_templates/wiki/general.yaml
  • api/db/init_data/compilation_templates/wiki/market.yaml
  • api/db/init_data/compilation_templates/wiki/product.yaml
  • api/db/init_data/compilation_templates/wiki/user_interview.yaml
  • api/db/services/compilation_template_service.py
  • api/db/services/dialog_service.py

Comment on lines +9 to +11
- 3. Bold key terms on first use; link them with [[ ]] wikilinks.
- 4. Examples or implications where the source provides them.
- 5. ## See also section at the end with artifactlinks to highly related pages(less than 12).\n
- 5. ## See also section at the end with wikilinks to highly related pages(less than 12).\n

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Stray literal \n in instruction text.

Line 11 ends with a literal \n inside a YAML block scalar (|), so it won't render as a newline — it will appear verbatim as \n in the prompt text shown to the model.

✏️ Suggested fix
-      - 5. ## See also section at the end with wikilinks to highly related pages(less than 12).\n
+      - 5. ## See also section at the end with wikilinks to highly related pages(less than 12).
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- 3. Bold key terms on first use; link them with [[ ]] wikilinks.
- 4. Examples or implications where the source provides them.
- 5. ## See also section at the end with artifactlinks to highly related pages(less than 12).\n
- 5. ## See also section at the end with wikilinks to highly related pages(less than 12).\n
- 3. Bold key terms on first use; link them with [[ ]] wikilinks.
- 4. Examples or implications where the source provides them.
- 5. ## See also section at the end with wikilinks to highly related pages(less than 12).
🤖 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 `@api/db/init_data/compilation_templates/wiki.yaml` around lines 9 - 11, The
wiki template text includes a stray literal "\n" at the end of the “See also”
instruction, which will be rendered verbatim in the prompt. Remove the escaped
newline from the YAML block scalar content in wiki.yaml so the instruction text
ends cleanly; check the affected bullet in the template string and keep the
formatting consistent with the surrounding entries.

Comment on lines +39 to +40
## Open questions
[x] E.g. is this part of the free plan?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Malformed GFM task-list syntax.

[x] E.g. ... is missing the leading - required for GitHub-Flavored-Markdown task lists, so it won't render as a checkbox.

Proposed fix
     ## Open questions
-    [x] E.g. is this part of the free plan?
+    - [x] E.g. is this part of the free plan?
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
## Open questions
[x] E.g. is this part of the free plan?
## Open questions
- [x] E.g. is this part of the free plan?
🤖 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 `@api/db/init_data/compilation_templates/wiki/engineering.yaml` around lines 39
- 40, The task list item in the wiki template is malformed because the checkbox
syntax is missing the required list marker, so it will not render correctly in
GitHub-Flavored Markdown. Update the Open questions entry in the engineering
template so the checked item uses proper task-list formatting, keeping the
existing text but adding the correct list prefix around the [x] item.

Comment on lines +2 to +8
instruction: |
- Each page must be a proper encyclopedic article, NOT a flat bullet list:
- 1. Opening paragraph (2-4 sentences defining what this is). No heading.
- 2. Sections with H2 headings, each starting with prose before sub-bullets.
- 3. Bold key terms on first use; link them with [[ ]] wikilinks.
- 4. Examples or implications where the source provides them.
- 5. ## See also section at the end with wikilinks to highly related pages(less than 12).\n

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Stray literal \n in YAML block literal.

Inside a YAML | block scalar, \n is not interpreted as a newline — it becomes a literal backslash+n in the parsed instruction string, which will be surfaced verbatim wherever this instruction text is rendered.

Proposed fix
-    - 5. ## See also section at the end with wikilinks to highly related pages(less than 12).\n
+    - 5. ## See also section at the end with wikilinks to highly related pages(less than 12).
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
instruction: |
- Each page must be a proper encyclopedic article, NOT a flat bullet list:
- 1. Opening paragraph (2-4 sentences defining what this is). No heading.
- 2. Sections with H2 headings, each starting with prose before sub-bullets.
- 3. Bold key terms on first use; link them with [[ ]] wikilinks.
- 4. Examples or implications where the source provides them.
- 5. ## See also section at the end with wikilinks to highly related pages(less than 12).\n
instruction: |
- Each page must be a proper encyclopedic article, NOT a flat bullet list:
- 1. Opening paragraph (2-4 sentences defining what this is). No heading.
- 2. Sections with H2 headings, each starting with prose before sub-bullets.
- 3. Bold key terms on first use; link them with [[ ]] wikilinks.
- 4. Examples or implications where the source provides them.
- 5. ## See also section at the end with wikilinks to highly related pages(less than 12).
🤖 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 `@api/db/init_data/compilation_templates/wiki/general.yaml` around lines 2 - 8,
The instruction text in the YAML block scalar contains a stray literal
backslash-n sequence, so the parsed content will include “\n” verbatim instead
of a real line break. Update the general.yaml instruction block to remove the
escaped newline from the See also bullet in the instruction string, keeping the
content as plain multiline prose under the instruction key. Refer to the
instruction field in the YAML block literal and ensure the final rendered text
does not contain any literal escape sequences.

@yingfeng
yingfeng marked this pull request as draft July 3, 2026 12:05
@yingfeng
yingfeng marked this pull request as ready for review July 3, 2026 12:05
@codecov

codecov Bot commented Jul 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.16%. Comparing base (9182296) to head (bb2f8d3).
⚠️ Report is 27 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #16617   +/-   ##
=======================================
  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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@yingfeng
yingfeng merged commit cf634b9 into infiniflow:main Jul 3, 2026
15 of 21 checks passed
xugangqiang pushed a commit to xugangqiang/ragflow that referenced this pull request Jul 3, 2026
### Summary

Add a few of wiki templates.
xugangqiang pushed a commit to xugangqiang/ragflow that referenced this pull request Jul 6, 2026
### Summary

Add a few of wiki templates.
@coderabbitai coderabbitai Bot mentioned this pull request Jul 9, 2026
1 task done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration 💞 feature Feature request, pull request that fullfill a new feature. python Pull requests that update python code size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants