Repository navigation
Fix: different llm in chat - #14162
Conversation
📝 WalkthroughWalkthroughTwo functions in the dialog service were updated to change the model configuration resolution precedence: Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ❌ 3❌ Failed checks (2 warnings, 1 inconclusive)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
api/db/services/dialog_service.py (1)
244-251: Model resolution logic looks correct.The precedence change appropriately prioritizes
dialog.llm_idoverdialog.tenant_llm_id, which aligns with the bug fix intent. The truthiness checks handle empty strings andNonevalues correctly.Consider adding debug logging to trace which resolution path was taken, as this would help with troubleshooting model selection issues in production. As per coding guidelines: "Add logging for new flows."
🔧 Optional: Add debug logging
if dialog.llm_id: model_config = get_model_config_by_type_and_name(dialog.tenant_id, LLMType.CHAT, dialog.llm_id) + logging.debug("async_chat_solo: resolved model via llm_id=%s", dialog.llm_id) elif dialog.tenant_llm_id: model_config = get_model_config_by_id(dialog.tenant_llm_id) + logging.debug("async_chat_solo: resolved model via tenant_llm_id=%s", dialog.tenant_llm_id) else: model_config = get_tenant_default_model_by_type(dialog.tenant_id, LLMType.CHAT) + logging.debug("async_chat_solo: resolved model via tenant default for tenant_id=%s", dialog.tenant_id)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@api/db/services/dialog_service.py` around lines 244 - 251, Add debug logging to trace which model resolution path is taken: when dialog.llm_id is used call out that get_model_config_by_type_and_name was selected for dialog.llm_id, when dialog.tenant_llm_id is used log that get_model_config_by_id was selected for dialog.tenant_llm_id, and when falling back log that get_tenant_default_model_by_type was selected; include the dialog.tenant_id and the resolved model identifier (or None) in the log messages to aid troubleshooting, and place these logs immediately around the existing resolution logic that calls get_model_config_by_type_and_name, get_model_config_by_id, and get_tenant_default_model_by_type.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@api/db/services/dialog_service.py`:
- Around line 244-251: Add debug logging to trace which model resolution path is
taken: when dialog.llm_id is used call out that
get_model_config_by_type_and_name was selected for dialog.llm_id, when
dialog.tenant_llm_id is used log that get_model_config_by_id was selected for
dialog.tenant_llm_id, and when falling back log that
get_tenant_default_model_by_type was selected; include the dialog.tenant_id and
the resolved model identifier (or None) in the log messages to aid
troubleshooting, and place these logs immediately around the existing resolution
logic that calls get_model_config_by_type_and_name, get_model_config_by_id, and
get_tenant_default_model_by_type.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 910dc1f5-90df-4ef7-b482-a4bb06b4d038
📒 Files selected for processing (1)
api/db/services/dialog_service.py
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #14162 +/- ##
=======================================
Coverage 96.66% 96.66%
=======================================
Files 10 10
Lines 690 690
Branches 108 108
=======================================
Hits 667 667
Misses 8 8
Partials 15 15 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
### What problem does this PR solve? Fix: different llm in chat ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
What problem does this PR solve?
Fix: different llm in chat
Type of change