This commit is contained in:
SillyLossy
2023-05-10 02:13:21 +03:00
4 changed files with 159 additions and 14 deletions

55
Update-Instructions.txt Normal file
View File

@ -0,0 +1,55 @@
How to Update SillyTavern
This is not an installation guide. If you need installation instructions, look here:
https://docs.alpindale.dev/pygmalion-extras/sillytavern/#installation
This guide assumes you have already installed SillyTavern once, and know how to run it on your OS.
Linux/Termux:
You definitely installed via git, so just 'git pull' inside the SillyTavern directory.
Windows/MacOS:
Method 1 - GIT
We always recommend users install using 'git'. Here's why:
When you have installed via `git clone`, all you have to do to update is type `git pull` in a command line in the ST folder.
The updates are applied automatically and safely.
Method 2 - ZIP
If you insist on installing via a zip, here is the tedious process for doing the update:
1. Download the new release zip.
2. Unzip it into a folder OUTSIDE of your current ST installation.
3. Do the usual setup procedure for your OS to install the NodeJS requirements.
4. Copy the following files/folders as necessary(*) from your old ST installation:
- Backgrounds
- Characters
- Chats
- Groups
- Group chats
- KoboldAI Settings
- NovelAI Settings
- OpenAI Settings
- TextGen Settings (textgen = ooba)
- Themes
- User Avatars
- Worlds
- settings.json
(*) 'As necessary' = "If you made any custom content related to those folders".
None of the folders are mandatory, so only copy what you need.
**NB: DO NOT COPY THE ENTIRE /PUBLIC/ FOLDER.**
Doing so could break the new install and prevent new features from being present.
5. Paste those items into the /Public/ folder of the new install.
6. Start SillyTavern once again with the method appropriate to your OS, and pray you got it right.
7. If everything shows up, you can safely delete the old ST folder.

24
public/notes/update.html Normal file
View File

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>SillyTavern Guidebook</title>
<link rel="stylesheet" href="/css/notes.css">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="/webfonts/NotoSans/stylesheet.css" rel="stylesheet">
<script src="/scripts/showdown.min.js"></script>
<script src="/scripts/showdown-toc.min.js"></script>
<script src="/scripts/notes.js"></script>
</head>
<body onload="loadNotes('/notes/update.md')">
<div id="main">
<div id="content">
<!-- To change the guidebook content edit the content.md file -->
<!-- Then it will be dynamically inserted here -->
</div>
</div>
</body>
</html>

64
public/notes/update.md Normal file
View File

