Repository navigation
feat(playground): API endpoint dropdown and deployment-provided models - #231
Open
ilay-decart wants to merge 1 commit into
Open
ilay-decart wants to merge 1 commit into
ilay-decart wants to merge 1 commit into
Conversation
The example page reads optional presets from its environment:
VITE_REALTIME_BASE_URLS (JSON [{label, url, note?}]) adds an "API endpoint"
dropdown that fills the Realtime Base URL field, and VITE_EXTRA_REALTIME_MODELS
(comma-separated) lists server-side models this SDK build does not know, which
connect like "Custom model". Without them the page is unchanged.
A bare host in the base URL field is read as wss://<host> instead of failing
with "Invalid base URL", and picking an endpoint re-mints an ephemeral/JWT
credential through it.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
commit: |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 661378b. Configure here.
| return isCustomModelSelected() ? buildCustomModel() : models.realtime(elements.modelSelect.value); | ||
| const value = elements.modelSelect.value; | ||
| if (value === CUSTOM_MODEL_OPTION) return buildCustomModel(); | ||
| if (value.startsWith(EXTRA_MODEL_PREFIX)) return buildCustomModel(value.slice(EXTRA_MODEL_PREFIX.length)); |
There was a problem hiding this comment.
Extra models inherit leftover dimensions
Low Severity
Deployment extra models reuse buildCustomModel, so they take width and height from the hidden custom-model fields. After a custom-model attempt, those leftover values apply silently to the extra model and the user cannot see or change them.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 661378b. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Description
The example page (
packages/sdk/index.html, whichpnpm dev:exampleserves) gets an API endpoint dropdown and a slot for server-side models, both filled from the environment so the page never hardcodes hosts:VITE_REALTIME_BASE_URLS: a JSON array of{label, url, note?}. It shows the dropdown above the Realtime Base URL field.VITE_EXTRA_REALTIME_MODELS: comma-separated model names this SDK build does not list. They appear under "This deployment" and connect like "Custom model", by name.Two fixes to the base URL field:
api.example.com) is read aswss://api.example.com. Before, it failed withInvalid base URLbefore any request.Hosts come from the environment because a deployment that serves this page (Decart's staging) rewrites production hostnames in the checkout at build time and fails the build if any remain.
Testing
Ran
vite devlocally, with and without the variables, and drove the page with Playwright against production endpoints:lucy-2.6both reached "Generating" with 1280×720 output.pnpm lintandpnpm format:checkare clean.Note
Low Risk
Demo-page-only UI and env-driven configuration; no SDK library API changes and default behavior is unchanged when env vars are unset.
Overview
The SDK demo page (
packages/sdk/index.html) can now be configured at build time for non-production deployments without hardcoding hosts.When
VITE_REALTIME_BASE_URLSis set, an API endpoint dropdown appears (hidden otherwise). It lists JSON presets (label,url, optionalnote), syncs with the existing Realtime Base URL field, and re-mints ephemeral/JWT credentials when the endpoint changes. WhenVITE_EXTRA_REALTIME_MODELSis set, those names show under a “This deployment” model group and connect like custom models (by name, not viamodels.realtime()).Base URL handling is centralized in
readRealtimeBaseUrl(): bare hosts getwss://so the SDK no longer fails on “Invalid base URL,” and connect/mint/files paths use that helper instead of raw input trimming.Reviewed by Cursor Bugbot for commit 661378b. Bugbot is set up for automated code reviews on this repo. Configure here.