Repository navigation
fix: unable to use multi model chat - #17097
Conversation
📝 WalkthroughWalkthroughChatSessionService now resolves tenant model configuration through an injectable model provider service. Tests add a fake resolver and verify explicit model IDs are passed to it and stored on the dialog. ChangesChat model resolution
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
internal/service/chat_session.go (1)
1946-1950: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRemove the defensive fallback to concrete implementation.
Adding a fallback to
NewModelProviderService()when the resolver is nil defeats the purpose of dependency injection and couples this method to a concrete implementation. This pattern is often a workaround to accommodate incomplete test setups (where tests instantiate&ChatSessionService{}without supplying a mock).Please consider relying directly on the injected
s.modelProviderSvc. Any existing tests that fail as a result (such asTestChatCompletionsStreamFinalCarriesDecoratedReferencein the test file) should be updated to inject a fake resolver instead.♻️ Proposed refactor
- resolver := s.modelProviderSvc - if resolver == nil { - resolver = NewModelProviderService() - } - _, _, _, _, err := resolver.GetChatModelConfig(tenantID, modelName) + _, _, _, _, err := s.modelProviderSvc.GetChatModelConfig(tenantID, modelName)🤖 Prompt for 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. In `@internal/service/chat_session.go` around lines 1946 - 1950, Remove the nil fallback and call GetChatModelConfig directly through the injected s.modelProviderSvc in the surrounding chat-session logic. Update affected tests, including TestChatCompletionsStreamFinalCarriesDecoratedReference, to provide a fake resolver through modelProviderSvc rather than relying on a concrete default.
🤖 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.
Nitpick comments:
In `@internal/service/chat_session.go`:
- Around line 1946-1950: Remove the nil fallback and call GetChatModelConfig
directly through the injected s.modelProviderSvc in the surrounding chat-session
logic. Update affected tests, including
TestChatCompletionsStreamFinalCarriesDecoratedReference, to provide a fake
resolver through modelProviderSvc rather than relying on a concrete default.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f2ad4fd1-7a3e-4abb-b79e-9a05f7c578f4
📒 Files selected for processing (2)
internal/service/chat_session.gointernal/service/chat_session_test.go
Summary
As title