aboutsummaryrefslogtreecommitdiffstats
path: root/javascript/ui.js
diff options
context:
space:
mode:
authorAUTOMATIC <16777216c@gmail.com>2023-01-14 12:55:40 +0000
committerAUTOMATIC <16777216c@gmail.com>2023-01-14 12:55:40 +0000
commit08c6f009a5ee92dd3218a942c08e8337c26352be (patch)
treea4398b52b1fc3cac9ec9a69e9098996ed18ca11b /javascript/ui.js
parentfebd2b722e80959b89a0e5966a159b4eb430c5a5 (diff)
downloadstable-diffusion-webui-gfx803-08c6f009a5ee92dd3218a942c08e8337c26352be.tar.gz
stable-diffusion-webui-gfx803-08c6f009a5ee92dd3218a942c08e8337c26352be.tar.bz2
stable-diffusion-webui-gfx803-08c6f009a5ee92dd3218a942c08e8337c26352be.zip
load hashes from cache for checkpoints that have them
add checkpoint hash to footer
Diffstat (limited to 'javascript/ui.js')
-rw-r--r--javascript/ui.js25
1 files changed, 16 insertions, 9 deletions
diff --git a/javascript/ui.js b/javascript/ui.js
index a41dd26f..1e04a8f4 100644
--- a/javascript/ui.js
+++ b/javascript/ui.js
@@ -143,14 +143,6 @@ function confirm_clear_prompt(prompt, negative_prompt) {
opts = {}
-function apply_settings(jsdata){
- console.log(jsdata)
-
- opts = JSON.parse(jsdata)
-
- return jsdata
-}
-
onUiUpdate(function(){
if(Object.keys(opts).length != 0) return;
@@ -160,7 +152,7 @@ onUiUpdate(function(){
textarea = json_elem.querySelector('textarea')
jsdata = textarea.value
opts = JSON.parse(jsdata)
-
+ executeCallbacks(optionsChangedCallbacks);
Object.defineProperty(textarea, 'value', {
set: function(newValue) {
@@ -171,6 +163,8 @@ onUiUpdate(function(){
if (oldValue != newValue) {
opts = JSON.parse(textarea.value)
}
+
+ executeCallbacks(optionsChangedCallbacks);
},
get: function() {
var valueProp = Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype, 'value');
@@ -201,6 +195,19 @@ onUiUpdate(function(){
}
})
+
+onOptionsChanged(function(){
+ elem = gradioApp().getElementById('sd_checkpoint_hash')
+ sd_checkpoint_hash = opts.sd_checkpoint_hash || ""
+ shorthash = sd_checkpoint_hash.substr(0,10)
+
+ if(elem && elem.textContent != shorthash){
+ elem.textContent = shorthash
+ elem.title = sd_checkpoint_hash
+ elem.href = "https://google.com/search?q=" + sd_checkpoint_hash
+ }
+})
+
let txt2img_textarea, img2img_textarea = undefined;
let wait_time = 800
let token_timeout;