feat(playground): filter model picker to providers with active credentials#10
Open
gaurav0107 wants to merge 1 commit into
Open
feat(playground): filter model picker to providers with active credentials#10gaurav0107 wants to merge 1 commit into
gaurav0107 wants to merge 1 commit into
Conversation
…tials
The playground's ModelPicker reads from a static catalog
(web/src/lib/models.ts) and never looked at the credentials configured
in /workspace/credentials. So a user with only Anthropic configured
still sees OpenAI / Gemini / Mistral / DeepSeek / Groq in the dropdown,
and picking any of those is a guaranteed dispatch failure with a
"no <provider> credential resolved" error.
Surface the configured set up front:
- web/src/app/playground/page.tsx: server-fetch
/v1/llm-credentials?workspace_id=... in parallel with the prompts +
sessions queries; project to a sorted set of distinct providers
whose revoked_at is NULL; pass that into PlaygroundComposer.
- PlaygroundComposer + ModelCard: thread the configuredProviders
array through to both ModelPicker instances (single + compare).
- ModelPicker: new optional `availableProviders?: string[]` prop.
- undefined -> show all providers (legacy behavior; judges and
elsewhere keep working unchanged)
- non-empty -> filter <optgroup>s to that set
- empty -> only the Custom escape hatch + a "No LLM
credentials configured. Add one ->" link to
/workspace/credentials
The Custom escape hatch always stays available so a model the curated
catalog hasn't picked up yet (e.g. a new Claude/Gemini preview) is one
free-text input away.
Verified locally:
- pnpm typecheck: clean
- pnpm lint: clean
- pnpm build: succeeds
Signed-off-by: Gaurav Dubey <gauravdubey0107@gmail.com>
Signed-off-by: gaurav0107 <gauravdubey0107@gmail.com>
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.
Why
The playground's ModelPicker is fed by a static catalog (
web/src/lib/models.ts) and never looks at the credentials in/workspace/credentials. So:no <provider> credential resolved) — late, confusing.<optgroup label="Other">— not discoverable.What this changes
Surface the configured set up front, keep the catalog as the discoverability layer:
/playgroundpage — server-fetch/v1/llm-credentials?workspace_id=…in parallel with prompts + sessions; project to a sorted set of distinct providers whererevoked_at IS NULL; pass intoPlaygroundComposer.PlaygroundComposer+ModelCard— thread theconfiguredProvidersarray through to both ModelPicker instances (single + compare modes).ModelPicker— new optionalavailableProviders?: string[]prop:undefined→ show all providers (legacy; judges/etc keep working unchanged)<optgroup>s to that setNo LLM credentials configured. Add one →link to/workspace/credentialsThe "Custom…" option always stays available so a model the curated catalog hasn't picked up yet is one free-text input away.
Why no new backend endpoint
The existing
GET /v1/llm-credentials?workspace_id=…already returns the rows withproviderandrevoked_at. Adding a derivative endpoint would be one more thing to maintain for no clear gain — the page just needs to know which providers have an active credential.Verified locally
pnpm typecheck— cleanpnpm lint— No ESLint warnings or errorspnpm build— succeeds (no static build regressions)Test plan
/playground:/workspace/credentials.availableProvidersso they get the legacy "show everything" behavior.🤖 Generated with Claude Code