mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
@1.1.1
1) Pygmalion support
This commit is contained in:
46
public/KoboldAI Settings/Classic-Pygmalion-2.7b.settings
Normal file
46
public/KoboldAI Settings/Classic-Pygmalion-2.7b.settings
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"file_version": 2,
|
||||
"max_length": 2048,
|
||||
"ikmax": 3000,
|
||||
"genamt": 80,
|
||||
"ikgen": 200,
|
||||
"rep_pen": 1.17,
|
||||
"rep_pen_slope": 0.2,
|
||||
"rep_pen_range": 1024,
|
||||
"temp": 0.43,
|
||||
"top_p": 0.96,
|
||||
"top_k": 0,
|
||||
"top_a": 0.0,
|
||||
"tfs": 0.68,
|
||||
"typical": 1.0,
|
||||
"numseqs": 1,
|
||||
"fp32_model": false,
|
||||
"modeldim": 2560,
|
||||
"sampler_order": [
|
||||
6,
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5
|
||||
],
|
||||
"newlinemode": "n",
|
||||
"lazy_load": true,
|
||||
"revision": null,
|
||||
"selected_preset": "",
|
||||
"horde_wait_time": 0,
|
||||
"horde_queue_position": 0,
|
||||
"horde_queue_size": 0,
|
||||
"model": "pygmalion-2.7b",
|
||||
"model_type": "gpt_neo",
|
||||
"url": "https://api.inferkit.com/v1/models/standard/generate",
|
||||
"oaiurl": "",
|
||||
"oaiengines": "https://api.openai.com/v1/engines",
|
||||
"colaburl": "/request",
|
||||
"apikey": "",
|
||||
"oaiapikey": "",
|
||||
"configname": "pygmalion-2.7b",
|
||||
"online_model": "",
|
||||
"alt_multi_gen": false
|
||||
}
|
46
public/KoboldAI Settings/Classic-Pygmalion-6b.settings
Normal file
46
public/KoboldAI Settings/Classic-Pygmalion-6b.settings
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"file_version": 2,
|
||||
"max_length": 2048,
|
||||
"ikmax": 3000,
|
||||
"genamt": 80,
|
||||
"ikgen": 200,
|
||||
"rep_pen": 1.1,
|
||||
"rep_pen_slope": 0.7,
|
||||
"rep_pen_range": 1024,
|
||||
"temp": 0.5,
|
||||
"top_p": 0.9,
|
||||
"top_k": 0,
|
||||
"top_a": 0.0,
|
||||
"tfs": 0.9,
|
||||
"typical": 1.0,
|
||||
"numseqs": 1,
|
||||
"fp32_model": false,
|
||||
"modeldim": 4096,
|
||||
"sampler_order": [
|
||||
6,
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5
|
||||
],
|
||||
"newlinemode": "n",
|
||||
"lazy_load": true,
|
||||
"revision": null,
|
||||
"selected_preset": "",
|
||||
"horde_wait_time": 0,
|
||||
"horde_queue_position": 0,
|
||||
"horde_queue_size": 0,
|
||||
"model": "pygmalion-6b",
|
||||
"model_type": "gptj",
|
||||
"url": "https://api.inferkit.com/v1/models/standard/generate",
|
||||
"oaiurl": "",
|
||||
"oaiengines": "https://api.openai.com/v1/engines",
|
||||
"colaburl": "/request",
|
||||
"apikey": "",
|
||||
"oaiapikey": "",
|
||||
"configname": "pygmalion-6b",
|
||||
"online_model": "",
|
||||
"alt_multi_gen": false
|
||||
}
|
@@ -28,11 +28,12 @@
|
||||
<script type=module>
|
||||
import {encode, decode} from "../scripts/gpt-2-3-tokenizer/mod.js";
|
||||
$(document).ready(function(){
|
||||
const VERSION = '1.1.1';
|
||||
var bg_menu_toggle = false;
|
||||
var default_user_name = "You";
|
||||
var name1 = default_user_name;
|
||||
var name2 = "Chloe";
|
||||
var chat = ['\nChloe: *You went inside. The air smelled of fried meat, tobacco and a hint of wine. A dim light was cast by candles, and a fire crackled in the fireplace. It seems to be a very pleasant place. Behind the wooden bar is an elf waitress, she is smiling. Her ears are very pointy, and there is a twinkle in her eye. She wears glasses and a white aporn. As soon as she noticed you, she immediately came right up close to you.*\n\n Hello there! How is your evening going?\n<img src="img/star_dust_city.png" width=80% style="opacity:0.3; disolay:block;border-radius:5px;margin-top:25px;margin-bottom:23px; margin-left: 45px;margin-right: auto;">\n<a style="color:rgb(229, 224, 216,0.8);" href="https://github.com/TavernAI/TavernAI" target="_blank">@@@TavernAI v1.1.0@@@</a><div id="donation" style="margin-right:10px;margin-top:0px;float:right; height:25px;cursor: pointer;opacity: 0.99;display:inline-block;"><img src="img/coins.png" style="width: 25px;height: 25px;display:inline-block;"><div style="vertical-align: top;display:inline-block;">Give a Tip</div></div><br><br><br><br>'];
|
||||
var chat = ['\nChloe: *You went inside. The air smelled of fried meat, tobacco and a hint of wine. A dim light was cast by candles, and a fire crackled in the fireplace. It seems to be a very pleasant place. Behind the wooden bar is an elf waitress, she is smiling. Her ears are very pointy, and there is a twinkle in her eye. She wears glasses and a white aporn. As soon as she noticed you, she immediately came right up close to you.*\n\n Hello there! How is your evening going?\n<img src="img/star_dust_city.png" width=80% style="opacity:0.3; disolay:block;border-radius:5px;margin-top:25px;margin-bottom:23px; margin-left: 45px;margin-right: auto;">\n<a id="verson" style="color:rgb(229, 224, 216,0.8);" href="https://github.com/TavernAI/TavernAI" target="_blank">@@@TavernAI v'+VERSION+'@@@</a><div id="donation" style="margin-right:10px;margin-top:0px;float:right; height:25px;cursor: pointer;opacity: 0.99;display:inline-block;"><img src="img/coins.png" style="width: 25px;height: 25px;display:inline-block;"><div style="vertical-align: top;display:inline-block;">Give a Tip</div></div><br><br><br><br>'];
|
||||
var default_ch_mes = "Hello";
|
||||
var count_view_mes = 0;
|
||||
var mesStr = '';
|
||||
@@ -90,6 +91,8 @@
|
||||
var rep_pen = 1;
|
||||
var rep_pen_size = 100;
|
||||
|
||||
var is_pygmalion = false;
|
||||
|
||||
var anchor_order = 0;
|
||||
var style_anchor = true;
|
||||
var character_anchor = true;
|
||||
@@ -113,13 +116,14 @@
|
||||
var css_send_form_display = $('<div id=send_form></div>').css('display');
|
||||
/////////////
|
||||
getSettings("def");
|
||||
getLastVersion();
|
||||
//var interval_getSettings = setInterval(getSettings, 1000);
|
||||
getCharacters();
|
||||
|
||||
printMessages();
|
||||
getBackgrounds();
|
||||
getUserAvatars();
|
||||
|
||||
//
|
||||
function checkOnlineStatus(){
|
||||
//console.log(online_status);
|
||||
if(online_status == 'no_connection'){
|
||||
@@ -142,6 +146,39 @@
|
||||
$("#online_status_text3").html(online_status);
|
||||
}
|
||||
|
||||
}
|
||||
async function getLastVersion(){
|
||||
|
||||
jQuery.ajax({
|
||||
type: 'POST', //
|
||||
url: '/getlastversion', //
|
||||
data: JSON.stringify({
|
||||
'': ''
|
||||
}),
|
||||
beforeSend: function(){
|
||||
|
||||
|
||||
},
|
||||
cache: false,
|
||||
dataType: "json",
|
||||
contentType: "application/json",
|
||||
//processData: false,
|
||||
success: function(data){
|
||||
var getVersion = data.version;
|
||||
if(getVersion !== 'error' && getVersion != undefined){
|
||||
if(compareVersions(getVersion, VERSION) === 1){
|
||||
$('#verson').append(' <span style="color: #326d78; font-size: 15px;">(New update @'+getVersion+')</span>');
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
error: function (jqXHR, exception) {
|
||||
console.log(exception);
|
||||
console.log(jqXHR);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
async function getStatus(){
|
||||
if(is_get_status){
|
||||
@@ -168,6 +205,11 @@
|
||||
if(online_status == undefined){
|
||||
online_status = 'no_connection';
|
||||
}
|
||||
if(online_status.toLowerCase().indexOf('pygmalion') != -1){
|
||||
is_pygmalion = true;
|
||||
}else{
|
||||
is_pygmalion = false;
|
||||
}
|
||||
//console.log(online_status);
|
||||
resultCheckStatus();
|
||||
|
||||
@@ -435,18 +477,19 @@
|
||||
|
||||
var postAnchorChar = "talks a lot with descriptions";//'Talk a lot with description what is going on around';// in asterisks
|
||||
var postAnchorStyle = "[Writing style: very long messages]";//"[Genre: roleplay chat][Tone: very long messages with descriptions]";
|
||||
|
||||
var anchorTop = '';
|
||||
var anchorBottom = '';
|
||||
var topAnchorDepth = 8;
|
||||
|
||||
if(character_anchor){
|
||||
if(character_anchor && !is_pygmalion){
|
||||
if(anchor_order === 0){
|
||||
anchorTop = "["+name2+" "+postAnchorChar+"]";
|
||||
}else{
|
||||
anchorBottom = "["+name2+" "+postAnchorChar+"]";
|
||||
}
|
||||
}
|
||||
if(style_anchor){
|
||||
if(style_anchor && !is_pygmalion){
|
||||
if(anchor_order === 1){
|
||||
anchorTop = postAnchorStyle;
|
||||
}else{
|
||||
@@ -468,21 +511,25 @@
|
||||
var arrMes = [];
|
||||
|
||||
var charPersonality = characters[this_chid].personality;
|
||||
if($.trim(charPersonality.length) > 0){
|
||||
charPersonality = "["+name2+" is "+charPersonality+"]";//"["+name2+"'s personality: "+charPersonality+"]";
|
||||
}
|
||||
|
||||
storyString = $.trim(characters[this_chid].description);
|
||||
if($.trim(storyString.length) > 0){
|
||||
if(storyString.slice(-1) !== ']' || storyString.substr(0,1) !== '['){
|
||||
storyString = '['+storyString+']';
|
||||
if(is_pygmalion){
|
||||
storyString = name2+"'s Persona: "+$.trim(characters[this_chid].description)+"\n<START>\n";
|
||||
}else{
|
||||
if($.trim(charPersonality.length) > 0){
|
||||
charPersonality = "["+name2+" is "+charPersonality+"]";//"["+name2+"'s personality: "+charPersonality+"]";
|
||||
}
|
||||
|
||||
storyString = $.trim(characters[this_chid].description);
|
||||
if($.trim(storyString.length) > 0){
|
||||
if(storyString.slice(-1) !== ']' || storyString.substr(0,1) !== '['){
|
||||
storyString = '['+storyString+']';
|
||||
}
|
||||
}
|
||||
if(count_view_mes < topAnchorDepth){
|
||||
storyString+=charPersonality;
|
||||
}
|
||||
if(count_view_mes < 10){
|
||||
storyString+='\nThen the roleplay chat between '+name1+' and '+name2+' begins.\n';
|
||||
}
|
||||
}
|
||||
if(count_view_mes < topAnchorDepth){
|
||||
storyString+=charPersonality;
|
||||
}
|
||||
if(count_view_mes < 10){
|
||||
storyString+='\nThen the dialogue between '+name1+' and '+name2+' begins.\n';
|
||||
}
|
||||
var chat2 = [];
|
||||
var j = 0;
|
||||
@@ -511,7 +558,6 @@
|
||||
await delay(1); //For disable slow down (encode gpt-2 need fix)
|
||||
//console.log(i+' '+chat.length);
|
||||
if(i == chat.length-1){
|
||||
|
||||
runGenerate();
|
||||
}
|
||||
i++;
|
||||
@@ -523,10 +569,10 @@
|
||||
arrMes = arrMes.reverse();
|
||||
var is_add_personality = false;
|
||||
arrMes.forEach(function(item, i, arr) {//For added anchors and others
|
||||
chatString = chatString+item;
|
||||
|
||||
if(i >= arrMes.length-1 && $.trim(item).substr(0, (name1+":").length) != name1+":"){
|
||||
if(textareaText == ""){
|
||||
chatString = chatString.substr(0,chatString.length-1);
|
||||
item = item.substr(0,item.length-1);
|
||||
}
|
||||
}
|
||||
if(i === arrMes.length-topAnchorDepth && count_view_mes>=topAnchorDepth && !is_add_personality){
|
||||
@@ -534,13 +580,19 @@
|
||||
is_add_personality = true;
|
||||
//chatString = chatString.substr(0,chatString.length-1);
|
||||
//anchorAndPersonality = "[Genre: roleplay chat][Tone: very long messages with descriptions]";
|
||||
chatString+=charPersonality+anchorTop+'\n';
|
||||
item+=charPersonality+anchorTop+'\n';
|
||||
}
|
||||
if(i >= arrMes.length-1 && count_view_mes>=4 && $.trim(item).substr(0, (name1+":").length) == name1+":"){//For add anchor in end
|
||||
chatString = chatString.substr(0,chatString.length-1);
|
||||
if(i >= arrMes.length-1 && count_view_mes>=4 && $.trim(item).substr(0, (name1+":").length) == name1+":" && !is_pygmalion){//For add anchor in end
|
||||
item = item.substr(0,item.length-1);
|
||||
//chatString+=postAnchor+"\n";//"[Writing style: very long messages]\n";
|
||||
chatString+=anchorBottom+"\n";
|
||||
item =item+" "+ anchorBottom+"\n";
|
||||
}
|
||||
if(is_pygmalion){
|
||||
if($.trim(item).indexOf(name1) === 0){
|
||||
item = item.replace(name1+':', 'You:');
|
||||
}
|
||||
}
|
||||
chatString = chatString+item;
|
||||
});
|
||||
|
||||
storyString+=chatString;
|
||||
@@ -639,6 +691,11 @@
|
||||
}
|
||||
//Formating
|
||||
getMessage = $.trim(getMessage);
|
||||
if(is_pygmalion){
|
||||
getMessage = getMessage.replace(new RegExp('<USER>', "g"), name1);
|
||||
getMessage = getMessage.replace(new RegExp('<BOT>', "g"), name2);
|
||||
getMessage = getMessage.replace(new RegExp('You:', "g"), name1+':');
|
||||
}
|
||||
if(getMessage.indexOf(name1+":") != -1){
|
||||
getMessage = getMessage.substr(0,getMessage.indexOf(name1+":"));
|
||||
|
||||
@@ -1506,6 +1563,7 @@
|
||||
saveSettings();
|
||||
});
|
||||
$( "#main_api" ).change(function() {
|
||||
is_pygmalion = false;
|
||||
is_get_status = false;
|
||||
is_get_status_novel = false;
|
||||
online_status = 'no_connection';
|
||||
@@ -2054,6 +2112,34 @@
|
||||
anchor_order = parseInt($('#anchor_order').find(":selected").val());
|
||||
saveSettings();
|
||||
});
|
||||
|
||||
|
||||
function compareVersions(v1, v2) {
|
||||
const v1parts = v1.split('.');
|
||||
const v2parts = v2.split('.');
|
||||
|
||||
for (let i = 0; i < v1parts.length; ++i) {
|
||||
if (v2parts.length === i) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (v1parts[i] === v2parts[i]) {
|
||||
continue;
|
||||
}
|
||||
if (v1parts[i] > v2parts[i]) {
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (v1parts.length != v2parts.length) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
|
@@ -2,7 +2,7 @@
|
||||
Examples of interface and output:
|
||||
<br><img src="readme/1.png" height="200" /><img src="readme/4.png" height="200" /><img src="readme/5.png" height="200" />
|
||||
|
||||
[@@@Download TavernAI@@@](https://github.com/TavernAI/TavernAI/archive/refs/heads/main.zip)
|
||||
[@@@Download TavernAI@@@](https://github.com/TavernAI/TavernAI/archive/refs/heads/main.zip) (Last version)
|
||||
## Features
|
||||
* Creating characters with personality setup
|
||||
* Choosing name and avatar for your character
|
||||
@@ -31,6 +31,8 @@ If the message is not finished, you can simply send the request again, TavernAI
|
||||
<br><img src="readme/2.png" width="600" />
|
||||
## Additional materials
|
||||
https://www.reddit.com/user/Crataco/comments/zuowi9/opensource_chatbot_companions/
|
||||
## For contacts
|
||||
* Discord: Humi#5044
|
||||
## For thanks and support
|
||||
TavernAI is being developed with love and care on a voluntary basis. If you like the project and want to support it, your donation would make a huge impact!
|
||||
|
||||
|
34
server.js
34
server.js
@@ -3,6 +3,7 @@ var app = express();
|
||||
var fs = require('fs');
|
||||
var rimraf = require("rimraf");
|
||||
const multer = require("multer");
|
||||
const https = require('https');
|
||||
|
||||
var Client = require('node-rest-client').Client;
|
||||
var client = new Client();
|
||||
@@ -24,11 +25,38 @@ var response_edit;
|
||||
var response_dw_bg;
|
||||
var response_getstatus;
|
||||
var response_getstatus_novel;
|
||||
var response_getlastversion;
|
||||
var api_key_novel;
|
||||
|
||||
const jsonParser = express.json();
|
||||
const urlencodedParser = express.urlencoded({extended: false});
|
||||
|
||||
|
||||
|
||||
|
||||
app.post("/getlastversion", jsonParser, function(request, response_getlastversion = response){
|
||||
if(!request.body) return response_getlastversion.sendStatus(400);
|
||||
|
||||
const repo = 'TavernAI/TavernAI';
|
||||
|
||||
https.request({
|
||||
hostname: 'github.com',
|
||||
path: `/${repo}/releases/latest`,
|
||||
method: 'HEAD'
|
||||
}, (res) => {
|
||||
if(res.statusCode === 302) {
|
||||
const glocation = res.headers.location;
|
||||
const versionStartIndex = glocation.lastIndexOf('@')+1;
|
||||
const version = glocation.substring(versionStartIndex);
|
||||
//console.log(version);
|
||||
response_getlastversion.send({version: version});
|
||||
}else{
|
||||
response_getlastversion.send({version: 'error'});
|
||||
}
|
||||
}).end();
|
||||
|
||||
|
||||
});
|
||||
app.use(express.static(__dirname + "/public"));
|
||||
app.use(multer({dest:"uploads"}).single("avatar"));
|
||||
app.get("/", function(request, response){
|
||||
@@ -152,7 +180,7 @@ app.post("/getchat", jsonParser, function(request, response){
|
||||
|
||||
});
|
||||
app.post("/getstatus", jsonParser, function(request, response_getstatus = response){
|
||||
if(!request.body) return response.sendStatus(400);
|
||||
if(!request.body) return response_getstatus.sendStatus(400);
|
||||
|
||||
api_server = request.body.api_server;
|
||||
if(api_server.indexOf('localhost') != -1){
|
||||
@@ -562,7 +590,7 @@ return new Date(fs.statSync(path + '/' + a).mtime) - new Date(fs.statSync(path +
|
||||
//***********Novel.ai API
|
||||
|
||||
app.post("/getstatus_novelai", jsonParser, function(request, response_getstatus_novel =response){
|
||||
if(!request.body) return response_generate.sendStatus(400);
|
||||
if(!request.body) return response_getstatus_novel.sendStatus(400);
|
||||
api_key_novel = request.body.key;
|
||||
var data = {};
|
||||
var args = {
|
||||
@@ -662,7 +690,7 @@ app.post("/generate_novelai", jsonParser, function(request, response_generate_no
|
||||
|
||||
|
||||
app.listen(server_port, function() {
|
||||
console.log('Server started: http://127.0.0.1:'+server_port);
|
||||
console.log('TavernAI started: http://127.0.0.1:'+server_port);
|
||||
|
||||
|
||||
});
|
||||
|
Reference in New Issue
Block a user