mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Fix oobabooga
This commit is contained in:
@ -1028,7 +1028,7 @@ function getStoppingStrings(isImpersonate, addSpace) {
|
||||
const charString = `\n${name2}:`;
|
||||
const userString = is_pygmalion ? `\nYou:` : `\n${name1}:`;
|
||||
const result = isImpersonate ? charString : userString;
|
||||
return addSpace ? `${result} ` : result;
|
||||
return [addSpace ? `${result} ` : result];
|
||||
}
|
||||
|
||||
function getSlashCommand(message, type) {
|
||||
@ -1879,7 +1879,7 @@ async function Generate(type, automatic_trigger, force_name2) {
|
||||
'early_stopping': textgenerationwebui_settings.early_stopping,
|
||||
'seed': textgenerationwebui_settings.seed,
|
||||
'add_bos_token': textgenerationwebui_settings.add_bos_token,
|
||||
'custom_stopping_strings': JSON.stringify(getStoppingStrings(isImpersonate, false)),
|
||||
'stopping_strings': getStoppingStrings(isImpersonate, false),
|
||||
'truncation_length': max_context,
|
||||
'ban_eos_token': textgenerationwebui_settings.ban_eos_token,
|
||||
'skip_special_tokens': textgenerationwebui_settings.skip_special_tokens,
|
||||
@ -2177,8 +2177,9 @@ function cleanUpMessage(getMessage, isImpersonate) {
|
||||
getMessage = getMessage.trim();
|
||||
}
|
||||
|
||||
const stoppingString = getStoppingStrings(isImpersonate, false);
|
||||
const stoppingStrings = getStoppingStrings(isImpersonate, false);
|
||||
|
||||
for (const stoppingString of stoppingStrings) {
|
||||
if (stoppingString.length) {
|
||||
for (let j = stoppingString.length - 1; j > 0; j--) {
|
||||
if (getMessage.slice(-j) === stoppingString.slice(0, j)) {
|
||||
@ -2187,6 +2188,7 @@ function cleanUpMessage(getMessage, isImpersonate) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return getMessage;
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ function getKoboldGenerationData(finalPromt, this_settings, this_amount_gen, thi
|
||||
s7: this_settings.sampler_order[6],
|
||||
use_world_info: false,
|
||||
singleline: kai_settings.single_line,
|
||||
stop_sequence: kai_settings.use_stop_sequence ? [getStoppingStrings(isImpersonate, false)] : undefined,
|
||||
stop_sequence: kai_settings.use_stop_sequence ? getStoppingStrings(isImpersonate, false) : undefined,
|
||||
};
|
||||
return generate_data;
|
||||
}
|
||||
|
@ -26,11 +26,11 @@ let textgenerationwebui_settings = {
|
||||
seed: -1,
|
||||
preset: 'Default',
|
||||
add_bos_token: true,
|
||||
custom_stopping_strings: [],
|
||||
stopping_strings: [],
|
||||
truncation_length: 2048,
|
||||
ban_eos_token: false,
|
||||
streaming: false,
|
||||
fn_index: 34,
|
||||
fn_index: 43,
|
||||
skip_special_tokens: true,
|
||||
};
|
||||
|
||||
|
@ -424,7 +424,7 @@ app.post("/generate_textgenerationwebui", jsonParser, async function (request, r
|
||||
|
||||
let result = JSON.parse(request.body.data)[0];
|
||||
let prompt = result;
|
||||
let stopping_strings = JSON.parse(request.body.data)[1].custom_stopping_strings;
|
||||
let stopping_strings = JSON.parse(request.body.data)[1].stopping_strings;
|
||||
|
||||
try {
|
||||
for await (const text of readWebsocket()) {
|
||||
|
Reference in New Issue
Block a user