mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
fix formatting
This commit is contained in:
@@ -431,35 +431,35 @@ function registerEndpoints(app, jsonParser) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
app.post('/api/sd/comfy/vaes', jsonParser, async(request, response)=>{
|
app.post('/api/sd/comfy/vaes', jsonParser, async (request, response) => {
|
||||||
try {
|
try {
|
||||||
const url = new URL(request.body.url);
|
const url = new URL(request.body.url);
|
||||||
url.pathname = '/object_info'
|
url.pathname = '/object_info'
|
||||||
|
|
||||||
const result = await fetch(url);
|
const result = await fetch(url);
|
||||||
if (!result.ok) {
|
if (!result.ok) {
|
||||||
throw new Error('ComfyUI returned an error.');
|
throw new Error('ComfyUI returned an error.');
|
||||||
}
|
}
|
||||||
|
|
||||||
const data = await result.json();
|
const data = await result.json();
|
||||||
return response.send(data.VAELoader.input.required.vae_name[0]);
|
return response.send(data.VAELoader.input.required.vae_name[0]);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
return response.sendStatus(500);
|
return response.sendStatus(500);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
app.post('/api/sd/comfy/workflows', jsonParser, async(request, response) => {
|
app.post('/api/sd/comfy/workflows', jsonParser, async (request, response) => {
|
||||||
try {
|
try {
|
||||||
const data = getComfyWorkflows();
|
const data = getComfyWorkflows();
|
||||||
return response.send(data);
|
return response.send(data);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
return response.sendStatus(500);
|
return response.sendStatus(500);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
app.post('/api/sd/comfy/workflow', jsonParser, async(request, response)=>{
|
app.post('/api/sd/comfy/workflow', jsonParser, async (request, response) => {
|
||||||
try {
|
try {
|
||||||
let path = `public/user/workflows/${sanitize(String(request.body.file_name))}`;
|
let path = `public/user/workflows/${sanitize(String(request.body.file_name))}`;
|
||||||
if (!fs.existsSync(path)) {
|
if (!fs.existsSync(path)) {
|
||||||
@@ -471,12 +471,12 @@ function registerEndpoints(app, jsonParser) {
|
|||||||
);
|
);
|
||||||
return response.send(JSON.stringify(data));
|
return response.send(JSON.stringify(data));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
return response.sendStatus(500);
|
return response.sendStatus(500);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
app.post('/api/sd/comfy/saveWorkflow', jsonParser, async(request, response)=>{
|
app.post('/api/sd/comfy/saveWorkflow', jsonParser, async (request, response) => {
|
||||||
try {
|
try {
|
||||||
if (!fs.existsSync('public/user/workflows')) {
|
if (!fs.existsSync('public/user/workflows')) {
|
||||||
fs.mkdirSync('public/user/workflows');
|
fs.mkdirSync('public/user/workflows');
|
||||||
@@ -489,12 +489,12 @@ function registerEndpoints(app, jsonParser) {
|
|||||||
const data = getComfyWorkflows();
|
const data = getComfyWorkflows();
|
||||||
return response.send(data);
|
return response.send(data);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
return response.sendStatus(500);
|
return response.sendStatus(500);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
app.post('/api/sd/comfy/deleteWorkflow', jsonParser, async(request, response)=>{
|
app.post('/api/sd/comfy/deleteWorkflow', jsonParser, async (request, response) => {
|
||||||
try {
|
try {
|
||||||
let path = `public/user/workflows/${sanitize(String(request.body.file_name))}`;
|
let path = `public/user/workflows/${sanitize(String(request.body.file_name))}`;
|
||||||
if (fs.existsSync(path)) {
|
if (fs.existsSync(path)) {
|
||||||
@@ -502,22 +502,22 @@ function registerEndpoints(app, jsonParser) {
|
|||||||
}
|
}
|
||||||
return response.sendStatus(200);
|
return response.sendStatus(200);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
return response.sendStatus(500);
|
return response.sendStatus(500);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
app.post('/api/sd/comfy/workflows', jsonParser, async (request, response)=>{
|
app.post('/api/sd/comfy/workflows', jsonParser, async (request, response) => {
|
||||||
try {
|
try {
|
||||||
const data = getComfyWorkflows();
|
const data = getComfyWorkflows();
|
||||||
return response.send(data);
|
return response.send(data);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
return response.sendStatus(500);
|
return response.sendStatus(500);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
app.post('/api/sd/comfy/workflow', jsonParser, async(request, response)=>{
|
app.post('/api/sd/comfy/workflow', jsonParser, async (request, response) => {
|
||||||
try {
|
try {
|
||||||
let path = `public/user/workflows/${sanitize(String(request.body.file_name))}`;
|
let path = `public/user/workflows/${sanitize(String(request.body.file_name))}`;
|
||||||
if (!fs.existsSync(path)) {
|
if (!fs.existsSync(path)) {
|
||||||
@@ -529,12 +529,12 @@ function registerEndpoints(app, jsonParser) {
|
|||||||
);
|
);
|
||||||
return response.send(JSON.stringify(data));
|
return response.send(JSON.stringify(data));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
return response.sendStatus(500);
|
return response.sendStatus(500);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
app.post('/api/sd/comfy/saveWorkflow', jsonParser, async(request, response)=>{
|
app.post('/api/sd/comfy/saveWorkflow', jsonParser, async (request, response) => {
|
||||||
try {
|
try {
|
||||||
if (!fs.existsSync('public/user/workflows')) {
|
if (!fs.existsSync('public/user/workflows')) {
|
||||||
fs.mkdirSync('public/user/workflows');
|
fs.mkdirSync('public/user/workflows');
|
||||||
@@ -547,12 +547,12 @@ function registerEndpoints(app, jsonParser) {
|
|||||||
const data = getComfyWorkflows();
|
const data = getComfyWorkflows();
|
||||||
return response.send(data);
|
return response.send(data);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
return response.sendStatus(500);
|
return response.sendStatus(500);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
app.post('/api/sd/comfy/deleteWorkflow', jsonParser, async(request, response)=>{
|
app.post('/api/sd/comfy/deleteWorkflow', jsonParser, async (request, response) => {
|
||||||
try {
|
try {
|
||||||
let path = `public/user/workflows/${sanitize(String(request.body.file_name))}`;
|
let path = `public/user/workflows/${sanitize(String(request.body.file_name))}`;
|
||||||
if (fs.existsSync(path)) {
|
if (fs.existsSync(path)) {
|
||||||
@@ -560,9 +560,9 @@ function registerEndpoints(app, jsonParser) {
|
|||||||
}
|
}
|
||||||
return response.sendStatus(200);
|
return response.sendStatus(200);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
return response.sendStatus(500);
|
return response.sendStatus(500);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
app.post('/api/sd/comfy/generate', jsonParser, async (request, response) => {
|
app.post('/api/sd/comfy/generate', jsonParser, async (request, response) => {
|
||||||
|
Reference in New Issue
Block a user