Samplers Order
diff --git a/public/scripts/kai-settings.js b/public/scripts/kai-settings.js
index 517e32b2f..29d63e729 100644
--- a/public/scripts/kai-settings.js
+++ b/public/scripts/kai-settings.js
@@ -28,6 +28,7 @@ export const kai_settings = {
mirostat_eta: 0.1,
use_default_badwordsids: false,
grammar: "",
+ seed: -1,
};
export const kai_flags = {
@@ -136,6 +137,7 @@ export function getKoboldGenerationData(finalPrompt, settings, maxLength, maxCon
mirostat_eta: kai_flags.can_use_mirostat ? kai_settings.mirostat_eta : undefined,
use_default_badwordsids: kai_flags.can_use_default_badwordsids ? kai_settings.use_default_badwordsids : undefined,
grammar: kai_flags.can_use_grammar ? substituteParams(kai_settings.grammar) : undefined,
+ sampler_seed: kai_settings.seed >= 0 ? kai_settings.seed : undefined,
};
return generate_data;
}
@@ -281,6 +283,13 @@ const sliders = [
format: (val) => val,
setValue: (val) => { kai_settings.grammar = val; },
},
+ {
+ name: "seed",
+ sliderId: "#seed_kobold",
+ counterId: "#seed_counter_kobold",
+ format: (val) => val,
+ setValue: (val) => { kai_settings.seed = Number(val); },
+ },
];
export function setKoboldFlags(version, koboldVersion) {
diff --git a/public/scripts/preset-manager.js b/public/scripts/preset-manager.js
index e8a012bab..0d75f40b2 100644
--- a/public/scripts/preset-manager.js
+++ b/public/scripts/preset-manager.js
@@ -262,6 +262,7 @@ class PresetManager {
'model_novel',
'streaming_kobold',
"enabled",
+ 'seed',
];
const settings = Object.assign({}, getSettingsByApiId(this.apiId));
diff --git a/server.js b/server.js
index 94dcc9ace..8f6c31f9f 100644
--- a/server.js
+++ b/server.js
@@ -401,6 +401,7 @@ app.post("/generate", jsonParser, async function (request, response_generate) {
mirostat_eta: request.body.mirostat_eta,
mirostat_tau: request.body.mirostat_tau,
grammar: request.body.grammar,
+ sampler_seed: request.body.sampler_seed,
};
if (!!request.body.stop_sequence) {
this_settings['stop_sequence'] = request.body.stop_sequence;
From 11cc27d9c92f2e4e251a215d6efc3862d809ab32 Mon Sep 17 00:00:00 2001
From: Cohee <18619528+Cohee1207@users.noreply.github.com>
Date: Thu, 26 Oct 2023 22:02:56 +0300
Subject: [PATCH 3/8] Increase debounce duration for type-in controls to 2sec
---
public/script.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/public/script.js b/public/script.js
index edb74c1ce..787d4d9dd 100644
--- a/public/script.js
+++ b/public/script.js
@@ -8815,7 +8815,7 @@ jQuery(async function () {
}
restoreCaretPosition($(this).get(0), caretPosition);
- }, 500);
+ }, 2000);
})
$(".user_stats_button").on('click', function () {
From 167b2d0fe468c8eac04540d04f47d976aad683b9 Mon Sep 17 00:00:00 2001
From: Cohee <18619528+Cohee1207@users.noreply.github.com>
Date: Fri, 27 Oct 2023 01:03:54 +0300
Subject: [PATCH 4/8] Add exception handling to stats writer
---
statsHelpers.js | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/statsHelpers.js b/statsHelpers.js
index ee344d303..c370fa588 100644
--- a/statsHelpers.js
+++ b/statsHelpers.js
@@ -173,8 +173,12 @@ async function loadStatsFile(chatsPath, charactersPath, recreateStats = false) {
async function saveStatsToFile() {
if (charStats.timestamp > lastSaveTimestamp) {
//console.debug("Saving stats to file...");
- await writeFile(statsFilePath, JSON.stringify(charStats));
- lastSaveTimestamp = Date.now();
+ try {
+ await writeFile(statsFilePath, JSON.stringify(charStats));
+ lastSaveTimestamp = Date.now();
+ } catch (error) {
+ console.log("Failed to save stats to file.", error);
+ }
} else {
//console.debug('Stats have not changed since last save. Skipping file write.');
}
@@ -184,9 +188,9 @@ async function saveStatsToFile() {
* Attempts to save charStats to a file and then terminates the process.
* If an error occurs during the file write, it logs the error before exiting.
*/
-async function writeStatsToFileAndExit(charStats) {
+async function writeStatsToFileAndExit() {
try {
- await saveStatsToFile(charStats);
+ await saveStatsToFile();
} catch (err) {
console.error("Failed to write stats to file:", err);
} finally {
From 410599b287d71f881bf328588621f5f537f005c8 Mon Sep 17 00:00:00 2001
From: Cohee <18619528+Cohee1207@users.noreply.github.com>
Date: Fri, 27 Oct 2023 02:01:09 +0300
Subject: [PATCH 5/8] Fix unlocked context sliders sanity
---
public/scripts/power-user.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/public/scripts/power-user.js b/public/scripts/power-user.js
index ce689e41a..b18168803 100644
--- a/public/scripts/power-user.js
+++ b/public/scripts/power-user.js
@@ -46,7 +46,7 @@ export {
export const MAX_CONTEXT_DEFAULT = 8192;
const MAX_CONTEXT_UNLOCKED = 65536;
-const unlockedMaxContextStep = 4096
+const unlockedMaxContextStep = 1024
const unlockedMaxContestMin = 8192
const defaultStoryString = "{{#if system}}{{system}}\n{{/if}}{{#if description}}{{description}}\n{{/if}}{{#if personality}}{{char}}'s personality: {{personality}}\n{{/if}}{{#if scenario}}Scenario: {{scenario}}\n{{/if}}{{#if persona}}{{persona}}\n{{/if}}";
@@ -1087,7 +1087,7 @@ function loadMaxContextUnlocked() {
function switchMaxContextSize() {
const elements = [$('#max_context'), $('#rep_pen_range'), $('#rep_pen_range_textgenerationwebui')];
const maxValue = power_user.max_context_unlocked ? MAX_CONTEXT_UNLOCKED : MAX_CONTEXT_DEFAULT;
- const minValue = power_user.max_context_unlocked ? unlockedMaxContestMin : 0;
+ const minValue = power_user.max_context_unlocked ? 0 : 0;
const steps = power_user.max_context_unlocked ? unlockedMaxContextStep : 256;
for (const element of elements) {
From 0c36d113bf1abab31efbc0f4989e43dc6bac8670 Mon Sep 17 00:00:00 2001
From: Cohee <18619528+Cohee1207@users.noreply.github.com>
Date: Fri, 27 Oct 2023 13:07:56 +0300
Subject: [PATCH 6/8] Add git disclaimer to asset downloader
---
public/scripts/extensions.js | 5 +++--
public/scripts/extensions/assets/index.js | 8 ++++++++
public/scripts/extensions/assets/style.css | 8 +++++++-
src/extensions.js | 11 +++++++++--
4 files changed, 27 insertions(+), 5 deletions(-)
diff --git a/public/scripts/extensions.js b/public/scripts/extensions.js
index 0e519c125..810dada5f 100644
--- a/public/scripts/extensions.js
+++ b/public/scripts/extensions.js
@@ -733,8 +733,9 @@ export async function installExtension(url) {
});
if (!request.ok) {
- toastr.info(request.statusText, 'Extension installation failed');
- console.error('Extension installation failed', request.status, request.statusText);
+ const text = await request.text();
+ toastr.warning(text || request.statusText, 'Extension installation failed', { timeOut: 5000 });
+ console.error('Extension installation failed', request.status, request.statusText, text);
return;
}
diff --git a/public/scripts/extensions/assets/index.js b/public/scripts/extensions/assets/index.js
index 78ea75061..fe6cd12ef 100644
--- a/public/scripts/extensions/assets/index.js
+++ b/public/scripts/extensions/assets/index.js
@@ -55,6 +55,14 @@ function downloadAssetsList(url) {
for (const assetType of assetTypes) {
let assetTypeMenu = $('
', { id: "assets_audio_ambient_div", class: "assets-list-div" });
assetTypeMenu.append(`
${assetType}
`)
+
+ if (assetType == 'extension') {
+ assetTypeMenu.append(`
+
+ To download extensions from this page, you need to have
Git installed.
+
`);
+ }
+
for (const i in availableAssets[assetType]) {
const asset = availableAssets[assetType][i];
const elemId = `assets_install_${assetType}_${i}`;
diff --git a/public/scripts/extensions/assets/style.css b/public/scripts/extensions/assets/style.css
index 5bd10be56..15c84d723 100644
--- a/public/scripts/extensions/assets/style.css
+++ b/public/scripts/extensions/assets/style.css
@@ -13,11 +13,17 @@
padding: 5px;
}
+.assets-list-git {
+ font-size: calc(var(--mainFontSize) * 0.8);
+ opacity: 0.8;
+ margin-bottom: 1em;
+}
+
.assets-list-div h3 {
text-transform: capitalize;
}
-.assets-list-div a {
+.assets-list-div i a {
color: inherit;
}
diff --git a/src/extensions.js b/src/extensions.js
index 21d2a924a..fec214244 100644
--- a/src/extensions.js
+++ b/src/extensions.js
@@ -2,6 +2,7 @@ const path = require('path');
const fs = require('fs');
const { default: simpleGit } = require('simple-git');
const sanitize = require('sanitize-filename');
+const commandExistsSync = require('command-exists').sync;
const { DIRECTORIES } = require('./constants');
/**
@@ -61,12 +62,19 @@ function registerEndpoints(app, jsonParser) {
* @returns {void}
*/
app.post('/api/extensions/install', jsonParser, async (request, response) => {
- const git = simpleGit();
+ const gitExists = commandExistsSync('git');
+
+ if (!gitExists) {
+ return response.status(400).send('Server Error: git is not installed on the system.');
+ }
+
if (!request.body.url) {
return response.status(400).send('Bad Request: URL is required in the request body.');
}
try {
+ const git = simpleGit();
+
// make sure the third-party directory exists
if (!fs.existsSync(path.join(DIRECTORIES.extensions, 'third-party'))) {
fs.mkdirSync(path.join(DIRECTORIES.extensions, 'third-party'));
@@ -87,7 +95,6 @@ function registerEndpoints(app, jsonParser) {
return response.send({ version, author, display_name, extensionPath });
-
} catch (error) {
console.log('Importing custom content failed', error);
return response.status(500).send(`Server Error: ${error.message}`);
From 0ad96b6567e42a82eb33fc6f0dff6b0cd534b2ed Mon Sep 17 00:00:00 2001
From: Cohee <18619528+Cohee1207@users.noreply.github.com>
Date: Fri, 27 Oct 2023 13:22:46 +0300
Subject: [PATCH 7/8] Improve context slider sanity
---
public/index.html | 5 ++---
public/scripts/power-user.js | 9 +++++----
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/public/index.html b/public/index.html
index f70458b0d..985dd0451 100644
--- a/public/index.html
+++ b/public/index.html
@@ -234,11 +234,10 @@