Add openrouter sub-provider (endpoint tag) selection for CompanyBot, … - #20
Conversation
…wired into gateway routing via provider_options
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThe PR adds gateway provider, model, and sub-provider fields. Admin forms load gateway choices dynamically. Gateway requests and title generation use centralized effective provider and model resolution. ChangesGateway configuration
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant BaseResponseHandler
participant get_effective_provider_model
participant call_llm_gateway
BaseResponseHandler->>get_effective_provider_model: Resolve provider and model
get_effective_provider_model-->>BaseResponseHandler: Return effective values
BaseResponseHandler->>call_llm_gateway: Submit gateway request
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
chatbot/celery_tasks/title_tasks.py (1)
79-79: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse the Ruff-recommended message unpacking.
Ruff RUF005 flags list concatenation here. Replace it with unpacking while preserving message order.
Proposed fix
- messages=[system_msg] + list(messages), + messages=[system_msg, *list(messages)],🤖 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 `@chatbot/celery_tasks/title_tasks.py` at line 79, Update the messages construction in the task containing the messages argument to use Ruff-recommended iterable unpacking instead of list concatenation, while preserving system_msg as the first message and retaining all existing messages in order.Source: Linters/SAST tools
🤖 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 `@chatbot/llm_models/llm_gateway.py`:
- Around line 47-56: Update get_effective_provider_model to fall back to
company_bot.provider and company_bot.llm_model when gateway_provider or
gateway_model is not configured, while preserving other_params.custom_model as
the model override. Alternatively, add a migration that backfills
gateway_provider and gateway_model for every existing bot before this function
is used; ensure both interactive and title-generation calls receive routable
provider/model values.
In `@chatbot/models/company_models.py`:
- Around line 196-204: Update CompanyBot.save so any fields cleared when
gateway_provider or gateway_model changes are added to kwargs["update_fields"]
before calling super().save; preserve all other requested fields and handle
update_fields only when it is provided.
In `@chatbot/services/response_handlers/base_response_handler.py`:
- Around line 574-576: Ensure gateway_provider and gateway_model are populated
from legacy provider and llm_model values, or reject incomplete configurations
before routing. Apply the fix to all affected calls: base_response_handler.py
lines 574-576 and 684-686, and title_tasks.py lines 76-80; update the shared
get_effective_provider_model path or each caller so non-streaming, streaming,
and title requests never pass null routing values.
---
Nitpick comments:
In `@chatbot/celery_tasks/title_tasks.py`:
- Line 79: Update the messages construction in the task containing the messages
argument to use Ruff-recommended iterable unpacking instead of list
concatenation, while preserving system_msg as the first message and retaining
all existing messages in order.
🪄 Autofix
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: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 6df37b4d-10eb-4855-8b6e-d7fa035f07d5
📒 Files selected for processing (6)
chatbot/admin/company_admin.pychatbot/celery_tasks/title_tasks.pychatbot/llm_models/llm_gateway.pychatbot/migrations/0090_add_companybot_gateway_provider_model.pychatbot/models/company_models.pychatbot/services/response_handlers/base_response_handler.py
0a03725
into
ELEVATE-Project:release-1.3.0
…wired into gateway routing via provider_options
Summary by CodeRabbit
New Features
Bug Fixes