Repository navigation
Fix: add model_type into llm_setting - #15141
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThree chat UI components—ChatSettings, ChatCard, and useRenameChat—now use ChangesLLM Model Type Resolution Across Chat UI Flows
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@web/src/pages/next-chats/chat/app-settings/chat-settings.tsx`:
- Line 35: The llmList returned by useFetchLlmList() starts as {} which causes
getModelTypeByLlmId(llmId, llmList) to treat it as "ready" and default to
'chat'; update chat-settings.tsx to guard model_type derivation until the list
is truly populated by checking llmList is non-empty (e.g.,
Object.keys(llmList).length > 0) or until the query reports loaded, and either
(A) disable the submit path (or the submit button) until llmList is loaded, or
(B) pass null/omit the llmList to getModelTypeByLlmId so it falls back to
getCachedLlmList() instead; reference useFetchLlmList, llmList,
getModelTypeByLlmId, getCachedLlmList, and the submit handler/model_type
assignment in chat-settings.tsx when making the change.
In `@web/src/utils/llm-util.ts`:
- Around line 87-104: Extract the duplicated model-type normalization logic into
a single helper (e.g., normalizeModelType or getNormalizedModelType) and replace
the two identical blocks that compute
modelType->types->'chat'/'image2text'/fallback with calls to that helper; the
helper should accept the raw modelType (the value of model?.model_type ||
model?.type) and return the normalized string, then call it from both places
where the current logic exists (the branch handling object format and the branch
handling Array.isArray(data) with the model lookup using m.llm_name and m.fid).
🪄 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: 9cd2d51e-2554-4a52-ae1a-fff194a50294
📒 Files selected for processing (4)
web/src/pages/next-chats/chat/app-settings/chat-settings.tsxweb/src/pages/next-chats/chat/chat-box/next-multiple-chat-box.tsxweb/src/pages/next-chats/hooks/use-rename-chat.tsweb/src/utils/llm-util.ts
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #15141 +/- ##
=======================================
Coverage 93.12% 93.12%
=======================================
Files 10 10
Lines 713 713
Branches 116 116
=======================================
Hits 664 664
Misses 29 29
Partials 20 20 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
model_type is a RAGFlow-internal field stored in llm_setting (injected by the frontend since infiniflow#15141). It leaks into gen_conf which is passed verbatim to litellm, causing a 400 Bad Request from providers that reject unknown fields (e.g. Bedrock: "extraneous key [model_type] is not permitted"). Base._clean_conf already handles this implicitly via its allowlist filter. LiteLLMBase._clean_conf uses a denylist approach and was missing this key. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
model_type is a RAGFlow-internal field stored in llm_setting (injected by the frontend since infiniflow#15141). It leaks into gen_conf which is passed verbatim to litellm, causing a 400 Bad Request from providers that reject unknown fields (e.g. Bedrock: "extraneous key [model_type] is not permitted"). Base._clean_conf already handles this implicitly via its allowlist filter. LiteLLMBase._clean_conf uses a denylist approach and was missing this key. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
model_type is a RAGFlow-internal field stored in llm_setting (injected by the frontend since infiniflow#15141). It leaks into gen_conf which is passed verbatim to litellm, causing a 400 Bad Request from providers that reject unknown fields (e.g. Bedrock: "extraneous key [model_type] is not permitted"). Base._clean_conf already handles this implicitly via its allowlist filter. LiteLLMBase._clean_conf uses a denylist approach and was missing this key. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
model_type is a RAGFlow-internal field stored in llm_setting (injected by the frontend since infiniflow#15141). It leaks into gen_conf which is passed verbatim to litellm, causing a 400 Bad Request from providers that reject unknown fields (e.g. Bedrock: "extraneous key [model_type] is not permitted"). Base._clean_conf already handles this implicitly via its allowlist filter. LiteLLMBase._clean_conf uses a denylist approach and was missing this key. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
What problem does this PR solve?
Add model_type into llm_setting
Type of change