mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Merge branch 'staging' into feat/xtc
This commit is contained in:
@ -95,7 +95,7 @@ let DREAMGEN_SERVER = 'https://dreamgen.com';
|
||||
let OPENROUTER_SERVER = 'https://openrouter.ai/api';
|
||||
let FEATHERLESS_SERVER = 'https://api.featherless.ai/v1';
|
||||
|
||||
const SERVER_INPUTS = {
|
||||
export const SERVER_INPUTS = {
|
||||
[textgen_types.OOBA]: '#textgenerationwebui_api_url_text',
|
||||
[textgen_types.VLLM]: '#vllm_api_url_text',
|
||||
[textgen_types.APHRODITE]: '#aphrodite_api_url_text',
|
||||
@ -1071,6 +1071,34 @@ function getLogprobsNumber() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces {{macro}} in a comma-separated or serialized JSON array string.
|
||||
* @param {string} str Input string
|
||||
* @returns {string} Output string
|
||||
*/
|
||||
function replaceMacrosInList(str) {
|
||||
if (!str || typeof str !== 'string') {
|
||||
return str;
|
||||
}
|
||||
|
||||
try {
|
||||
const array = JSON.parse(str);
|
||||
if (!Array.isArray(array)) {
|
||||
throw new Error('Not an array');
|
||||
}
|
||||
for (let i = 0; i < array.length; i++) {
|
||||
array[i] = substituteParams(array[i]);
|
||||
}
|
||||
return JSON.stringify(array);
|
||||
} catch {
|
||||
const array = str.split(',');
|
||||
for (let i = 0; i < array.length; i++) {
|
||||
array[i] = substituteParams(array[i]);
|
||||
}
|
||||
return array.join(',');
|
||||
}
|
||||
}
|
||||
|
||||
export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate, isContinue, cfgValues, type) {
|
||||
const canMultiSwipe = !isContinue && !isImpersonate && type !== 'quiet';
|
||||
const dynatemp = isDynamicTemperatureSupported();
|
||||
@ -1110,7 +1138,7 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate,
|
||||
'dry_allowed_length': settings.dry_allowed_length,
|
||||
'dry_multiplier': settings.dry_multiplier,
|
||||
'dry_base': settings.dry_base,
|
||||
'dry_sequence_breakers': settings.dry_sequence_breakers,
|
||||
'dry_sequence_breakers': replaceMacrosInList(settings.dry_sequence_breakers),
|
||||
'dry_penalty_last_n': settings.dry_penalty_last_n,
|
||||
'max_tokens_second': settings.max_tokens_second,
|
||||
'sampler_priority': settings.type === OOBA ? settings.sampler_priority : undefined,
|
||||
|
Reference in New Issue
Block a user