mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Merge branch 'dev' of https://github.com/SillyLossy/TavernAI into dev
This commit is contained in:
@ -989,7 +989,7 @@ async function Generate(type, automatic_trigger, force_name2) {//encode("dsfs").
|
||||
var storyString = "";
|
||||
var userSendString = "";
|
||||
var finalPromt = "";
|
||||
var postAnchorChar = "talks a lot with descriptions";//'Talk a lot with description what is going on around';// in asterisks
|
||||
var postAnchorChar = "Elaborate speaker";//'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 = '';
|
||||
@ -1853,9 +1853,6 @@ function changeMainAPI() {
|
||||
apiObj.apiConnector.css("display", isCurrentApi ? "block" : "none");
|
||||
apiObj.apiRanges.css("display", isCurrentApi ? "block" : "none");
|
||||
|
||||
// Hide common settings for OpenAI
|
||||
$("#common-gen-settings-block").css("display", isCurrentApi && apiName !== "openai" ? "block" : "none");
|
||||
|
||||
if (isCurrentApi && apiName === "kobold") {
|
||||
console.log("enabling SP for kobold");
|
||||
$("#softprompt_block").css("display", "block");
|
||||
@ -1866,6 +1863,9 @@ function changeMainAPI() {
|
||||
apiObj.amountGenElem.children().prop("disabled", false);
|
||||
apiObj.amountGenElem.css("opacity", 1.0);
|
||||
}
|
||||
|
||||
// Hide common settings for OpenAI
|
||||
$("#common-gen-settings-block").css("display", (selectedVal !== "openai" ? "block" : "none"));
|
||||
}
|
||||
|
||||
main_api = selectedVal;
|
||||
@ -3278,10 +3278,6 @@ $(document).ready(function () {
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, exception) {
|
||||
if (jqXHR.status == 403) {
|
||||
callPopup(`Character can't be imported due to invalid name. Please choose other name`, 'text');
|
||||
}
|
||||
|
||||
//alert('ERROR: '+xhr.status+ ' Status Text: '+xhr.statusText+' '+xhr.responseText);
|
||||
$("#create_button").removeAttr("disabled");
|
||||
},
|
||||
@ -3946,9 +3942,6 @@ $(document).ready(function () {
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, exception) {
|
||||
if (jqXHR.status == 403) {
|
||||
callPopup(`Character can't be imported due to invalid name. Please choose other name`, 'text');
|
||||
}
|
||||
$("#create_button").removeAttr("disabled");
|
||||
},
|
||||
});
|
||||
|
@ -50,7 +50,7 @@ const oai_settings = {
|
||||
temp_openai: 1.0,
|
||||
freq_pen_openai: 0,
|
||||
pres_pen_openai: 0,
|
||||
stream_openai: true,
|
||||
stream_openai: false,
|
||||
openai_max_context: 4095,
|
||||
openai_max_tokens: 300,
|
||||
nsfw_toggle: true,
|
||||
@ -316,7 +316,7 @@ async function sendOpenAIRequest(openai_msgs_tosend) {
|
||||
"frequency_penalty": parseFloat(oai_settings.freq_pen_openai),
|
||||
"presence_penalty": parseFloat(oai_settings.pres_pen_openai),
|
||||
"max_tokens": oai_settings.openai_max_tokens,
|
||||
"stream": oai_settings.stream_openai,
|
||||
"stream": false, //oai_settings.stream_openai,
|
||||
};
|
||||
|
||||
const generate_url = '/generate_openai';
|
||||
|
21
server.js
21
server.js
@ -555,10 +555,7 @@ app.post("/createcharacter", urlencodedParser, function (request, response) {
|
||||
//if (sameNameChar == true) return response.sendStatus(500);
|
||||
if (!request.body) return response.sendStatus(400);
|
||||
|
||||
if (request.body.ch_name !== sanitize(request.body.ch_name)) {
|
||||
console.error('Malicious character name prevented');
|
||||
return response.sendStatus(403);
|
||||
}
|
||||
request.body.ch_name = sanitize(request.body.ch_name);
|
||||
|
||||
console.log('/createcharacter -- looking for -- ' + (charactersPath + request.body.ch_name + '.png'));
|
||||
console.log('Does this file already exists? ' + fs.existsSync(charactersPath + request.body.ch_name + '.png'));
|
||||
@ -1237,20 +1234,14 @@ app.post("/importcharacter", urlencodedParser, async function (request, response
|
||||
const jsonData = JSON.parse(data);
|
||||
|
||||
if (jsonData.name !== undefined) {
|
||||
if (jsonData.name !== sanitize(jsonData.name)) {
|
||||
console.error('Malicious character name prevented');
|
||||
return response.sendStatus(403);
|
||||
}
|
||||
jsonData.name = sanitize(jsonData.name);
|
||||
|
||||
png_name = getPngName(jsonData.name);
|
||||
let char = { "name": jsonData.name, "description": jsonData.description ?? '', "personality": jsonData.personality ?? '', "first_mes": jsonData.first_mes ?? '', "avatar": 'none', "chat": humanizedISO8601DateTime(), "mes_example": jsonData.mes_example ?? '', "scenario": jsonData.scenario ?? '', "create_date": humanizedISO8601DateTime(), "talkativeness": jsonData.talkativeness ?? 0.5 };
|
||||
char = JSON.stringify(char);
|
||||
charaWrite('./public/img/fluffy.png', char, png_name, response, { file_name: png_name });
|
||||
} else if (jsonData.char_name !== undefined) {//json Pygmalion notepad
|
||||
if (jsonData.char_name !== sanitize(jsonData.char_name)) {
|
||||
console.error('Malicious character name prevented');
|
||||
return response.sendStatus(403);
|
||||
}
|
||||
jsonData.char_name = sanitize(jsonData.char_name);
|
||||
|
||||
png_name = getPngName(jsonData.char_name);
|
||||
let char = { "name": jsonData.char_name, "description": jsonData.char_persona ?? '', "personality": '', "first_mes": jsonData.char_greeting ?? '', "avatar": 'none', "chat": humanizedISO8601DateTime(), "mes_example": jsonData.example_dialogue ?? '', "scenario": jsonData.world_scenario ?? '', "create_date": humanizedISO8601DateTime(), "talkativeness": jsonData.talkativeness ?? 0.5 };
|
||||
@ -1266,11 +1257,7 @@ app.post("/importcharacter", urlencodedParser, async function (request, response
|
||||
|
||||
var img_data = charaRead('./uploads/' + filedata.filename);
|
||||
let jsonData = JSON.parse(img_data);
|
||||
|
||||
if (jsonData.name !== sanitize(jsonData.name)) {
|
||||
console.error('Malicious character name prevented');
|
||||
return response.sendStatus(403);
|
||||
}
|
||||
jsonData.name = sanitize(jsonData.name);
|
||||
|
||||
png_name = getPngName(jsonData.name);
|
||||
|
||||
|
Reference in New Issue
Block a user