Less strict rules for logit bias files import

This commit is contained in:
Cohee 2023-08-23 03:41:58 +03:00
parent f633f62065
commit b385bd190a

View File

@ -2324,18 +2324,17 @@ async function onLogitBiasPresetImportFileChange(e) {
return;
}
const validEntries = [];
for (const entry of importedFile) {
if (typeof entry == 'object') {
if (typeof entry == 'object' && entry !== null) {
if (entry.hasOwnProperty('text') && entry.hasOwnProperty('value')) {
continue;
validEntries.push(entry);
}
}
callPopup('Invalid logit bias preset file.', 'text');
return;
}
oai_settings.bias_presets[name] = importedFile;
oai_settings.bias_presets[name] = validEntries;
oai_settings.bias_preset_selected = name;
addLogitBiasPresetOption(name);