feat(api): add configurable AI models and improve error messaging - #8
Open
nandes007 wants to merge 1 commit into
Open
feat(api): add configurable AI models and improve error messaging#8nandes007 wants to merge 1 commit into
nandes007 wants to merge 1 commit into
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.
Description of Changes
1. Root Cause / Problem Addressed
groqClientused hardcoded models andgeminiClienthad a hardcoded endpoint (gemini-2.5-flash). When model availability changes or when models are deprecated/inaccessible on a user tier, requests fail with404 Not Found.error.message(which outputs generic strings likeRequest failed with status code 404), completely discarding the detailed error payload from Groq/Gemini (error.response.data.error.message).2. Summary of Adjustments
GROQ_MODEL(defaults toopenai/gpt-oss-120b) andGEMINI_MODEL(defaults togemini-3.6-flash) insrc/config.ts.malas setConfig <KEY> <VALUE>, environment variables (GROQ_MODEL,GEMINI_MODEL), and CLI flags (-m, --model) onmalas,malas generate, andmalas pr.groqClient.tsandgeminiClient.tsusingaxios.isAxiosErrorto extract the actual API error message.401(invalid API key),404(model not found/deprecated with command suggestions), and429(rate limit/quota exceeded).aiClient.tsandcommitService.ts.tests/aiClients.test.tsto test client error handling, status code mappings, and model parameters.tests/commitService.test.tsto align with the current prompt and test model propagation.Related Issues
N/A
Type of Change
Testing Information
npm test(11/11 tests passing across 2 test suites).npm run build(TypeScript compilation and import extension fixes).