imported char's first chats get proper names

This commit is contained in:
RossAscends
2023-04-26 22:47:43 +09:00
parent d49602adc6
commit 8f3da37c61

View File

@ -1471,14 +1471,14 @@ app.post("/importcharacter", urlencodedParser, async function (request, response
jsonData.name = sanitize(jsonData.name); jsonData.name = sanitize(jsonData.name);
png_name = getPngName(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 }; let char = { "name": jsonData.name, "description": jsonData.description ?? '', "personality": jsonData.personality ?? '', "first_mes": jsonData.first_mes ?? '', "avatar": 'none', "chat": jsonData.name + " - " + humanizedISO8601DateTime(), "mes_example": jsonData.mes_example ?? '', "scenario": jsonData.scenario ?? '', "create_date": humanizedISO8601DateTime(), "talkativeness": jsonData.talkativeness ?? 0.5 };
char = JSON.stringify(char); char = JSON.stringify(char);
charaWrite('./public/img/ai4.png', char, png_name, response, { file_name: png_name }); charaWrite('./public/img/ai4.png', char, png_name, response, { file_name: png_name });
} else if (jsonData.char_name !== undefined) {//json Pygmalion notepad } else if (jsonData.char_name !== undefined) {//json Pygmalion notepad
jsonData.char_name = sanitize(jsonData.char_name); jsonData.char_name = sanitize(jsonData.char_name);
png_name = getPngName(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 }; let char = { "name": jsonData.char_name, "description": jsonData.char_persona ?? '', "personality": '', "first_mes": jsonData.char_greeting ?? '', "avatar": 'none', "chat": jsonData.name + " - " + humanizedISO8601DateTime(), "mes_example": jsonData.example_dialogue ?? '', "scenario": jsonData.world_scenario ?? '', "create_date": humanizedISO8601DateTime(), "talkativeness": jsonData.talkativeness ?? 0.5 };
char = JSON.stringify(char); char = JSON.stringify(char);
charaWrite('./public/img/ai4.png', char, png_name, response, { file_name: png_name }); charaWrite('./public/img/ai4.png', char, png_name, response, { file_name: png_name });
} else { } else {
@ -1501,7 +1501,7 @@ app.post("/importcharacter", urlencodedParser, async function (request, response
png_name = getPngName(jsonData.name); png_name = getPngName(jsonData.name);
if (jsonData.name !== undefined) { if (jsonData.name !== undefined) {
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 }; let char = { "name": jsonData.name, "description": jsonData.description ?? '', "personality": jsonData.personality ?? '', "first_mes": jsonData.first_mes ?? '', "avatar": 'none', "chat": jsonData.name + " - " + humanizedISO8601DateTime(), "mes_example": jsonData.mes_example ?? '', "scenario": jsonData.scenario ?? '', "create_date": humanizedISO8601DateTime(), "talkativeness": jsonData.talkativeness ?? 0.5 };
char = JSON.stringify(char); char = JSON.stringify(char);
await charaWrite(uploadPath, char, png_name, response, { file_name: png_name }); await charaWrite(uploadPath, char, png_name, response, { file_name: png_name });
} }