Skip to content

Commit

Permalink
autopick a model when on horde mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Concedo authored and Concedo committed Dec 8, 2023
1 parent 2f1704a commit d30bb5a
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3532,6 +3532,7 @@
}

console.log("Init started");
let loadok = false;
try {
let loadedsettingsjson = localStorage.getItem(STORAGE_PREFIX + "settings");
let loadedstorycompressed = localStorage.getItem(STORAGE_PREFIX + "story");
Expand All @@ -3558,12 +3559,41 @@
//toggle persistence off to prevent it from turning on again
localsettings.persist_session = false;
}
loadok = true;
} else {
console.log("Skipped missing local save");
loadok = false;
}

} catch (e) {
console.log("Discarded invalid local save: " + e);
loadok = false;
}


if(!loadok && !localflag && selected_models.length==0 && !is_using_custom_ep()) //nothing was loaded. this is a brand new state, in web lite
{
console.log("Autopick some good default models...");
//attempt to autopick some good default models
fetch_models((mdls) => {
//can we find the model that's used? if yes load it, otherwise load the first one
if (mdls.length > 0)
{
for (var i = 0; i < mdls.length; ++i) {
for (var j = 0; j < defaultmodels.length; ++j) {
if (mdls[i].name.trim().toLowerCase().includes(defaultmodels[j].trim().toLowerCase()) ||
defaultmodels[j].trim().toLowerCase().includes(mdls[i].name.trim().toLowerCase())) {
selected_models.push(mdls[i]);
}
}
}
if (selected_models.length == 0) //no matching models, just assign one
{
selected_models.push(mdls[0]);
}
render_gametext();
}
});
}

const tokenstreaming = urlParams.get('streaming');
Expand Down

0 comments on commit d30bb5a

Please sign in to comment.