mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 01:04:32 +02:00
load description to input box by clicking on card(except checkpoint)
This commit is contained in:
@@ -74,9 +74,15 @@ function tryToRemoveExtraNetworkFromPrompt(textarea, text){
|
||||
return false
|
||||
}
|
||||
|
||||
function cardClicked(tabname, textToAdd, allowNegativePrompt){
|
||||
function cardClicked(tabname, textToAdd, allowNegativePrompt, descriptionText){
|
||||
var textarea = allowNegativePrompt ? activePromptTextarea[tabname] : gradioApp().querySelector("#" + tabname + "_prompt > label > textarea")
|
||||
|
||||
var description_textarea = gradioApp().querySelector("#" + tabname+ '_description_input > label > textarea')
|
||||
|
||||
description_textarea.value = descriptionText
|
||||
|
||||
updateInput(description_textarea)
|
||||
|
||||
if(! tryToRemoveExtraNetworkFromPrompt(textarea, textToAdd)){
|
||||
textarea.value = textarea.value + opts.extra_networks_add_text_separator + textToAdd
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ class ExtraNetworksPage:
|
||||
|
||||
onclick = item.get("onclick", None)
|
||||
if onclick is None:
|
||||
onclick = '"' + html.escape(f"""return cardClicked({json.dumps(tabname)}, {item["prompt"]}, {"true" if self.allow_negative_prompt else "false"})""") + '"'
|
||||
onclick = '"' + html.escape(f"""return cardClicked({json.dumps(tabname)}, {item["prompt"]}, {"true" if self.allow_negative_prompt else "false"}, {json.dumps(item["description"])})""") + '"'
|
||||
|
||||
height = f"height: {shared.opts.extra_networks_card_height}px;" if shared.opts.extra_networks_card_height else ''
|
||||
width = f"width: {shared.opts.extra_networks_card_width}px;" if shared.opts.extra_networks_card_width else ''
|
||||
|
||||
Reference in New Issue
Block a user