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

View File

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