mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Refactor status checks and indicators.
This commit is contained in:
24
server.js
24
server.js
@@ -536,7 +536,7 @@ app.post("/api/textgenerationwebui/status", jsonParser, async function (request,
|
||||
console.log('Models available:', modelIds);
|
||||
|
||||
const result = modelIds[0] ?? 'Valid';
|
||||
return response.send({ result });
|
||||
return response.send({ result, data: data.data });
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
return response.status(500);
|
||||
@@ -674,28 +674,6 @@ app.post("/getchat", jsonParser, function (request, response) {
|
||||
}
|
||||
});
|
||||
|
||||
app.post("/api/mancer/models", jsonParser, async function (_req, res) {
|
||||
try {
|
||||
const response = await fetch('https://neuro.mancer.tech/oai/v1/models');
|
||||
const data = await response.json();
|
||||
|
||||
if (!response.ok) {
|
||||
console.log('Mancer models endpoint is offline.');
|
||||
return res.json([]);
|
||||
}
|
||||
|
||||
if (!Array.isArray(data.data)) {
|
||||
console.log('Mancer models response is not an array.')
|
||||
return res.json([]);
|
||||
}
|
||||
|
||||
return res.json(data.data);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
return res.json([]);
|
||||
}
|
||||
});
|
||||
|
||||
// Only called for kobold and ooba/mancer
|
||||
app.post("/getstatus", jsonParser, async function (request, response) {
|
||||
if (!request.body) return response.sendStatus(400);
|
||||
|
Reference in New Issue
Block a user