Add schedulers selection for AUTO1111

This commit is contained in:
Cohee
2024-05-30 21:04:22 +03:00
parent e0ba516551
commit 6228d1d3b1
3 changed files with 59 additions and 7 deletions

View File

@ -160,6 +160,31 @@ router.post('/samplers', jsonParser, async (request, response) => {
}
});
router.post('/schedulers', jsonParser, async (request, response) => {
try {
const url = new URL(request.body.url);
url.pathname = '/sdapi/v1/schedulers';
const result = await fetch(url, {
method: 'GET',
headers: {
'Authorization': getBasicAuthHeader(request.body.auth),
},
});
if (!result.ok) {
throw new Error('SD WebUI returned an error.');
}
const data = await result.json();
const names = data.map(x => x.name);
return response.send(names);
} catch (error) {
console.log(error);
return response.sendStatus(500);
}
});
router.post('/models', jsonParser, async (request, response) => {
try {
const url = new URL(request.body.url);