mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
horde model selection QoL
This commit is contained in:
@@ -1732,6 +1732,7 @@
|
|||||||
<input id="horde_trusted_workers_only" type="checkbox" />
|
<input id="horde_trusted_workers_only" type="checkbox" />
|
||||||
<span data-i18n="Trusted workers only">Trusted workers only</span>
|
<span data-i18n="Trusted workers only">Trusted workers only</span>
|
||||||
</label>
|
</label>
|
||||||
|
<small id="adjustedHordeParams">Context: --, Response: --</small>
|
||||||
|
|
||||||
<h4 data-i18n="API key">API key</h4>
|
<h4 data-i18n="API key">API key</h4>
|
||||||
<small>
|
<small>
|
||||||
|
@@ -4,6 +4,8 @@ import {
|
|||||||
setGenerationProgress,
|
setGenerationProgress,
|
||||||
CLIENT_VERSION,
|
CLIENT_VERSION,
|
||||||
getRequestHeaders,
|
getRequestHeaders,
|
||||||
|
max_context,
|
||||||
|
amount_gen
|
||||||
} from "../script.js";
|
} from "../script.js";
|
||||||
import { SECRET_KEYS, writeSecret } from "./secrets.js";
|
import { SECRET_KEYS, writeSecret } from "./secrets.js";
|
||||||
import { delay } from "./utils.js";
|
import { delay } from "./utils.js";
|
||||||
@@ -57,6 +59,7 @@ function validateHordeModel() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function adjustHordeGenerationParams(max_context_length, max_length) {
|
async function adjustHordeGenerationParams(max_context_length, max_length) {
|
||||||
|
console.log(max_context_length, max_length)
|
||||||
const workers = await getWorkers();
|
const workers = await getWorkers();
|
||||||
let maxContextLength = max_context_length;
|
let maxContextLength = max_context_length;
|
||||||
let maxLength = max_length;
|
let maxLength = max_length;
|
||||||
@@ -84,7 +87,8 @@ async function adjustHordeGenerationParams(max_context_length, max_length) {
|
|||||||
maxLength = Math.min(worker.max_length, maxLength);
|
maxLength = Math.min(worker.max_length, maxLength);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
console.log(maxContextLength, maxLength)
|
||||||
|
$("#adjustedHordeParams").text(`Context: ${maxContextLength}, Response: ${maxLength}`)
|
||||||
return { maxContextLength, maxLength };
|
return { maxContextLength, maxLength };
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,11 +188,13 @@ async function getHordeModels() {
|
|||||||
$('#horde_model').empty();
|
$('#horde_model').empty();
|
||||||
const response = await fetch('https://horde.koboldai.net/api/v2/status/models?type=text', getRequestArgs());
|
const response = await fetch('https://horde.koboldai.net/api/v2/status/models?type=text', getRequestArgs());
|
||||||
models = await response.json();
|
models = await response.json();
|
||||||
|
models.sort((a, b) => {
|
||||||
|
return b.performance - a.performance;
|
||||||
|
});
|
||||||
for (const model of models) {
|
for (const model of models) {
|
||||||
const option = document.createElement('option');
|
const option = document.createElement('option');
|
||||||
option.value = model.name;
|
option.value = model.name;
|
||||||
option.innerText = `${model.name} (ETA: ${model.eta}s, Queue: ${model.queued}, Workers: ${model.count})`;
|
option.innerText = `${model.name} (ETA: ${model.eta}s, Speed: ${model.performance}, Queue: ${model.queued}, Workers: ${model.count})`;
|
||||||
option.selected = horde_settings.models.includes(model.name);
|
option.selected = horde_settings.models.includes(model.name);
|
||||||
$('#horde_model').append(option);
|
$('#horde_model').append(option);
|
||||||
}
|
}
|
||||||
@@ -238,15 +244,30 @@ jQuery(function () {
|
|||||||
|
|
||||||
// Try select instruct preset
|
// Try select instruct preset
|
||||||
autoSelectInstructPreset(horde_settings.models.join(' '));
|
autoSelectInstructPreset(horde_settings.models.join(' '));
|
||||||
|
if (horde_settings.models.length) {
|
||||||
|
adjustHordeGenerationParams(max_context, amount_gen)
|
||||||
|
} else {
|
||||||
|
$("#adjustedHordeParams").text(`Context: --, Response: --`)
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#horde_auto_adjust_response_length").on("input", function () {
|
$("#horde_auto_adjust_response_length").on("input", function () {
|
||||||
horde_settings.auto_adjust_response_length = !!$(this).prop("checked");
|
horde_settings.auto_adjust_response_length = !!$(this).prop("checked");
|
||||||
|
if (horde_settings.models.length) {
|
||||||
|
adjustHordeGenerationParams(max_context, amount_gen)
|
||||||
|
} else {
|
||||||
|
$("#adjustedHordeParams").text(`Context: --, Response: --`)
|
||||||
|
}
|
||||||
saveSettingsDebounced();
|
saveSettingsDebounced();
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#horde_auto_adjust_context_length").on("input", function () {
|
$("#horde_auto_adjust_context_length").on("input", function () {
|
||||||
horde_settings.auto_adjust_context_length = !!$(this).prop("checked");
|
horde_settings.auto_adjust_context_length = !!$(this).prop("checked");
|
||||||
|
if (horde_settings.models.length) {
|
||||||
|
adjustHordeGenerationParams(max_context, amount_gen);
|
||||||
|
} else {
|
||||||
|
$("#adjustedHordeParams").text(`Context: --, Response: --`)
|
||||||
|
}
|
||||||
saveSettingsDebounced();
|
saveSettingsDebounced();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user