Skip to content

fix(sdk-chat): validate chat configuration - #21732

Merged
wangq8 merged 2 commits into
infiniflow:mainfrom
6ba3i:fix/sdk-chat-source
Oct 30, 2026
Merged

wangq8 merged 2 commits into
infiniflow:mainfrom
6ba3i:fix/sdk-chat-source

Conversation

@6ba3i

@6ba3i 6ba3i commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Validate chat settings and preserve nested prompt metadata during updates.
All 226 chat SDK cases and the chat configuration API matrix pass.

@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 16621780-f55a-4998-a9d7-b2fcf80335a9
Commits

Reviewing files that changed from the base of the PR and between 60f8ac2 and d7abbcb.

Files selected for processing: 1
  • test/api/chat_api_test.go

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

Walkthrough

Chat creation and REST updates now validate supplied LLM and prompt configuration values. Nested configuration updates recursively merge objects, except agentic_rag, which remains a whole-object replacement. Service and API tests cover validation and merge behavior.

Changes: Chat configuration

Layer / File(s) Summary
Validate chat configuration
internal/service/chat.go, internal/service/chat_sdk_contract_test.go, test/testcases/test_sdk_api/test_chat_assistant_management/test_create_chat_assistant.py, test/testcases/test_sdk_api/test_chat_assistant_management/test_update_chat_assistant.py, test/api/chat_api_test.go
Creation and REST updates validate LLM setting values and prompt configuration types. SDK tests that were previously skipped now run. API tests cover invalid values and check that rejected create requests do not create chats.
Merge nested configuration
internal/service/chat.go, internal/service/chat_sdk_contract_test.go, test/testcases/test_sdk_api/test_chat_assistant_management/test_update_chat_assistant.py
Nested configuration objects retain unspecified values during updates. agentic_rag remains a whole-object replacement. Tests check nested value preservation and that merging does not mutate the base map.

Priority: Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Possibly related issues

  • infiniflow/ragflow#21356 — This PR validates chat configuration during create and update, addressing invalid configuration being stored through the API. It does not address the issue’s frontend validation errors.

Possibly related PRs

Suggested reviewers: buua436

Merge Risk: Minimal · up to d7abb

No actionable merge-blocking risk was found in the reviewed changes.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: validating SDK chat configuration.
Description check Passed The description states the purpose of the change and provides test results. It is relevant and mostly complete, although it does not use the template's explicit “### Summary” heading or provide detail…
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.
Full details: Description check

Explanation

The description states the purpose of the change and provides test results. It is relevant and mostly complete, although it does not use the template's explicit “### Summary” heading or provide detailed background context.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 6 functions across 3 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 1
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

A rabbit checks each setting’s type,
And keeps the nested values right.
A prompt must match its stated form,
While agentic_rag is replaced whole.
The tests now hop through every case,
And leave no rejected chat in place.

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

@6ba3i
6ba3i requested a review from wangq8 October 30, 2026 03:17
@6ba3i 6ba3i added the ci Continue Integration label Oct 30, 2026
@wangq8
wangq8 merged commit 0382485 into infiniflow:main Oct 30, 2026
10 of 11 checks passed
flyingwhit pushed a commit to flyingwhit/ragflow that referenced this pull request Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants