Repository navigation
feat(model-selector): add region selection feature to model entries - #2751
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughAdds regional model variant support to the playground. ChangesRegion Selection Feature
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
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. ✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@apps/playground/src/components/model-selector.tsx`:
- Around line 960-962: The code filters out regional mappings from allEntries by
skipping entries with mp.region at lines 960-962, but the selection and preview
state matching logic still uses region-qualified values like
provider/model:region. Normalize the selected-entry matching throughout the
component wherever allEntries is used for highlighting or preview to work at the
provider level only, removing the region portion from the active value before
comparison, so it matches the provider-only entries that remain in the filtered
allEntries list.
🪄 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: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 824a43cb-fae1-4df4-9625-12f59e906928
📒 Files selected for processing (3)
apps/playground/src/components/model-selector.tsxapps/playground/src/components/playground/chat-page-client.tsxapps/playground/src/components/playground/chat-ui.tsx
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/playground/src/components/playground/chat-page-client.tsx (1)
2487-2493:⚠️ Potential issue | 🟠 Major | ⚡ Quick winRegion changes can bypass video/audio model gating in
ExtraChatPanel.Line 2492 now passes
provider/model:regionintohandleModelChange, buthandleModelChangeparses model id withmodel.split("/")[1]and never removes:region. That makesmodels.find(...)miss on regional values, so video/audio reroute checks are skipped on region updates.Proposed fix
- const handleModelChange = useCallback( - (model: string) => { - const modelId = model.includes("/") - ? (model.split("/")[1] ?? model) - : model; + const handleModelChange = useCallback( + (model: string) => { + const { modelId } = parseModelSelectorValue(model); const def = models.find((m) => m.id === modelId); if (def?.output?.includes("video")) { onVideoModelSelected?.(modelId); return; }🤖 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 `@apps/playground/src/components/playground/chat-page-client.tsx` around lines 2487 - 2493, The handlePanelRegionChange function constructs a string with the region appended as `provider/model:region` and passes it to handleModelChange, but handleModelChange does not strip the `:region` suffix when parsing the model ID, causing models.find() lookups to fail and skip video/audio gating checks. Modify handlePanelRegionChange to either pass only the base model identifier `provider/model` to handleModelChange without the region suffix, or ensure the region is handled separately from the model ID so that handleModelChange can correctly match against the models array without the regional suffix interfering with the lookup.
🤖 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 `@apps/playground/src/components/ui/button-group.tsx`:
- Line 2: Update the import statement in button-group.tsx to import Slot from
"`@radix-ui/react-slot`" instead of "radix-ui" to match the established pattern
used throughout the codebase. Additionally, locate where Slot.Root is being used
(around line 47) and replace it with Slot directly, as Slot.Root is not the
correct API and the Slot component should be used as a direct JSX element.
---
Outside diff comments:
In `@apps/playground/src/components/playground/chat-page-client.tsx`:
- Around line 2487-2493: The handlePanelRegionChange function constructs a
string with the region appended as `provider/model:region` and passes it to
handleModelChange, but handleModelChange does not strip the `:region` suffix
when parsing the model ID, causing models.find() lookups to fail and skip
video/audio gating checks. Modify handlePanelRegionChange to either pass only
the base model identifier `provider/model` to handleModelChange without the
region suffix, or ensure the region is handled separately from the model ID so
that handleModelChange can correctly match against the models array without the
regional suffix interfering with the lookup.
🪄 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: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 5541ce14-55b2-4df3-9b3e-79af885d296b
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (7)
apps/playground/package.jsonapps/playground/src/components/model-selector.tsxapps/playground/src/components/playground/chat-header.tsxapps/playground/src/components/playground/chat-page-client.tsxapps/playground/src/components/playground/group-chat-client.tsxapps/playground/src/components/playground/region-selector.tsxapps/playground/src/components/ui/button-group.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
- apps/playground/src/components/model-selector.tsx
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@apps/playground/src/components/playground/chat-ui.tsx`:
- Around line 1723-1727: The SelectTrigger components render only icons on small
screens since the text content is hidden with sm:contents, creating unnamed
controls for assistive technology. Add an aria-label attribute to both
SelectTrigger components mentioned in the review (the one with MapPin icon at
lines 1723-1727 and the other trigger at lines 1751-1755) to provide descriptive
accessible names that screen readers can announce, even when the visual text is
hidden on mobile views.
🪄 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: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 16dbfcb8-82ca-4f8e-be41-abcb5eda858c
📒 Files selected for processing (3)
apps/playground/src/components/playground/chat-header.tsxapps/playground/src/components/playground/chat-page-client.tsxapps/playground/src/components/playground/chat-ui.tsx
✅ Files skipped from review due to trivial changes (1)
- apps/playground/src/components/playground/chat-header.tsx
- Removed region display from disabled model entries. - Implemented region filtering for model mappings in the ModelSelector component. - Added UI elements to display available regions for selected models in both the ChatPageClient and ExtraChatPanel components. - Enhanced ChatUI to allow users to select a region from available options. This update improves user experience by providing clearer region options for model selection.
d5ac6d3 to
8e25c6f
Compare
This update improves user experience by providing clearer region options for model selection.
Summary by CodeRabbit