From f6df7ce075e35c609c679e3f30e0f02869f6f11d Mon Sep 17 00:00:00 2001 From: m957ymj75urz Date: Fri, 17 Feb 2023 22:44:24 +0100 Subject: [PATCH] Remove seed widget from nodes supporting dynamic prompting --- webshit/index.html | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/webshit/index.html b/webshit/index.html index e09c69ad..d86efe14 100644 --- a/webshit/index.html +++ b/webshit/index.html @@ -176,14 +176,6 @@ function onObjectInfo(json) { if (multiline == undefined) multiline = false; if (dynamic_prompt == undefined) dynamic_prompt = false; - if (dynamic_prompt) - { - w1 = this.addWidget("number", "seed", 0, function(v){let s = this.options.step / 10;this.value = Math.round( v / s ) * s;}, { min: min_val, max: max_val, step: 10.0 * step_val} ); - w2 = this.addWidget("toggle", "Random seed after every gen", true, function(v){}, { on: "enabled", off:"disabled"} ); - w2.to_randomize = w1; - this._widgets += [w1, w2]; - } - if (multiline) { var w = { type: "customtext", @@ -312,16 +304,6 @@ graph.onNodeRemoved = function(n) { } } -// from https://stackoverflow.com/a/47593316 -function rng_mulberry32(a) { - return function() { - var t = a += 0x6D2B79F5; - t = Math.imul(t ^ t >>> 15, t | 1); - t ^= t + Math.imul(t ^ t >>> 7, t | 61); - return ((t ^ t >>> 14) >>> 0) / 4294967296; - } -} - function graphToPrompt() { let s = graph.serialize(); let output = {}; @@ -337,9 +319,6 @@ function graphToPrompt() { // find widgets declared as supporting dynamic prompting var supportedWidgets = n.widgets.filter(e => e.dynamic_prompt === true); if (supportedWidgets.length > 0) { - // find the seed widget to use for this node - var seed = n.widgets.filter(e => e.name === "seed")[0].value; - var rng = rng_mulberry32(seed); // resolve dynamic prompts for all widgets supporting it in this node for (let i in supportedWidgets) @@ -359,7 +338,7 @@ function graphToPrompt() { const optionsString = prompt.substring(startIndex + 1, endIndex); const options = optionsString.split('|'); - const randomIndex = Math.floor(rng() * (options.length)); + const randomIndex = Math.floor(Math.random() * options.length); const randomOption = options[randomIndex]; prompt = prompt.substring(0, startIndex) + randomOption + prompt.substring(endIndex + 1);