Compare commits

...

9 Commits
1.6.7 ... 1.6.8

Author SHA1 Message Date
Cohee
6541d3e741 Bump package version 2023-06-09 22:35:17 +03:00
Cohee
d4d903323e Poe fixed 2023-06-09 22:33:54 +03:00
Cohee
5354086438 Fix comment 2023-06-09 20:05:04 +03:00
Cohee
e9fe58d514 Add Edge TTS and SD CPU to colab 2023-06-09 20:03:45 +03:00
Cohee
d92f5338b5 Merge pull request #471 from itzraf-lab/patch-1
Update .replit
2023-06-09 13:04:01 +03:00
itzraf-lab
c4f9fdd1ee Update .replit
Added the ability to run Silly Tavern on replit with the Run button and don't have to manually go to Shell to start it
2023-06-09 17:46:01 +08:00
Cohee
a73a205e2c Merge pull request #464 from 10sa/main
Add instruct input/output sequence macro replacing
2023-06-08 18:40:35 +03:00
10sa
c154536fa6 Add macro replacing to stopping strings 2023-06-08 22:50:33 +09:00
10sa
0f183fdcf1 Add instruct input/output sequence macro replacing 2023-06-08 22:30:41 +09:00
7 changed files with 39 additions and 19 deletions

View File

@@ -1,6 +1,7 @@
hidden = [".config", "package-lock.json"] hidden = [".config", "package-lock.json"]
run = "chmod 755 ./start.sh && ./start.sh" run = "chmod 755 ./start.sh && ./start.sh"
entrypoint = "server.js"
[[hints]] [[hints]]
regex = "Error \\[ERR_REQUIRE_ESM\\]" regex = "Error \\[ERR_REQUIRE_ESM\\]"
@@ -62,7 +63,7 @@ support = true
cwd = "." cwd = "."
environment = [] environment = []
pauseForSourceMap = false pauseForSourceMap = false
program = "./index.js" program = "./server.js"
request = "launch" request = "launch"
sourceMaps = true sourceMaps = true
stopOnEntry = false stopOnEntry = false

View File

