mirror of
https://github.com/imrayya/stable-diffusion-webui-Prompt_Generator.git
synced 2024-01-11 09:00:44 +01:00
Fix for Broken Tool Tip #15
This fixes the problem due to hints.js overwriting the SD Web UI original file. The hints.js file has been renamed and the code inside refactored.
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
//Basically copied this from AUTOMATIC1111 implementation of the main UI
|
//Basically copied and adapted from AUTOMATIC1111 implementation of the main UI
|
||||||
|
// mouseover tooltips for various UI elements in the form of "UI element label"="Tooltip text".
|
||||||
|
|
||||||
titles = {
|
prompt_generator_titles = {
|
||||||
"Temperature": "A higher temperature will produce more diverse results, but with a higher risk of less coherent text",
|
"Temperature": "A higher temperature will produce more diverse results, but with a higher risk of less coherent text",
|
||||||
"Max Length": "The maximum number of tokens for the output of the model",
|
"Max Length": "The maximum number of tokens for the output of the model",
|
||||||
"Top K": "Strategy is to sample from a shortlist of the top K tokens. This approach allows the other high-scoring tokens a chance of being picked.",
|
"Top K": "Strategy is to sample from a shortlist of the top K tokens. This approach allows the other high-scoring tokens a chance of being picked.",
|
||||||
@@ -11,16 +12,16 @@ titles = {
|
|||||||
|
|
||||||
onUiUpdate(function(){
|
onUiUpdate(function(){
|
||||||
gradioApp().querySelectorAll('span, button, select, p').forEach(function(span){
|
gradioApp().querySelectorAll('span, button, select, p').forEach(function(span){
|
||||||
tooltip = titles[span.textContent];
|
tooltip = prompt_generator_titles[span.textContent];
|
||||||
|
|
||||||
if(!tooltip){
|
if(!tooltip){
|
||||||
tooltip = titles[span.value];
|
tooltip = prompt_generator_titles[span.value];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!tooltip){
|
if(!tooltip){
|
||||||
for (const c of span.classList) {
|
for (const c of span.classList) {
|
||||||
if (c in titles) {
|
if (c in prompt_generator_titles) {
|
||||||
tooltip = titles[c];
|
tooltip = prompt_generator_titles[c];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -35,7 +36,7 @@ onUiUpdate(function(){
|
|||||||
if (select.onchange != null) return;
|
if (select.onchange != null) return;
|
||||||
|
|
||||||
select.onchange = function(){
|
select.onchange = function(){
|
||||||
select.title = titles[select.value] || "";
|
select.title = prompt_generator_titles[select.value] || "";
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
Reference in New Issue
Block a user