fix: centralize AI model constants and fix invalid model names #128
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
This PR centralizes all AI model configurations into a single file and fixes critical bugs where invalid model names were being used.
Problem
The codebase had several issues:
gpt-5-miniandgpt-5.2do not exist and would cause API failuresSolution
Created
src/lib/models.tswith:CHAT_MODELS- Chat completion models (GPT-4o, GPT-4o-mini)EMBEDDING_MODELS- Text embedding models (Ada-002)TRANSCRIPTION_MODELS- Audio transcription modelsDEFAULT_MODELS- Preset configurations for common use casesChanges
src/lib/models.tssrc/app/api/AIAssistant/services/webSearchAgent.tsgpt-5-mini→gpt-4o-minisrc/app/api/AIAssistant/route.tsgpt-5.2→gpt-4osrc/app/api/predictive-document-analysis/services/analysisEngine.tsgpt-5.2→gpt-4osrc/app/api/predictive-document-analysis/services/referenceExtractor.tsgpt-5.2→gpt-4osrc/app/api/predictive-document-analysis/utils/embeddings.tssrc/app/api/uploadDocument/route.tssrc/app/api/study-agent/chat/route.tssrc/app/api/study-agent/speech-to-text/route.tsUsage Example
Benefits
Breaking Changes
None - This is a refactor with bug fixes. All existing functionality is preserved.