@@ -6,7 +6,7 @@
"metadata": {}, "metadata": {},
"source": [ "source": [
"**Links**<br>\n", "**Links**<br>\n",
"Extensions API GitHub: https://github.com/Cohee1207/SillyTavern-extras/<br>\n", "Extensions API GitHub: https://github.com/SillyTavern/SillyTavern-extras/<br>\n",
"SillyTavern community Discord (support and discussion): https://discord.gg/RZdyAEUPvj" "SillyTavern community Discord (support and discussion): https://discord.gg/RZdyAEUPvj"
] ]
}, },
@@ -34,6 +34,9 @@
"source": [ "source": [
"#@markdown Enables hosting of extensions backend for SillyTavern Extras\n", "#@markdown Enables hosting of extensions backend for SillyTavern Extras\n",
"use_cpu = False #@param {type:\"boolean\"}\n", "use_cpu = False #@param {type:\"boolean\"}\n",
"#@markdown Allows to run SillyTavern Extras on CPU (use if you're out of daily GPU allowance)\n",
"use_sd_cpu = False #@param {type:\"boolean\"}\n",
"#@markdown Allows to run Stable Diffusion pipeline on CPU (slow!)\n",
"extras_enable_captioning = True #@param {type:\"boolean\"}\n", "extras_enable_captioning = True #@param {type:\"boolean\"}\n",
"#@markdown Loads the image captioning module\n", "#@markdown Loads the image captioning module\n",
"Captions_Model = \"Salesforce/blip-image-captioning-large\" #@param [ \"Salesforce/blip-image-captioning-large\", \"Salesforce/blip-image-captioning-base\" ]\n", "Captions_Model = \"Salesforce/blip-image-captioning-large\" #@param [ \"Salesforce/blip-image-captioning-large\", \"Salesforce/blip-image-captioning-base\" ]\n",
@@ -51,8 +54,10 @@
"#@markdown * Qiliang/bart-large-cnn-samsum-ChatGPT_v3 - summarization model optimized for chats\n", "#@markdown * Qiliang/bart-large-cnn-samsum-ChatGPT_v3 - summarization model optimized for chats\n",
"#@markdown * Qiliang/bart-large-cnn-samsum-ElectrifAi_v10 - nice results so far, but still being evaluated\n", "#@markdown * Qiliang/bart-large-cnn-samsum-ElectrifAi_v10 - nice results so far, but still being evaluated\n",
"#@markdown * distilbart-xsum-12-3 - faster, but pretty basic alternative\n", "#@markdown * distilbart-xsum-12-3 - faster, but pretty basic alternative\n",
"extras_enable_tts = True #@param {type:\"boolean\"}\n", "extras_enable_silero_tts = True #@param {type:\"boolean\"}\n",
"#@markdown Enables Silero text-to-speech module\n", "#@markdown Enables Silero text-to-speech module\n",
"extras_enable_edge_tts = True #@param {type:\"boolean\"}\n",
"#@markdown Enables Microsoft Edge text-to-speech module\n",
"extras_enable_sd = True #@param {type:\"boolean\"}\n", "extras_enable_sd = True #@param {type:\"boolean\"}\n",
"#@markdown Enables SD picture generation\n", "#@markdown Enables SD picture generation\n",
"SD_Model = \"ckpt/anything-v4.5-vae-swapped\" #@param [ \"ckpt/anything-v4.5-vae-swapped\", \"hakurei/waifu-diffusion\", \"philz1337/clarity\", \"prompthero/openjourney\", \"ckpt/sd15\", \"stabilityai/stable-diffusion-2-1-base\" ]\n", "SD_Model = \"ckpt/anything-v4.5-vae-swapped\" #@param [ \"ckpt/anything-v4.5-vae-swapped\", \"hakurei/waifu-diffusion\", \"philz1337/clarity\", \"prompthero/openjourney\", \"ckpt/sd15\", \"stabilityai/stable-diffusion-2-1-base\" ]\n",
@@ -73,6 +78,8 @@
"params = []\n", "params = []\n",
"if use_cpu:\n", "if use_cpu:\n",
" params.append('--cpu')\n", " params.append('--cpu')\n",
"if use_sd_cpu:\n",
" params.append('--sd-cpu')\n",
"params.append('--share')\n", "params.append('--share')\n",
"ExtrasModules = []\n", "ExtrasModules = []\n",
"\n", "\n",
@@ -84,8 +91,10 @@
" ExtrasModules.append('classify')\n", " ExtrasModules.append('classify')\n",
"if (extras_enable_sd):\n", "if (extras_enable_sd):\n",
" ExtrasModules.append('sd')\n", " ExtrasModules.append('sd')\n",
"if (extras_enable_tts):\n", "if (extras_enable_silero_tts):\n",
" ExtrasModules.append('tts')\n", " ExtrasModules.append('silero-tts')\n",
"if extras_enable_edge_tts:\n",
" ExtrasModules.append('edge-tts')\n",
"if (extras_enable_chromadb):\n", "if (extras_enable_chromadb):\n",
" ExtrasModules.append('chromadb')\n", " ExtrasModules.append('chromadb')\n",
"\n", "\n",

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "sillytavern", "name": "sillytavern",
"version": "1.6.7", "version": "1.6.8",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "sillytavern", "name": "sillytavern",
"version": "1.6.7", "version": "1.6.8",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"dependencies": { "dependencies": {
"@dqbd/tiktoken": "^1.0.2", "@dqbd/tiktoken": "^1.0.2",

View File

@@ -46,7 +46,7 @@
"type": "git", "type": "git",
"url": "https://github.com/Cohee1207/SillyTavern.git" "url": "https://github.com/Cohee1207/SillyTavern.git"
}, },
"version": "1.6.7", "version": "1.6.8",
"scripts": { "scripts": {
"start": "node server.js", "start": "node server.js",
"pkg": "pkg --compress Gzip --no-bytecode --public ." "pkg": "pkg --compress Gzip --no-bytecode --public ."

View File

@@ -315,7 +315,7 @@ class Client {
async get_bots() { async get_bots() {
const viewer = this.next_data.props.pageProps.payload.viewer; const viewer = this.next_data.props.pageProps.payload.viewer;
if (!viewer.availableBots) { if (!viewer.availableBotsConnection) {
throw new Error('Invalid token.'); throw new Error('Invalid token.');
} }
const botList = viewer.availableBotsConnection.edges.map(x => x.node); const botList = viewer.availableBotsConnection.edges.map(x => x.node);

View File

@@ -1370,10 +1370,10 @@ function getStoppingStrings(isImpersonate, addSpace) {
if (power_user.instruct.enabled) { if (power_user.instruct.enabled) {
if (power_user.instruct.input_sequence) { 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) { 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));
} }
} }
@@ -1774,7 +1774,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
const magName = isImpersonate ? (is_pygmalion ? 'You' : name1) : name2; const magName = isImpersonate ? (is_pygmalion ? 'You' : name1) : name2;
if (isInstruct) { if (isInstruct) {
message_already_generated = formatInstructModePrompt(magName, isImpersonate); message_already_generated = formatInstructModePrompt(magName, isImpersonate, false, name1, name2);
} else { } else {
message_already_generated = `${magName}: `; 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 // Add quiet generation prompt at depth 0
if (quiet_prompt && quiet_prompt.length) { if (quiet_prompt && quiet_prompt.length) {
const name = is_pygmalion ? 'You' : name1; 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; mesSendString += quietAppend;
} }
// Get instruct mode line // Get instruct mode line
if (isInstruct && tokens_already_generated === 0) { if (isInstruct && tokens_already_generated === 0) {
const name = isImpersonate ? (is_pygmalion ? 'You' : name1) : name2; 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 // Get non-instruct impersonation line
@@ -2541,7 +2541,7 @@ function formatMessageHistoryItem(chatItem, isInstruct) {
let textResult = shouldPrependName ? `${itemName}: ${chatItem.mes}\n` : `${chatItem.mes}\n`; let textResult = shouldPrependName ? `${itemName}: ${chatItem.mes}\n` : `${chatItem.mes}\n`;
if (isInstruct) { 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); textResult = replaceBiasMarkup(textResult);

View File

@@ -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 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 separator = power_user.instruct.wrap ? '\n' : '';
const separatorSequence = power_user.instruct.separator_sequence && !isUser const separatorSequence = power_user.instruct.separator_sequence && !isUser
? power_user.instruct.separator_sequence ? power_user.instruct.separator_sequence
@@ -662,9 +667,14 @@ export function formatInstructStoryString(story) {
return text; 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 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' : ''; const separator = power_user.instruct.wrap ? '\n' : '';
let text = includeNames ? (separator + sequence + separator + `${name}:`) : (separator + sequence); let text = includeNames ? (separator + sequence + separator + `${name}:`) : (separator + sequence);