Separate Kobold Horde status function

This commit is contained in:
valadaptive 2023-12-10 20:16:07 -05:00
parent 23e6a10cb5
commit 1fbf4394c8
2 changed files with 26 additions and 31 deletions

View File

@ -868,21 +868,19 @@ export async function clearItemizedPrompts() {
}
}
async function getStatusKobold() {
if (main_api == 'koboldhorde') {
try {
const hordeStatus = await checkHordeStatus();
online_status = hordeStatus ? 'Connected' : 'no_connection';
}
catch {
online_status = 'no_connection';
}
return resultCheckStatus();
async function getStatusHorde() {
try {
const hordeStatus = await checkHordeStatus();
online_status = hordeStatus ? 'Connected' : 'no_connection';
}
catch {
online_status = 'no_connection';
}
const url = '/getstatus';
return resultCheckStatus();
}
async function getStatusKobold() {
let endpoint = api_server;
if (!endpoint) {
@ -891,7 +889,7 @@ async function getStatusKobold() {
}
try {
const response = await fetch(url, {
const response = await fetch('/getstatus', {
method: 'POST',
headers: getRequestHeaders(),
body: JSON.stringify({
@ -903,7 +901,6 @@ async function getStatusKobold() {
const data = await response.json();
online_status = data?.result;
if (!online_status) {
@ -5378,7 +5375,7 @@ function changeMainAPI() {
}
if (main_api == 'koboldhorde') {
getStatusKobold();
getStatusHorde();
getHordeModels();
}

View File

@ -661,22 +661,20 @@ app.post('/getstatus', jsonParser, async function (request, response) {
let version = '';
let koboldVersion = {};
if (request.body.main_api == 'kobold') {
try {
version = (await fetchJSON(api_server + '/v1/info/version')).result;
}
catch {
version = '0.0.0';
}
try {
koboldVersion = (await fetchJSON(api_server + '/extra/version'));
}
catch {
koboldVersion = {
result: 'Kobold',
version: '0.0',
};
}
try {
version = (await fetchJSON(api_server + '/v1/info/version')).result;
}
catch {
version = '0.0.0';
}
try {
koboldVersion = (await fetchJSON(api_server + '/extra/version'));
}
catch {
koboldVersion = {
result: 'Kobold',
version: '0.0',
};
}
try {