diff --git a/public/index.html b/public/index.html index e5f1b3c18..f70458b0d 100644 --- a/public/index.html +++ b/public/index.html @@ -1091,6 +1091,14 @@
+
+
+ Seed +
+ + +
+
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;