From caa985590bc9a425b1d65cb319e3f00a354b5aa9 Mon Sep 17 00:00:00 2001 From: Cohee Date: Wed, 7 Jun 2023 23:08:20 +0300 Subject: [PATCH 1/4] Fix Poe client --- poe-client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/poe-client.js b/poe-client.js index 2ffa5c8ab..a3d3e70bb 100644 --- a/poe-client.js +++ b/poe-client.js @@ -318,7 +318,7 @@ class Client { if (!viewer.availableBots) { throw new Error('Invalid token.'); } - const botList = viewer.viewerBotList; + const botList = viewer.availableBotsConnection.edges.map(x => x.node); const retries = 2; const bots = {}; for (const bot of botList.filter(x => x.deletionState == 'not_deleted')) { From b1d5637fcf394331bdd541028ee52715474c7a52 Mon Sep 17 00:00:00 2001 From: Cohee Date: Wed, 7 Jun 2023 23:40:10 +0300 Subject: [PATCH 2/4] Bump package version --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index c29dbe980..564f14bd8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "sillytavern", - "version": "1.6.6", + "version": "1.6.7", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "sillytavern", - "version": "1.6.6", + "version": "1.6.7", "license": "AGPL-3.0", "dependencies": { "@dqbd/tiktoken": "^1.0.2", diff --git a/package.json b/package.json index 0f451eb25..25881d36c 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "type": "git", "url": "https://github.com/Cohee1207/SillyTavern.git" }, - "version": "1.6.6", + "version": "1.6.7", "scripts": { "start": "node server.js", "pkg": "pkg --compress Gzip --no-bytecode --public ." From 0f183fdcf17573d0c91d8702b627b5ee72c7821a Mon Sep 17 00:00:00 2001 From: 10sa Date: Thu, 8 Jun 2023 22:30:41 +0900 Subject: [PATCH 3/4] Add instruct input/output sequence macro replacing --- public/script.js | 8 ++++---- public/scripts/power-user.js | 18 ++++++++++++++---- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/public/script.js b/public/script.js index 0ffc2e23e..1fe14122c 100644 --- a/public/script.js +++ b/public/script.js @@ -1774,7 +1774,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject, const magName = isImpersonate ? (is_pygmalion ? 'You' : name1) : name2; if (isInstruct) { - message_already_generated = formatInstructModePrompt(magName, isImpersonate); + message_already_generated = formatInstructModePrompt(magName, isImpersonate, false, name1, name2); } else { message_already_generated = `${magName}: `; } @@ -2116,14 +2116,14 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject, // Add quiet generation prompt at depth 0 if (quiet_prompt && quiet_prompt.length) { const name = is_pygmalion ? 'You' : name1; - const quietAppend = isInstruct ? formatInstructModeChat(name, quiet_prompt, false, true, false) : `\n${name}: ${quiet_prompt}`; + const quietAppend = isInstruct ? formatInstructModeChat(name, quiet_prompt, false, true, false, name1, name2) : `\n${name}: ${quiet_prompt}`; mesSendString += quietAppend; } // Get instruct mode line if (isInstruct && tokens_already_generated === 0) { const name = isImpersonate ? (is_pygmalion ? 'You' : name1) : name2; - mesSendString += formatInstructModePrompt(name, isImpersonate, promptBias); + mesSendString += formatInstructModePrompt(name, isImpersonate, promptBias, name1, name2); } // Get non-instruct impersonation line @@ -2541,7 +2541,7 @@ function formatMessageHistoryItem(chatItem, isInstruct) { let textResult = shouldPrependName ? `${itemName}: ${chatItem.mes}\n` : `${chatItem.mes}\n`; if (isInstruct) { - textResult = formatInstructModeChat(itemName, chatItem.mes, chatItem.is_user, isNarratorType, chatItem.force_avatar); + textResult = formatInstructModeChat(itemName, chatItem.mes, chatItem.is_user, isNarratorType, chatItem.force_avatar, name1, name2); } textResult = replaceBiasMarkup(textResult); diff --git a/public/scripts/power-user.js b/public/scripts/power-user.js index d8ad93162..91c99cb8d 100644 --- a/public/scripts/power-user.js +++ b/public/scripts/power-user.js @@ -641,9 +641,14 @@ function loadInstructMode() { }); } -export function formatInstructModeChat(name, mes, isUser, isNarrator, forceAvatar) { +export function formatInstructModeChat(name, mes, isUser, isNarrator, forceAvatar, name1, name2) { const includeNames = isNarrator ? false : (power_user.instruct.names || !!selected_group || !!forceAvatar); - const sequence = (isUser || isNarrator) ? power_user.instruct.input_sequence : power_user.instruct.output_sequence; + const sequence = substituteParams( + (isUser || isNarrator) ? power_user.instruct.input_sequence : power_user.instruct.output_sequence, + name1, + name2 + ); + const separator = power_user.instruct.wrap ? '\n' : ''; const separatorSequence = power_user.instruct.separator_sequence && !isUser ? power_user.instruct.separator_sequence @@ -662,9 +667,14 @@ export function formatInstructStoryString(story) { return text; } -export function formatInstructModePrompt(name, isImpersonate, promptBias) { +export function formatInstructModePrompt(name, isImpersonate, promptBias, name1, name2) { const includeNames = power_user.instruct.names || !!selected_group; - const sequence = isImpersonate ? power_user.instruct.input_sequence : power_user.instruct.output_sequence; + const sequence = substituteParams( + isImpersonate ? power_user.instruct.input_sequence : power_user.instruct.output_sequence, + name1, + name2 + ); + const separator = power_user.instruct.wrap ? '\n' : ''; let text = includeNames ? (separator + sequence + separator + `${name}:`) : (separator + sequence); From c154536fa68b43d97fc888de5682ef06a8934d65 Mon Sep 17 00:00:00 2001 From: 10sa Date: Thu, 8 Jun 2023 22:50:33 +0900 Subject: [PATCH 4/4] Add macro replacing to stopping strings --- public/script.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/script.js b/public/script.js index 1fe14122c..bd78aeb7c 100644 --- a/public/script.js +++ b/public/script.js @@ -1370,10 +1370,10 @@ function getStoppingStrings(isImpersonate, addSpace) { if (power_user.instruct.enabled) { if (power_user.instruct.input_sequence) { - result.push(wrap(power_user.instruct.input_sequence)); + result.push(substituteParams(wrap(power_user.instruct.input_sequence), name1, name2)); } if (power_user.instruct.output_sequence) { - result.push(wrap(power_user.instruct.output_sequence)); + result.push(substituteParams(wrap(power_user.instruct.output_sequence), name1, name2)); } }