Skip to content

Fix: get_by_id - #16765

Merged
wangq8 merged 5 commits into
infiniflow:mainfrom
Lynn-Inf:fix/v0.27.0-model-provider
Jul 9, 2026
Merged

wangq8 merged 5 commits into
infiniflow:mainfrom
Lynn-Inf:fix/v0.27.0-model-provider

Conversation

@Lynn-Inf

@Lynn-Inf Lynn-Inf commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary

As title.

@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. 🐞 bug Something isn't working, pull request that fix bug. labels Jul 9, 2026
@Lynn-Inf Lynn-Inf added the ci Continue Integration label Jul 9, 2026
@Lynn-Inf
Lynn-Inf marked this pull request as draft July 9, 2026 03:01
@Lynn-Inf
Lynn-Inf marked this pull request as ready for review July 9, 2026 03:01
@coderabbitai

coderabbitai Bot commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR changes SoMark OCR config resolution to call resolve_model_config(...) directly in two paths and applies formatting-only updates to several helper functions and signatures.

Changes

SoMark Lookup and Formatting Updates

Layer / File(s) Summary
SoMark OCR config resolution
rag/flow/parser/parser.py, rag/app/naive.py
Parser._pdf and by_somark now call resolve_model_config(...) directly for OCR/model config resolution, removing the prior nested fallback handling.
Formatting and signature updates
api/db/joint_services/tenant_model_service.py, api/db/joint_services/memory_message_service.py, rag/nlp/__init__.py, rag/svr/task_executor_refactor/dataflow_service.py, rag/svr/task_executor_refactor/task_handler.py
Whitespace, wrapping, and annotation-only edits adjust several helper functions and constants without changing logic.

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

Possibly related PRs

  • infiniflow/ragflow#16131: This PR also changes SoMark and model-config flows toward direct provider-instance lookup paths instead of TenantLLMService fallback behavior.

Suggested reviewers: xugangqiang

Poem

I hopped through configs, neat and bright,
With tidy lines and fewer branches in sight.
For SoMark paths, I took the direct trail,
And left the old fallback burrow to pale.
A little hop, a little trim — hop hop! 🐇

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title mentions get_by_id, but the diff is mostly model-resolution and formatting changes, so it is misleading. Rename the PR title to describe the actual changes, such as the model-resolution refactor and OCR fallback cleanup.
Description check ❓ Inconclusive The description is just 'As title,' which is too vague to explain the PR's purpose or provide reviewer context. Expand the Summary with the real goal, background, and main code paths changed instead of 'As title.'
✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.

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.

@codecov

codecov Bot commented Jul 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.16%. Comparing base (1430d0e) to head (484189a).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #16765   +/-   ##
=======================================
  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.

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Jul 9, 2026
@Lynn-Inf
Lynn-Inf marked this pull request as draft July 9, 2026 05:28
@Lynn-Inf
Lynn-Inf marked this pull request as ready for review July 9, 2026 05:28

@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.

🧹 Nitpick comments (1)
api/db/joint_services/memory_message_service.py (1)

158-169: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Make the optional task_id explicit.

task_id defaults to None, so str | None matches the runtime contract and clears the Ruff RUF013 warnings on both signatures. Please confirm the repo's Python target supports the union syntax; otherwise use Optional[str].

♻️ Proposed fix
-    task_id: str = None,
+    task_id: str | None = None,
-async def embed_and_save(memory, message_list: list[dict], task_id: str = None):
+async def embed_and_save(memory, message_list: list[dict], task_id: str | None = None):

Also applies to: 206-206

🤖 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/joint_services/memory_message_service.py` around lines 158 - 169, The
`extract_by_llm` signature currently marks `task_id` as a plain `str` even
though it defaults to `None`, which triggers the Ruff RUF013 warning. Update the
type annotation at each affected signature (including the other occurrence noted
in the comment) to explicitly allow `None`, and if the project’s Python version
does not support `str | None`, use `Optional[str]` instead. Use `extract_by_llm`
and the `task_id` parameter as the anchor points when updating the type hints.

Source: Linters/SAST tools

🤖 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.

Nitpick comments:
In `@api/db/joint_services/memory_message_service.py`:
- Around line 158-169: The `extract_by_llm` signature currently marks `task_id`
as a plain `str` even though it defaults to `None`, which triggers the Ruff
RUF013 warning. Update the type annotation at each affected signature (including
the other occurrence noted in the comment) to explicitly allow `None`, and if
the project’s Python version does not support `str | None`, use `Optional[str]`
instead. Use `extract_by_llm` and the `task_id` parameter as the anchor points
when updating the type hints.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f74a427b-ec13-426a-b3bc-33c71e7f7061

📥 Commits

Reviewing files that changed from the base of the PR and between a81b47a and 484189a.

📒 Files selected for processing (7)
  • api/db/joint_services/memory_message_service.py
  • api/db/joint_services/tenant_model_service.py
  • rag/app/naive.py
  • rag/flow/parser/parser.py
  • rag/nlp/__init__.py
  • rag/svr/task_executor_refactor/dataflow_service.py
  • rag/svr/task_executor_refactor/task_handler.py
✅ Files skipped from review due to trivial changes (4)
  • rag/svr/task_executor_refactor/task_handler.py
  • rag/nlp/init.py
  • rag/svr/task_executor_refactor/dataflow_service.py
  • api/db/joint_services/tenant_model_service.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • rag/flow/parser/parser.py
  • rag/app/naive.py

@wangq8
wangq8 merged commit cc94639 into infiniflow:main Jul 9, 2026
3 checks passed
huang-aoqin added a commit to tecpie/ragflow that referenced this pull request Jul 14, 2026
Bring in main fixes (infiniflow#16765, infiniflow#16782). Resolve conflicts using resolve_model_config from main with dev user_id on LLMBundle. Fix get_model_type_by_name single-record handling.

Co-authored-by: Cursor <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration 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