New onboarding experience

This commit is contained in:
SillyLossy
2023-04-24 14:54:27 +03:00
parent 4b3671c5ad
commit 335d8ad440
7 changed files with 114 additions and 18 deletions

View File

@ -39,6 +39,7 @@ code {
padding: 5px; padding: 5px;
border-radius: 5px; border-radius: 5px;
display: block; display: block;
white-space: normal;
} }
a { a {
@ -54,4 +55,19 @@ h3 {
hr { hr {
border: 1px solid #999; border: 1px solid #999;
}
table {
width: 100%;
}
table,
th,
td {
border: 1px solid;
border-collapse: collapse;
}
table img {
max-width: 200px;
} }

24
public/notes/faq.md.html Normal file
View File

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>SillyTavern FAQ</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('/get_faq')">
<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>

View File

@ -9,22 +9,10 @@
<link href="/webfonts/NotoSans/stylesheet.css" rel="stylesheet"> <link href="/webfonts/NotoSans/stylesheet.css" rel="stylesheet">
<script src="/scripts/showdown.min.js"></script> <script src="/scripts/showdown.min.js"></script>
<script src="/scripts/showdown-toc.min.js"></script> <script src="/scripts/showdown-toc.min.js"></script>
<script type="module"> <script src="/scripts/notes.js"></script>
const toc = [];
let hash = location.hash;
let converter = new showdown.Converter({ extensions: [showdownToc({ toc })] } );
let text = await (await fetch('/notes/content.md')).text();
let content = document.getElementById('content');
content.innerHTML = converter.makeHtml(text);
const link = document.createElement('a');
link.href = hash;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
</script>
</head> </head>
<body> <body onload="loadNotes('/notes/content.md')">
<div id="main"> <div id="main">
<div id="content"> <div id="content">
<!-- To change the guidebook content edit the content.md file --> <!-- To change the guidebook content edit the content.md 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('/get_readme')">
<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>

View File

@ -251,15 +251,35 @@ const system_messages = {
is_user: false, is_user: false,
is_name: true, is_name: true,
mes: [ mes: [
'Welcome to SillyTavern! In order to begin chatting:', '<h2>Welcome to SillyTavern!</h2>',
'<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>',
'<li>Create or pick a character from the list (the top-right namecard icon)</li>', '<li>Create or pick a character from the list (the top-right namecard icon)</li>',
'</ol>', '</ol>',
"<h4>Running on Colab and can't get an answer from the AI or getting Out of Memory errors?</h4>", "<h3>Running on Colab and can't get an answer from the AI or getting Out of Memory errors?</h3>",
'Set a lower Context Size in AI generation settings (leftmost icon).<br>Values in range of 1400-1600 Tokens would be the safest choice.', 'Set a lower Context Size in AI generation settings (leftmost icon).<br>Values in range of 1400-1600 Tokens would be the safest choice.',
'<h4>Still have questions left?</h4>', '<h3>Where to download more characters?</h3>',
'Check out built-in help or type <tt>/?</tt> in any chat.' '<ol>',
'<li><a target="_blank" href="https://discord.gg/pygmalionai">Pygmalion AI Discord</a></li>',
'<li><a target="_blank" href="https://www.characterhub.org/">CharacterHub (NSFW)</a></li>',
'<li><a target="_blank" href="https://arca.live/b/characterai?category=%EC%9E%90%EC%9E%91%EB%B4%87">Arca.live (Korean)</a></li>',
'<li><a target="_blank" href="https://botprompts.net/">Botprompts.net</a></li>',
'</ol>',
'<h3>Where can I get help?</h3>',
'Before going any further, check out the following resources:',
'<ol>',
'<li><a target="_blank" href="/notes/readme.md">Introduction to SillyTavern</a></li>',
'<li><a target="_blank" href="/notes/faq.md">SillyTavern FAQ</a></li>',
'<li><a target="_blank" href="/notes">SillyTavern Guidebook</a></li>',
'<li><a target="_blank" href="https://github.com/Cohee1207/TavernAI-extras/blob/main/README.md">Extras API Docs</a></li>',
'<li><a target="_blank" href="https://docs.alpindale.dev/">Pygmalion AI Docs</a></li>',
'</ol>',
'Type <tt>/?</tt> in any chat to get help on message formatting commands.',
'<h3>Still have questions or suggestions left?</h3>',
'<a target="_blank" href="https://github.com/Cohee1207/SillyTavern/issues">Post a GitHub issue.</a>',
'<br/>',
'<a target="_blank" href="https://github.com/Cohee1207/SillyTavern#questions-or-suggestions">Contact the developers.</a>'
].join('') ].join('')
}, },
group: { group: {

18
public/scripts/notes.js Normal file
View File

@ -0,0 +1,18 @@
async function loadNotes(file) {
const toc = [];
let hash = location.hash;
let converter = new showdown.Converter({ tables: true, extensions: [showdownToc({ toc })] } );
let text = await (await fetch(file)).text();
let content = document.getElementById('content');
content.innerHTML = converter.makeHtml(text);
if (hash) {
const link = document.createElement('a');
link.href = hash;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
}
window.loadNotes = loadNotes;

View File

@ -267,6 +267,12 @@ app.get("/", function (request, response) {
app.get("/notes/*", function (request, response) { app.get("/notes/*", function (request, response) {
response.sendFile(__dirname + "/public" + request.url + ".html"); response.sendFile(__dirname + "/public" + request.url + ".html");
}); });
app.get('/get_faq', function(_, response) {
response.sendFile(__dirname + "/faq.md");
});
app.get('/get_readme', function(_, response) {
response.sendFile(__dirname + "/readme.md");
});
//**************Kobold api //**************Kobold api
app.post("/generate", jsonParser, async function (request, response_generate = response) { app.post("/generate", jsonParser, async function (request, response_generate = response) {