Compare commits

...
4 Commits
Author SHA1 Message Date
SillyLossy 77f76ae315 Fix group chats streaming 2023-06-01 18:55:04 +03:00
SillyLossy c3af38f5b8 Bump package version 2023-06-01 18:34:39 +03:00
SillyLossy 3cf23f277c Fix group reply generation with streaming 2023-06-01 18:31:30 +03:00
SillyLossy a74828df15 Disable instruct mode for OpenAI 2023-06-01 15:20:30 +03:00
4 changed files with 22 additions and 13 deletions
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "sillytavern",
"version": "1.6.4",
"version": "1.6.5",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sillytavern",
"version": "1.6.4",
"version": "1.6.5",
"license": "AGPL-3.0",
"dependencies": {
"@dqbd/tiktoken": "^1.0.2",
+1 -1
View File
@@ -46,7 +46,7 @@
"type": "git",
"url": "https://github.com/Cohee1207/SillyTavern.git"
},
"version": "1.6.4",
"version": "1.6.5",
"scripts": {
"start": "node server.js",
"pkg": "pkg --compress Gzip --no-bytecode --public ."
+10 -9
View File
@@ -1764,8 +1764,9 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
abortController = new AbortController();
}
// OpenAI doesn't need instruct mode. Use OAI main prompt instead.
const isInstruct = power_user.instruct.enabled && main_api !== 'openai';
const isImpersonate = type == "impersonate";
const isInstruct = power_user.instruct.enabled;
message_already_generated = isImpersonate ? `${name1}: ` : `${name2}: `;
// Name for the multigen prefix
@@ -2031,7 +2032,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
let mesSend = [];
console.log('calling runGenerate');
streamingProcessor = isStreamingEnabled() ? new StreamingProcessor(type, force_name2) : false;
await runGenerate();
runGenerate();
async function runGenerate(cycleGenerationPromt = '') {
is_send_press = true;
@@ -2385,7 +2386,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
$('#send_textarea').val(extract.getMessage).trigger('input');
}
if (shouldContinueMultigen(getMessage, isImpersonate)) {
if (shouldContinueMultigen(getMessage, isImpersonate, isInstruct)) {
hideSwipeButtons();
tokens_already_generated += this_amount_gen; // add new gen amt to any prev gen counter..
getMessage = message_already_generated;
@@ -3024,8 +3025,8 @@ function getGenerateUrl() {
return generate_url;
}
function shouldContinueMultigen(getMessage, isImpersonate) {
if (power_user.instruct.enabled && power_user.instruct.stop_sequence) {
function shouldContinueMultigen(getMessage, isImpersonate, isInstruct) {
if (isInstruct && power_user.instruct.stop_sequence) {
if (message_already_generated.indexOf(power_user.instruct.stop_sequence) !== -1) {
return false;
}
@@ -3151,17 +3152,17 @@ function cleanUpMessage(getMessage, isImpersonate, displayIncompleteSentences =
}
if (getMessage.indexOf('<|endoftext|>') != -1) {
getMessage = getMessage.substr(0, getMessage.indexOf('<|endoftext|>'));
}
if (power_user.instruct.enabled && power_user.instruct.stop_sequence) {
const isInstruct = power_user.instruct.enabled && main_api !== 'openai';
if (isInstruct && power_user.instruct.stop_sequence) {
if (getMessage.indexOf(power_user.instruct.stop_sequence) != -1) {
getMessage = getMessage.substring(0, getMessage.indexOf(power_user.instruct.stop_sequence));
}
}
if (power_user.instruct.enabled && power_user.instruct.input_sequence && isImpersonate) {
if (isInstruct && power_user.instruct.input_sequence && isImpersonate) {
getMessage = getMessage.replaceAll(power_user.instruct.input_sequence, '');
}
if (power_user.instruct.enabled && power_user.instruct.output_sequence && !isImpersonate) {
if (isInstruct && power_user.instruct.output_sequence && !isImpersonate) {
getMessage = getMessage.replaceAll(power_user.instruct.output_sequence, '');
}
// clean-up group message from excessive generations
+9 -1
View File
@@ -512,7 +512,7 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) {
setCharacterId(chId);
setCharacterName(characters[chId].name)
Generate(generateType, { automatic_trigger: by_auto_mode, ...(params || {}) });
await Generate(generateType, { automatic_trigger: by_auto_mode, ...(params || {}) });
if (type !== "swipe" && type !== "impersonate" && !isMultigenEnabled() && !isStreamingEnabled()) {
// update indicator and scroll down
@@ -602,6 +602,14 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) {
await delay(100);
}
}
else if (isStreamingEnabled()) {
if (streamingProcessor && !streamingProcessor.isFinished) {
await delay(100);
} else {
messagesBefore++;
break;
}
}
else {
messagesBefore++;
break;