fix: fallback behavior related to fake-chat service

Fallbacks from or to the fake-chat service should not be allowed.
Fallbacks to the "costly" model from fake-chat could result in
unintended charges and fallbacks to real models from fake-chat could
result in service abuse.
This commit is contained in:
KernelDeimos
2025-05-05 16:10:52 -04:00
parent 34787bbb0c
commit 9bf48e7289

View File

@@ -474,6 +474,11 @@ class AIChatService extends BaseService {
error: e,
});
while ( !! error ) {
// No fallbacks for pseudo-models
if ( intended_service === 'fake-chat' ) {
break;
}
const fallback = this.get_fallback_model({
model, tried,
});
@@ -845,6 +850,7 @@ class AIChatService extends BaseService {
for ( const model of sorted_models ) {
if ( tried.includes(model.id) ) continue;
if ( model.provider === 'fake-chat' ) continue;
return {
fallback_service_name: model.provider,