Repository navigation
Fix: Switching the rerank model on the chat page fails to save the configuration. - #18357
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan includes up to 10 reviews per rolling hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe changes remove the rerank top-K slider, add ChangesTenant model handling
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to 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: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
wangq8
left a comment
There was a problem hiding this comment.
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/chatsfromAPI_WHITELISTstopsaddTenantParamsfrom injectingtenant_*params on chat CRUD endpoints — the server resolves/normalizesllm_id/rerank_iditself. - Omitting
tenant_llm_id/tenant_rerank_idfrom the payload prevents the stale values indatafrom leaking through. - Removing the manual
tenant_llm_id = llm_idsync is safe:_normalize_model_pairfillstenant_llm_id/tenant_rerank_idfrom 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.
Summary
Fix: Switching the rerank model on the chat page fails to save the configuration.