fix: prevent loop if failing ai models? (#2122)

This commit is contained in:
Daniel Salazar
2025-12-09 16:54:17 -08:00
committed by GitHub
parent 010c9b1a82
commit 8d52cefe47
@@ -424,6 +424,14 @@ export class AIChatService extends BaseService {
const fallback = this.getFallbackModel(model.id, tried, triedProviders);
tried.push(model.id);
triedProviders.push(model.provider!);
if ( tried.length >= MAX_FALLBACKS ) {
console.error('max fallbacks reached', { tried, triedProviders });
break;
}
if ( ! fallback ) {
throw new Error('no fallback model available');
}