fix: route Playground ChatTab Send to the selected endpoint (#10592) - #10913
Merged
diegosouzapw merged 1 commit intoAug 21, 2026
Merged
Conversation
… chat.completions (#10592)
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
…yground-endpoint-selector fix: route Playground ChatTab Send to the selected endpoint (diegosouzapw#10592)
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.
Closes #10592
Root cause
ChatTab.tsx(the "Send"-style chat UI in the main Playground) hardcoded everyrequest to
POST /api/v1/chat/completionsand never readconfigState.endpoint,even though
StudioConfigPane's "Endpoint" selector exposes 13 real API endpoints(
chat.completions,search,web.fetch, etc. viaENDPOINT_OPTIONS/endpointToPath()insrc/lib/playground/codeExport.ts). Search providers(
exa-search,tavily-search,serper-search) have no chat-model catalog entries,so
StudioConfigPanefalls back to a free-text model field, letting a user typeexa-search/weband hit "Send" — which still POSTed to chat.completions and 404'dwith
No active credentials for provider: exa-search, because chat credentialresolution has no notion of search-provider credentials.
Fix
ChatTab.tsxnow resolves the request path fromconfigState.endpointvia theexisting
endpointToPath()helper, and for non-chat-shaped endpoints (currentlysearchandweb.fetch) builds a query/url-based request body instead of themessages[]shape, then renders the raw (JSON-pretty-printed when possible)response instead of assuming an SSE chat-completions delta stream. The
chat.completionspath (the default/most common case) is untouched — samerequest body builder, same SSE decode loop.
New module:
src/app/(dashboard)/dashboard/playground/components/tabs/chatTabEndpointRequest.ts(kept ChatTab.tsx's diff minimal and gives the endpoint-routing logic its own
testable seam).
Regression test (TDD)
tests/unit/ui/playground-chat-tab-search-endpoint-10592.test.tsx— rendersChatTabwithconfigState.endpoint: "search", types a query, clicks Send, andasserts the captured
fetch()URL is/api/v1/search(not/api/v1/chat/completions).origin/release/v3.8.50(confirmed in the analysis pass and re-confirmedon this fresh worktree before the fix):
AssertionError: expected '/api/v1/chat/completions' to be '/api/v1/search'.npx vitest run --config vitest.config.ts tests/unit/ui/playground-chat-tab-search-endpoint-10592.test.tsx→ 1 passed.Gates run
npx vitest run --config vitest.config.ts tests/unit/ui/playground-chat-tab-search-endpoint-10592.test.tsx→ passnpm run typecheck:core→ exit 0npx eslint --suppressions-location config/quality/eslint-suppressions.json <changed files>→ cleannode scripts/check/check-file-size.mjs→ OKnode scripts/check/check-complexity.mjs→ OK (2573 violations vs baseline 2774)node scripts/check/check-cognitive-complexity.mjs→ OK (1157 violations vs baseline 1223)node scripts/check/check-changelog-integrity.mjs→ OKScope note
CompareTab.tsxhas an independent hardcodedfetch(${configState.baseUrl}/v1/chat/completions, ...)call with the same class of issue, but it's a separate component/test surface — out of scope for this fix and left for a follow-up issue rather than widening this PR's diff.