Skip to content

Fix: Switching the rerank model on the chat page fails to save the configuration. - #18357

Merged
wangq8 merged 2 commits into
infiniflow:mainfrom
cike8899:fix-0.27
Aug 17, 2026
Merged

wangq8 merged 2 commits into
infiniflow:mainfrom
cike8899:fix-0.27

Conversation

@cike8899

Copy link
Copy Markdown
Contributor

Summary

Fix: Switching the rerank model on the chat page fails to save the configuration.

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. 🐞 bug Something isn't working, pull request that fix bug. 🧰 typescript Pull requests that update Typescript code labels Aug 17, 2026
@cike8899
cike8899 requested a review from wangq8 August 17, 2026 05:16
@cike8899 cike8899 added the ci Continue Integration label Aug 17, 2026
@cike8899
cike8899 marked this pull request as draft August 17, 2026 05:16
@cike8899
cike8899 marked this pull request as ready for review August 17, 2026 05:16
@coderabbitai

coderabbitai Bot commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 217e46fb-ec32-40a9-9f3b-1a1e9cabde61

📥 Commits

Reviewing files that changed from the base of the PR and between 248a4e6 and 6878401.

📒 Files selected for processing (4)
  • web/src/components/rerank.tsx
  • web/src/interfaces/database/chat.ts
  • web/src/pages/next-chats/chat/app-settings/chat-settings.tsx
  • web/src/utils/llm-util.ts

Included review availability: Your plan includes up to 10 reviews per rolling hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The changes remove the rerank top-K slider, add tenant_rerank_id to chat data, exclude tenant model fields from chat updates, and stop injecting tenant model IDs into chats API requests.

Changes

Tenant model handling

Layer / File(s) Summary
Chat model contract and update payloads
web/src/interfaces/database/chat.ts, web/src/pages/next-chats/chat/app-settings/chat-settings.tsx
IDialog now includes optional tenant_rerank_id. Chat updates omit tenant_llm_id and tenant_rerank_id from existing data before merging submitted values.
Rerank form and chat API normalization
web/src/components/rerank.tsx, web/src/utils/llm-util.ts
The rerank form now renders only the rerank model field. The chats API is removed from tenant-parameter injection.

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

Merge Risk: ⚪ Minimal · up to 68784

The PR changes chat rerank-model configuration handling in four frontend files. No actionable merge-blocking risk remains in the supplied evidence beyond normal checks and review.

Suggested reviewers: lynn-inf, jinhai-cn

Poem

A rabbit trims the slider bright,
Adds rerank fields to chat tonight.
Tenant IDs now flow with care,
While chat requests keep payloads fair.
Hop, hop—the form is light!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 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.
Description check ✅ Passed The description includes the required Summary section and clearly states the issue that this pull request fixes.
Title check ✅ Passed The title clearly and concisely describes the main change: fixing rerank model configuration saving on the chat page.

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.

@wangq8 wangq8 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approved — root cause and fix verified.

The failure was caused by the frontend sending a stale tenant_rerank_id (spread from the existing chat data) together with the newly selected rerank_id. The backend _normalize_model_pair (api/apps/restful_apis/chat_api.py) rejects requests where rerank_id and tenant_rerank_id resolve to different models (... must refer to the same model), so the save failed.

The fix is correct:

  • Dropping /api/v1/chats from API_WHITELIST stops addTenantParams from injecting tenant_* params on chat CRUD endpoints — the server resolves/normalizes llm_id/rerank_id itself.
  • Omitting tenant_llm_id/tenant_rerank_id from the payload prevents the stale values in data from leaking through.
  • Removing the manual tenant_llm_id = llm_id sync is safe: _normalize_model_pair fills tenant_llm_id/tenant_rerank_id from the name fields when only names are provided.

No regression on message sending: the completion endpoint is /api/v1/chat/completions (singular), which /api/v1/chats never matched. The rerank.tsx cleanup (dead top_k slider code + unused imports) is unrelated but harmless.

@wangq8
wangq8 merged commit 8664d8d into infiniflow:main Aug 17, 2026
12 checks passed
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. 🧰 typescript Pull requests that update Typescript code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants