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,8 +868,7 @@ 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';
@ -879,10 +878,9 @@ async function getStatusKobold() {
} }
return resultCheckStatus(); return resultCheckStatus();
} }
const url = '/getstatus';
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,7 +661,6 @@ 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;
} }
@ -677,7 +676,6 @@ app.post('/getstatus', jsonParser, async function (request, response) {
version: '0.0', version: '0.0',
}; };
} }
}
try { try {
let data = await fetchJSON(url, args); let data = await fetchJSON(url, args);