Merge pull request #1511 from valadaptive/more-kobold-cleanups

More Kobold cleanups
This commit is contained in:
Cohee
2023-12-11 20:59:49 +02:00
committed by GitHub
3 changed files with 56 additions and 153 deletions

View File

@ -867,21 +867,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) {
@ -890,7 +888,7 @@ async function getStatusKobold() {
}
try {
const response = await fetch(url, {
const response = await fetch('/getstatus', {
method: 'POST',
headers: getRequestHeaders(),
body: JSON.stringify({
@ -902,18 +900,17 @@ async function getStatusKobold() {
const data = await response.json();
online_status = data?.model ?? 'no_connection';
online_status = data?.result;
if (!online_status) {
online_status = 'no_connection';
if (!data.koboldUnitedVersion) {
throw new Error('Missing mandatory Kobold version in data:', data);
}
// Determine instruct mode preset
autoSelectInstructPreset(online_status);
// determine if we can use stop sequence and streaming
setKoboldFlags(data.version, data.koboldVersion);
setKoboldFlags(data.koboldUnitedVersion, data.koboldCppVersion);
// We didn't get a 200 status code, but the endpoint has an explanation. Which means it DID connect, but I digress.
if (online_status === 'no_connection' && data.response) {
@ -5362,7 +5359,7 @@ function changeMainAPI() {
}
if (main_api == 'koboldhorde') {
getStatusKobold();
getStatusHorde();
getHordeModels();
}
@ -7268,7 +7265,7 @@ const swipe_right = () => {
}
if (isHordeGenerationNotAllowed()) {
return;
return unblockGeneration();
}
const swipe_duration = 200;