fix: forward providerType to chat API for custom provider support#114
Open
nkmohit wants to merge 4 commits intoTHU-MAIC:mainfrom
Open
fix: forward providerType to chat API for custom provider support#114nkmohit wants to merge 4 commits intoTHU-MAIC:mainfrom
nkmohit wants to merge 4 commits intoTHU-MAIC:mainfrom
Conversation
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.
Summary
Fixes chat failures for custom LLM providers by forwarding
providerTypeandrequiresApiKeythrough the chat request path and resolving chat models with the sharedresolveModel()helper. Previously,/api/chatused an older provider resolution path and could fail withUnknown provider: custom-... Please provide providerType.for custom providers that worked elsewhere in the app.Related Issues
Fixes #116
Changes
providerTypeandrequiresApiKeytoStatelessChatRequestcomponents/chat/use-chat-sessions.tsin chat, resume, and discussion request flowsapp/api/chat/route.tsto use the sharedresolveModel()helpercustom-*providers without explicit provider metadataType of Change
Verification
Steps to reproduce / test
Unknown provider: custom-... Please provide providerType.What you personally verified
providerTypeandrequiresApiKey/api/chatnow resolves models throughresolveModel(), matching the provider-aware path used by other API routespnpm exec tsc --noEmitpnpm lint app/api/chat/route.ts components/chat/use-chat-sessions.ts lib/types/chat.tspnpm buildGET /api/healthreturned success locallyPOST /api/chatrequest with a custom provider model andproviderTypestreamed a normal SSE response instead of returning the previous 500providerTypeis omitted, confirming the fix addresses the intended bugEvidence
pnpm check && pnpm lint && npx tsc --noEmit)before:
after:

Checklist