mirror of
https://github.com/HeyPuter/puter.git
synced 2026-02-19 21:21:23 -06:00
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user