Reformat code

This commit is contained in:
Cohee
2023-08-20 12:37:38 +03:00
parent 84e5a63c34
commit 94754af013
5 changed files with 33 additions and 33 deletions

View File

@ -7518,7 +7518,7 @@ $(document).ready(function () {
$("#character_search_bar").val("").trigger("input");
});
$(document).on("click", ".character_select", function() {
$(document).on("click", ".character_select", function () {
const id = $(this).attr("chid");
selectCharacterById(id);
});

View File

@ -651,7 +651,7 @@ async function generatePrompt(quiet_prompt) {
return processReply(reply);
}
async function sendGenerationRequest(generationType, prompt, characterName=null, callback) {
async function sendGenerationRequest(generationType, prompt, characterName = null, callback) {
const prefix = generationType !== generationMode.BACKGROUND
? combinePrefixes(extension_settings.sd.prompt_prefix, getCharacterPrefix())
: extension_settings.sd.prompt_prefix;

View File

@ -382,7 +382,7 @@ function getGroupAvatar(group) {
if (!group) {
return $(`<div class="avatar"><img src="${default_avatar}"></div>`);
}
// if isDataURL or if it's a valid local file url
// if isDataURL or if it's a valid local file url
if (isValidImageUrl(group.avatar_url)) {
return $(`<div class="avatar"><img src="${group.avatar_url}"></div>`);
}
@ -1132,7 +1132,7 @@ function select_group_chats(groupId, skipAnimation) {
$("#rm_group_automode_label").hide();
}
eventSource.emit('groupSelected', {detail: {id: openGroupId, group: group}});
eventSource.emit('groupSelected', { detail: { id: openGroupId, group: group } });
}
/**

View File

@ -565,7 +565,7 @@ export function extractDataFromPng(data, identifier = 'chara') {
* @returns {Promise<string>} - Resolves to the saved image's path on the server.
* Rejects with an error if the upload fails.
*/
export async function saveBase64AsFile(base64Data, characterName, filename="", ext) {
export async function saveBase64AsFile(base64Data, characterName, filename = "", ext) {
// Construct the full data URL
const format = ext; // Extract the file extension (jpg, png, webp)
const dataURL = `data:image/${format};base64,${base64Data}`;

View File

@ -2656,13 +2656,13 @@ app.post('/uploadimage', jsonParser, async (request, response) => {
// Constructing filename and path
let filename = `${Date.now()}.${format}`;
if(request.body.filename){
if (request.body.filename) {
filename = `${request.body.filename}.${format}`;
}
// if character is defined, save to a sub folder for that character
let pathToNewFile = path.join(directories.userImages, filename);
if(request.body.ch_name){
if (request.body.ch_name) {
pathToNewFile = path.join(directories.userImages, request.body.ch_name, filename);
}
@ -2672,7 +2672,7 @@ app.post('/uploadimage', jsonParser, async (request, response) => {
await fs.promises.writeFile(pathToNewFile, imageBuffer);
// send the path to the image, relative to the client folder, which means removing the first folder from the path which is 'public'
pathToNewFile = pathToNewFile.split(path.sep).slice(1).join(path.sep);
response.send({ path:pathToNewFile });
response.send({ path: pathToNewFile });
} catch (error) {
console.log(error);
response.status(500).send({ error: "Failed to save the image" });