Compare commits

..
2 Commits
Author SHA1 Message Date
Antonio Cordero Balcazar f59b3e51a5 Fix processing with A1111 hires fix. (#4)
# Pull Request

## Description

Fixes processing A1111 hr prompts.

Fixes #3 

## Type of change

- [x] Bug fix (non-breaking change which fixes an issue)

## How Has This Been Tested?

**Test Configuration**:

- A1111 v1.6
- SD.Next

## Checklist

- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream
modules
- [x] I have checked my code and corrected any misspellings
2023-10-14 14:29:26 +02:00
Antonio Cordero Balcazar 496117e004 * Fix processing with A1111 hires fix.
* Remove version from title.
2023-10-14 13:51:09 +02:00
2 changed files with 13 additions and 3 deletions
+7 -1
View File
@@ -25,7 +25,7 @@ class SendToNegativeScript(scripts.Script):
self.callbacks_added = True
def title(self):
return f"{SendToNegative.NAME} v{SendToNegative.VERSION}"
return SendToNegative.NAME
def show(self, is_img2img):
return scripts.AlwaysVisible
@@ -36,6 +36,12 @@ class SendToNegativeScript(scripts.Script):
p.all_prompts[i], p.all_negative_prompts[i] = stn.process_prompt(
p.all_prompts[i], p.all_negative_prompts[i]
)
# make it compatible with A1111 hires fix
if hasattr(p, "all_hr_prompts") and hasattr(p, "all_hr_negative_prompts"):
for i in range(len(p.all_hr_prompts)): # pylint: disable=consider-using-enumerate
p.all_hr_prompts[i], p.all_hr_negative_prompts[i] = stn.process_prompt(
p.all_hr_prompts[i], p.all_hr_negative_prompts[i]
)
def __on_ui_settings(self):
section = ("send-to-negative", SendToNegative.NAME)
+6 -2
View File
@@ -6,7 +6,7 @@ import lark
class SendToNegative: # pylint: disable=too-few-public-methods
NAME = "Send to Negative"
VERSION = "2.1.3"
VERSION = "2.1.4"
DEFAULT_SEPARATOR = ", "
@@ -163,7 +163,11 @@ class SendToNegative: # pylint: disable=too-few-public-methods
parameters = negtagparameters.children[0].value if negtagparameters is not None else ""
rest = []
for x in tree.children[1::]:
rest.append(self.__prompt[x.meta.start_pos : x.meta.end_pos] if hasattr(x, "meta") and not x.meta.empty else x.value)
rest.append(
self.__prompt[x.meta.start_pos : x.meta.end_pos]
if hasattr(x, "meta") and not x.meta.empty
else x.value
)
content = "".join(rest)
self.__negtags.append(
self.NegTag(tree.meta.start_pos, tree.meta.end_pos, content, parameters, self.__shell.copy())