mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Merge branch 'staging' into featherless-models
This commit is contained in:
@ -68,6 +68,10 @@ const LLAMACPP_DEFAULT_ORDER = [
|
||||
'temperature',
|
||||
];
|
||||
const OOBA_DEFAULT_ORDER = [
|
||||
'repetition_penalty',
|
||||
'presence_penalty',
|
||||
'frequency_penalty',
|
||||
'dry',
|
||||
'temperature',
|
||||
'dynamic_temperature',
|
||||
'quadratic_sampling',
|
||||
@ -80,6 +84,9 @@ const OOBA_DEFAULT_ORDER = [
|
||||
'top_a',
|
||||
'min_p',
|
||||
'mirostat',
|
||||
'xtc',
|
||||
'encoder_repetition_penalty',
|
||||
'no_repeat_ngram',
|
||||
];
|
||||
const BIAS_KEY = '#textgenerationwebui_api-settings';
|
||||
|
||||
@ -799,6 +806,25 @@ function showTypeSpecificControls(type) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts missing items from the source array into the target array.
|
||||
* @param {any[]} source - Source array
|
||||
* @param {any[]} target - Target array
|
||||
* @returns {void}
|
||||
*/
|
||||
function insertMissingArrayItems(source, target) {
|
||||
if (source === target || !Array.isArray(source) || !Array.isArray(target)) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const item of source) {
|
||||
if (!target.includes(item)) {
|
||||
const index = source.indexOf(item);
|
||||
target.splice(index, 0, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function setSettingByName(setting, value, trigger) {
|
||||
if (value === null || value === undefined) {
|
||||
return;
|
||||
@ -813,6 +839,7 @@ function setSettingByName(setting, value, trigger) {
|
||||
|
||||
if ('sampler_priority' === setting) {
|
||||
value = Array.isArray(value) ? value : OOBA_DEFAULT_ORDER;
|
||||
insertMissingArrayItems(OOBA_DEFAULT_ORDER, value);
|
||||
sortOobaItemsByOrder(value);
|
||||
settings.sampler_priority = value;
|
||||
return;
|
||||
@ -890,6 +917,7 @@ async function generateTextGenWithStreaming(generate_data, signal) {
|
||||
/** @type {import('./logprobs.js').TokenLogprobs | null} */
|
||||
let logprobs = null;
|
||||
const swipes = [];
|
||||
const toolCalls = [];
|
||||
while (true) {
|
||||
const { done, value } = await reader.read();
|
||||
if (done) return;
|
||||
@ -908,7 +936,7 @@ async function generateTextGenWithStreaming(generate_data, signal) {
|
||||
logprobs = parseTextgenLogprobs(newText, data.choices?.[0]?.logprobs || data?.completion_probabilities);
|
||||
}
|
||||
|
||||
yield { text, swipes, logprobs };
|
||||
yield { text, swipes, logprobs, toolCalls };
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user