Skip to content

Commit f481f77

Browse files
committed
fix: auto-migrate deprecated AI models (gemini-1.5-flash to gemini-2.5-flash)
1 parent 15a1a71 commit f481f77

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

backend/simpatico-ats.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,17 @@ async function getCompanyAIConfig(env, tenantId) {
567567
/**
568568
* Resolves the correct base URL and model for a given provider config.
569569
*/
570+
// Deprecated / sunset models → working replacements
571+
const DEPRECATED_MODELS = {
572+
"gemini-1.5-flash": "gemini-2.5-flash",
573+
"gemini-1.5-pro": "gemini-2.5-pro",
574+
"gemini-1.0-pro": "gemini-2.5-flash",
575+
"gemini-pro": "gemini-2.5-flash",
576+
"gpt-4-turbo-preview": "gpt-4o-mini",
577+
"gpt-3.5-turbo": "gpt-4o-mini",
578+
"claude-instant-1.2": "claude-3-haiku-20240307",
579+
};
580+
570581
function resolveProviderDefaults(cfg) {
571582
// Normalize provider names (handle aliases)
572583
let p = cfg.provider;
@@ -575,6 +586,12 @@ function resolveProviderDefaults(cfg) {
575586
let baseUrl = cfg.baseUrl;
576587
let model = cfg.model;
577588

589+
// Auto-migrate deprecated model names to current equivalents
590+
if (model && DEPRECATED_MODELS[model]) {
591+
console.log(`[BYOK] Auto-migrating deprecated model: ${model}${DEPRECATED_MODELS[model]}`);
592+
model = DEPRECATED_MODELS[model];
593+
}
594+
578595
if (p === "openai") {
579596
baseUrl = baseUrl || "https://api.openai.com/v1";
580597
model = model || "gpt-4o-mini";

0 commit comments

Comments
 (0)