Not connected
diff --git a/public/script.js b/public/script.js
index 38c16338e..a049997c2 100644
--- a/public/script.js
+++ b/public/script.js
@@ -627,6 +627,8 @@ function checkOnlineStatus() {
if (online_status == "no_connection") {
$("#online_status_indicator2").css("background-color", "red"); //Kobold
$("#online_status_text2").html("No connection...");
+ $("#online_status_indicator_horde").css("background-color", "red"); //Kobold Horde
+ $("#online_status_text_horde").html("No connection...");
$("#online_status_indicator3").css("background-color", "red"); //Novel
$("#online_status_text3").html("No connection...");
$(".online_status_indicator4").css("background-color", "red"); //OAI / ooba
@@ -638,6 +640,8 @@ function checkOnlineStatus() {
} else {
$("#online_status_indicator2").css("background-color", "green"); //kobold
$("#online_status_text2").html(online_status);
+ $("#online_status_indicator_horde").css("background-color", "green"); //Kobold Horde
+ $("#online_status_text_horde").html(online_status);
$("#online_status_indicator3").css("background-color", "green"); //novel
$("#online_status_text3").html(online_status);
$(".online_status_indicator4").css("background-color", "green"); //OAI / ooba
@@ -647,7 +651,7 @@ function checkOnlineStatus() {
async function getStatus() {
if (is_get_status) {
- if (main_api == "kobold" && horde_settings.use_horde) {
+ if (main_api == "koboldhorde") {
try {
const hordeStatus = await checkHordeStatus();
online_status = hordeStatus ? 'Connected' : 'no_connection';
@@ -693,7 +697,7 @@ async function getStatus() {
}
// determine if we can use stop sequence
- if (main_api == "kobold") {
+ if (main_api === "kobold" || main_api === "koboldhorde") {
kai_settings.use_stop_sequence = canUseKoboldStopSequence(data.version);
}
@@ -1887,7 +1891,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
// Adjust token limit for Horde
let adjustedParams;
- if (main_api == 'kobold' && horde_settings.use_horde && (horde_settings.auto_adjust_context_length || horde_settings.auto_adjust_response_length)) {
+ if (main_api == 'koboldhorde' && (horde_settings.auto_adjust_context_length || horde_settings.auto_adjust_response_length)) {
try {
adjustedParams = await adjustHordeGenerationParams(max_context, amount_gen);
}
@@ -2153,7 +2157,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
let thisPromptBits = [];
- if (main_api == 'kobold' && horde_settings.use_horde && horde_settings.auto_adjust_response_length) {
+ if (main_api == 'koboldhorde' && horde_settings.auto_adjust_response_length) {
this_amount_gen = Math.min(this_amount_gen, adjustedParams.maxLength);
this_amount_gen = Math.max(this_amount_gen, MIN_AMOUNT_GEN); // prevent validation errors
}
@@ -2169,10 +2173,13 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
singleline: kai_settings.single_line,
};
- if (preset_settings != 'gui' || horde_settings.use_horde) {
- const maxContext = horde_settings.use_horde && horde_settings.auto_adjust_context_length ? adjustedParams.maxContextLength : max_context;
+ }
+ else if(main_api == 'koboldhorde'){
+ if (preset_settings != 'gui') {
+ const maxContext = horde_settings.auto_adjust_context_length ? adjustedParams.maxContextLength : max_context;
generate_data = getKoboldGenerationData(finalPromt, this_settings, this_amount_gen, maxContext, isImpersonate);
}
+
}
else if (main_api == 'textgenerationwebui') {
generate_data = getTextGenGenerationData(finalPromt, this_amount_gen, isImpersonate);
@@ -2211,7 +2218,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
sendOpenAIRequest(type, generate_data.prompt).then(onSuccess).catch(onError);
}
}
- else if (main_api == 'kobold' && horde_settings.use_horde) {
+ else if (main_api == 'koboldhorde') {
generateHorde(finalPromt, generate_data).then(onSuccess).catch(onError);
}
else if (main_api == 'poe') {
@@ -2464,7 +2471,7 @@ function sendMessageAsUser(textareaText, messageBias) {
function getMaxContextSize() {
let this_max_context = 1487;
- if (main_api == 'kobold' || main_api == 'textgenerationwebui') {
+ if (main_api == 'kobold' || main_api == 'koboldhorde' || main_api == 'textgenerationwebui') {
this_max_context = (max_context - amount_gen);
}
if (main_api == 'novel') {
@@ -3017,7 +3024,7 @@ function throwCircuitBreakerError() {
}
function extractTitleFromData(data) {
- if (main_api == 'kobold' && horde_settings.use_horde) {
+ if (main_api == 'koboldhorde') {
return data.workerName;
}
@@ -3027,11 +3034,11 @@ function extractTitleFromData(data) {
function extractMessageFromData(data) {
let getMessage = "";
- if (main_api == 'kobold' && !horde_settings.use_horde) {
+ if (main_api == 'kobold') {
getMessage = data.results[0].text;
}
- if (main_api == 'kobold' && horde_settings.use_horde) {
+ if (main_api == 'koboldhorde') {
getMessage = data.text;
}
@@ -3227,7 +3234,7 @@ function extractImageFromMessage(getMessage) {
}
export function isMultigenEnabled() {
- return power_user.multigen && (main_api == 'textgenerationwebui' || main_api == 'kobold' || main_api == 'novel');
+ return power_user.multigen && (main_api == 'textgenerationwebui' || main_api == 'kobold' || main_api == 'koboldhorde' || main_api == 'novel');
}
function activateSendButtons() {
@@ -3539,6 +3546,15 @@ function changeMainAPI() {
const selectedVal = $("#main_api").val();
//console.log(selectedVal);
const apiElements = {
+ "koboldhorde": {
+ apiSettings: $("#kobold_api-settings"),
+ apiConnector: $("#kobold_horde"),
+ apiPresets: $('#kobold_api-presets'),
+ apiRanges: $("#range_block"),
+ maxContextElem: $("#max_context_block"),
+ amountGenElem: $("#amount_gen_block"),
+ softPromptElem: $("#softprompt_block")
+ },
"kobold": {
apiSettings: $("#kobold_api-settings"),
apiConnector: $("#kobold_api"),
@@ -3588,49 +3604,62 @@ function changeMainAPI() {
//console.log('--- apiElements--- ');
//console.log(apiElements);
+ //first, disable everything so the old elements stop showing
for (const apiName in apiElements) {
const apiObj = apiElements[apiName];
- const isCurrentApi = selectedVal === apiName;
-
- apiObj.apiSettings.css("display", isCurrentApi ? "block" : "none");
- apiObj.apiConnector.css("display", isCurrentApi ? "block" : "none");
- apiObj.apiRanges.css("display", isCurrentApi ? "block" : "none");
- apiObj.apiPresets.css("display", isCurrentApi ? "block" : "none");
-
- if (isCurrentApi && apiName === "openai") {
- apiObj.apiPresets.css("display", "flex");
+ //do not hide items to then proceed to immediately show them.
+ if(selectedVal === apiName){
+ continue;
}
+ apiObj.apiSettings.css("display", "none");
+ apiObj.apiConnector.css("display", "none");
+ apiObj.apiRanges.css("display", "none");
+ apiObj.apiPresets.css("display", "none");
+ }
- if (isCurrentApi && apiName === "kobold") {
- //console.log("enabling SP for kobold");
- $("#softprompt_block").css("display", "block");
- }
+ //then, find and enable the active item.
+ //This is split out of the loop so that different apis can share settings divs
+ let activeItem = apiElements[selectedVal];
- if (isCurrentApi && (apiName === "textgenerationwebui" || apiName === "novel")) {
- console.log("enabling amount_gen for ooba/novel");
- apiObj.amountGenElem.find('input').prop("disabled", false);
- apiObj.amountGenElem.css("opacity", 1.0);
- }
+ activeItem.apiSettings.css("display", "block");
+ activeItem.apiConnector.css("display", "block");
+ activeItem.apiRanges.css("display", "block");
+ activeItem.apiPresets.css("display", "block");
- // Hide common settings for OpenAI
- if (selectedVal == "openai") {
- $("#common-gen-settings-block").css("display", "none");
- } else {
- $("#common-gen-settings-block").css("display", "block");
- }
- // Hide amount gen for poe
- if (selectedVal == "poe") {
- $("#amount_gen_block").css("display", "none");
- } else {
- $("#amount_gen_block").css("display", "flex");
- }
+ if (selectedVal === "openai") {
+ activeItem.apiPresets.css("display", "flex");
+ }
+ if (selectedVal === "kobold" || selectedVal === 'koboldhorde') {
+ //console.log("enabling SP for kobold");
+ $("#softprompt_block").css("display", "block");
+ }
+
+ if (selectedVal === "textgenerationwebui" || selectedVal === "novel") {
+ console.log("enabling amount_gen for ooba/novel");
+ activeItem.amountGenElem.find('input').prop("disabled", false);
+ activeItem.amountGenElem.css("opacity", 1.0);
+ }
+
+ // Hide common settings for OpenAI
+ console.log('value?', selectedVal);
+ if (selectedVal == "openai") {
+ console.log('hiding settings?');
+ $("#common-gen-settings-block").css("display", "none");
+ } else {
+ $("#common-gen-settings-block").css("display", "block");
+ }
+ // Hide amount gen for poe
+ if (selectedVal == "poe") {
+ $("#amount_gen_block").css("display", "none");
+ } else {
+ $("#amount_gen_block").css("display", "flex");
}
main_api = selectedVal;
online_status = "no_connection";
- if (main_api == "kobold" && horde_settings.use_horde) {
+ if (main_api == "koboldhorde") {
is_get_status = true;
getStatus();
getHordeModels();
@@ -4572,7 +4601,7 @@ function setGenerationProgress(progress) {
}
function isHordeGenerationNotAllowed() {
- if (main_api == "kobold" && horde_settings.use_horde && preset_settings == "gui") {
+ if (main_api == "koboldhorde" && preset_settings == "gui") {
toastr.error('GUI Settings preset is not supported for Horde. Please select another preset.');
return true;
}
@@ -5676,7 +5705,7 @@ $(document).ready(function () {
$("#api_button").click(function (e) {
e.stopPropagation();
- if ($("#api_url_text").val() != "" && !horde_settings.use_horde) {
+ if ($("#api_url_text").val() != "") {
let value = formatKoboldUrl($.trim($("#api_url_text").val()));
if (!value) {
@@ -5697,12 +5726,6 @@ $(document).ready(function () {
clearSoftPromptsList();
getSoftPromptsList();
}
- else if (horde_settings.use_horde) {
- main_api = "kobold";
- is_get_status = true;
- getStatus();
- clearSoftPromptsList();
- }
});
$("#api_button_textgenerationwebui").click(function (e) {
diff --git a/public/scripts/horde.js b/public/scripts/horde.js
index a5dc63b18..8361033be 100644
--- a/public/scripts/horde.js
+++ b/public/scripts/horde.js
@@ -16,7 +16,6 @@ let models = [];
let horde_settings = {
models: [],
- use_horde: false,
auto_adjust_response_length: true,
auto_adjust_context_length: false,
};
@@ -180,7 +179,6 @@ function loadHordeSettings(settings) {
Object.assign(horde_settings, settings.horde_settings);
}
- $('#use_horde').prop("checked", horde_settings.use_horde).trigger('input');
$('#horde_auto_adjust_response_length').prop("checked", horde_settings.auto_adjust_response_length);
$('#horde_auto_adjust_context_length').prop("checked", horde_settings.auto_adjust_context_length);
}
@@ -208,23 +206,6 @@ async function showKudos() {
}
jQuery(function () {
- $("#use_horde").on("input", async function () {
- horde_settings.use_horde = !!$(this).prop("checked");
-
- if (horde_settings.use_horde) {
- $('#kobold_api_block').hide();
- $('#kobold_horde_block').show();
- }
- else {
- $('#kobold_api_block').show();
- $('#kobold_horde_block').hide();
- }
-
- // Trigger status check
- changeMainAPI();
- saveSettingsDebounced();
- });
-
$("#horde_model").on("change", function () {
horde_settings.models = $('#horde_model').val();
console.log('Updated Horde models', horde_settings.models);
diff --git a/public/style.css b/public/style.css
index 4d2c203ef..fe976a30d 100644
--- a/public/style.css
+++ b/public/style.css
@@ -1721,6 +1721,7 @@ input[type=search]:focus::-webkit-search-cancel-button {
/* ------ online status indicators and texts. 2 = kobold AI, 3 = Novel AI ----------*/
#online_status2,
+#online_status_horde,
.online_status4 {
opacity: 0.5;
margin-top: 2px;
@@ -1728,6 +1729,7 @@ input[type=search]:focus::-webkit-search-cancel-button {
}
#online_status_indicator2,
+#online_status_indicator_horde,
.online_status_indicator4 {
border-radius: 7px;
width: 14px;
@@ -1737,6 +1739,7 @@ input[type=search]:focus::-webkit-search-cancel-button {
}
#online_status_text2,
+#online_status_text_horde,
.online_status_text4 {
margin-left: 4px;
display: inline-block;
From 85ef2b6848a563088e864559f961c6acd53a9a77 Mon Sep 17 00:00:00 2001
From: SillyLossy
Date: Wed, 24 May 2023 11:48:39 +0300
Subject: [PATCH 3/5] Move Poe nudges to Generate anchors appendage
---
public/index.html | 4 ++--
public/script.js | 9 ++++++++-
public/scripts/poe.js | 38 +++++++++++++++++---------------------
3 files changed, 27 insertions(+), 24 deletions(-)
diff --git a/public/index.html b/public/index.html
index 9324e47e1..698ebfbc0 100644
--- a/public/index.html
+++ b/public/index.html
@@ -945,7 +945,7 @@
Influences bot behavior in its responses.