Skip to content

Conversation

@w-e-w
Copy link
Collaborator

@w-e-w w-e-w commented Aug 3, 2023

Description

issue #12259

prevent positive prompt TI hash from overriding negative prompt TI hash
as this line of code will be called 2 time

Checklist:

@AUTOMATIC1111
Copy link
Owner

it's a very good catch but it the way it is written now will add an extra comma at the beginning

@w-e-w w-e-w marked this pull request as draft August 3, 2023 09:14
@w-e-w
Copy link
Collaborator Author

w-e-w commented Aug 3, 2023

it's a very good catch but it the way it is written now will add an extra comma at the beginning

well actually you're right about it being bugged but it doesn't do that
instead it's missing a , in between

test script

# old
d = {}
hashes = ['1-1', '1-2']
d["TI hashes"] = d.get("TI hashes", "") + ", ".join(hashes)
hashes = ['2-1', '2-2']
d["TI hashes"] = d.get("TI hashes", "") + ", ".join(hashes)
print(d["TI hashes"])
# 1-1, 1-22-1, 2-2
#        ^^

# new
d = {}
hashes = ['1-1', '1-2']
if d.get("TI hashes"):
    hashes.append(d.get("TI hashes"))
d["TI hashes"] = ", ".join(hashes)

hashes = ['2-1', '2-2']
if d.get("TI hashes"):
    hashes.append(d.get("TI hashes"))
d["TI hashes"] = ", ".join(hashes)
print(d["TI hashes"])
# 2-1, 2-2, 1-1, 1-2
# fixed

@w-e-w w-e-w marked this pull request as ready for review August 3, 2023 09:53
@AUTOMATIC1111 AUTOMATIC1111 merged commit 8e840e1 into dev Aug 3, 2023
@w-e-w w-e-w deleted the TI-Hash-fix branch August 3, 2023 09:57
@w-e-w w-e-w mentioned this pull request Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants