realtime 2.1 support - #142
Conversation
📝 WalkthroughWalkthroughAdds ChangesRealtime model support
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
|
OSSF Scorecard (PR vs base)
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
lib/realtimeModelPreference.ts (1)
33-36: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider deriving
isRealtimeModelfromREALTIME_MODEL_OPTIONSto avoid duplication.The model ID
"gpt-realtime-2.1"now appears in theRealtimeModeltype, theREALTIME_MODEL_OPTIONSarray, and theisRealtimeModeltype guard — all manually synchronized. If a future model is added to the type or options but the type guard is missed,loadRealtimeModelPreferencewill silently fall back to the default for that model. Deriving the check from the options array eliminates this risk.♻️ Proposed refactor
-const isRealtimeModel = (value: string): value is RealtimeModel => - value === "gpt-realtime" || - value === "gpt-realtime-2" || - value === "gpt-realtime-2.1"; +const VALID_MODELS = REALTIME_MODEL_OPTIONS.map((o) => o.value) as readonly string[]; +const isRealtimeModel = (value: string): value is RealtimeModel => + (VALID_MODELS as readonly string[]).includes(value);🤖 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 `@lib/realtimeModelPreference.ts` around lines 33 - 36, Update isRealtimeModel to derive membership from REALTIME_MODEL_OPTIONS instead of manually listing model IDs, ensuring the type guard stays synchronized with the available realtime model options and loadRealtimeModelPreference accepts newly added models.
🤖 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 `@lib/realtimeModelPreference.ts`:
- Around line 33-36: Update isRealtimeModel to derive membership from
REALTIME_MODEL_OPTIONS instead of manually listing model IDs, ensuring the type
guard stays synchronized with the available realtime model options and
loadRealtimeModelPreference accepts newly added models.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 86890309-3a64-4332-a87c-631140a05365
📒 Files selected for processing (2)
lib/realtimeModelPreference.tslib/tokenUsageTracker.ts
Summary by CodeRabbit