@ -0,0 +1,64 @@
# How to Update SillyTavern
This is not an installation guide. If you need installation instructions, look here:
<https://docs.alpindale.dev/pygmalion-extras/sillytavern/#installation>
(This guide assumes you have already installed SillyTavern once and know how to run it on your OS.)
(A plain text copy of this file is also present inside SillyTavern's base install folder.)
----
## Linux/Termux
You definitely installed via git, so just 'git pull' inside the SillyTavern directory.
----
## Windows/MacOS
### Method 1 - GIT
We always recommend users install using 'git'. Here's why:
When you have installed via 'git clone', all you have to do to update is type 'git pull' in a command line in the ST folder.
The updates are applied automatically and safely.
### Method 2 - ZIP
If you insist on installing via a zip, here is the tedious process for doing the update:
1. Download the new release zip.
2. Unzip it into a folder OUTSIDE of your current ST installation.
3. Do the usual setup procedure for your OS to install NodeJS requirements.
4. Copy the following files/folders as necessary(*) from your old ST installation:
(*) 'As necessary' = "If you made any custom content related to those folders".
None of the folders are mandatory, so only copy what you need.
#### NB: DO NOT COPY THE ENTIRE /PUBLIC/ FOLDER
Doing so could break the new install and prevent new features from being present.
```plaintext
Backgrounds
Characters
Chats
Groups
Group chats
KoboldAI Settings
NovelAI Settings
OpenAI Settings
TextGen Settings (textgen = ooba)
Themes
User Avatars
Worlds
settings.json
```
5. Once those folders/files are copied, Paste them into the /Public/ folder of the new install.
6. Start SillyTavern once again with the method appropriate to your OS, and pray you got it right.
7. If everything shows up, you can safely delete the old ST folder.

View File

@ -287,6 +287,8 @@ const system_messages = {
is_name: true, is_name: true,
mes: [ mes: [
'<h2>Welcome to SillyTavern!</h2>', '<h2>Welcome to SillyTavern!</h2>',
'<h3>Want to Update to the latest version?</h3>',
"Read the <a href='/notes/update.html' target='_blank'>instructions here</a>. Also located in your installation's base folder",
'<h3>In order to begin chatting:</h3>', '<h3>In order to begin chatting:</h3>',
'<ol>', '<ol>',
'<li>Connect to one of the supported generation APIs (the plug icon)</li>', '<li>Connect to one of the supported generation APIs (the plug icon)</li>',
@ -381,17 +383,17 @@ async function getClientVersion() {
} }
function getTokenCount(str, padding = 0) { function getTokenCount(str, padding = 0) {
let tokenizerType = power_user.tokenizer; let tokenizerType = power_user.tokenizer;
if (main_api === 'openai') { if (main_api === 'openai') {
// For main prompt building // For main prompt building
if (padding == power_user.token_padding) { if (padding == power_user.token_padding) {
tokenizerType = tokenizers.NONE; tokenizerType = tokenizers.NONE;
// For extensions and WI // For extensions and WI
} else { } else {
return getTokenCountOpenAI(str); return getTokenCountOpenAI(str);
} }
} }
switch (tokenizerType) { switch (tokenizerType) {
@ -974,15 +976,15 @@ function messageFormatting(mes, ch_name, isSystem, isUser) {
.replace(/\*\*(.+?)\*\*/g, "<b>$1</b>") .replace(/\*\*(.+?)\*\*/g, "<b>$1</b>")
.replace(/\n/g, "<br/>"); .replace(/\n/g, "<br/>");
} else if (!isSystem) { } else if (!isSystem) {
mes = mes.replace(/```[\s\S]*?```|``[\s\S]*?``|`[\s\S]*?`|(\".+?\")|(\u201C.+?\u201D)/gm, function (match, p1, p2) { mes = mes.replace(/```[\s\S]*?```|``[\s\S]*?``|`[\s\S]*?`|(\".+?\")|(\u201C.+?\u201D)/gm, function (match, p1, p2) {
if (p1) { if (p1) {
return '<q>"' + p1.replace(/\"/g, "") + '"</q>'; return '<q>"' + p1.replace(/\"/g, "") + '"</q>';
} else if (p2) { } else if (p2) {
return '<q>“' + p2.replace(/\u201C|\u201D/g, "") + '”</q>'; return '<q>“' + p2.replace(/\u201C|\u201D/g, "") + '”</q>';
} else { } else {
return match; return match;
} }
}); });
mes = mes.replaceAll('\\begin{align*}', '$$'); mes = mes.replaceAll('\\begin{align*}', '$$');
mes = mes.replaceAll('\\end{align*}', '$$'); mes = mes.replaceAll('\\end{align*}', '$$');
mes = converter.makeHtml(mes); mes = converter.makeHtml(mes);
@ -1849,7 +1851,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
if (main_api == 'openai') { if (main_api == 'openai') {
break; break;
} }
chatString = item + chatString; chatString = item + chatString;
if (canFitMessages()) { //(The number of tokens in the entire promt) need fix, it must count correctly (added +120, so that the description of the character does not hide) if (canFitMessages()) { //(The number of tokens in the entire promt) need fix, it must count correctly (added +120, so that the description of the character does not hide)
//if (is_pygmalion && i == chat2.length-1) item='<START>\n'+item; //if (is_pygmalion && i == chat2.length-1) item='<START>\n'+item;
@ -2502,7 +2504,7 @@ function cleanUpMessage(getMessage, isImpersonate) {
getMessage = getMessage.replace(/You:/g, name1 + ':'); getMessage = getMessage.replace(/You:/g, name1 + ':');
} }
let nameToTrim = isImpersonate ? name2 : name1; let nameToTrim = isImpersonate ? name2 : name1;
if (isImpersonate) { if (isImpersonate) {
nameToTrim = power_user.allow_name2_display ? '' : name2; nameToTrim = power_user.allow_name2_display ? '' : name2;