mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-12-24 13:28:59 +01:00
Escape regexp in message extraction
This commit is contained in:
parent
8c9dd95d55
commit
ded890c378
@ -559,8 +559,8 @@ def extract_message_from_reply(question, reply, current, other, check, extension
|
|||||||
next_character_found = False
|
next_character_found = False
|
||||||
substring_found = False
|
substring_found = False
|
||||||
|
|
||||||
previous_idx = [m.start() for m in re.finditer(f"(^|\n){current}:", question)]
|
previous_idx = [m.start() for m in re.finditer(f"(^|\n){re.escape(current)}:", question)]
|
||||||
idx = [m.start() for m in re.finditer(f"(^|\n){current}:", reply)]
|
idx = [m.start() for m in re.finditer(f"(^|\n){re.escape(current)}:", reply)]
|
||||||
idx = idx[len(previous_idx)-1]
|
idx = idx[len(previous_idx)-1]
|
||||||
|
|
||||||
if extensions:
|
if extensions:
|
||||||
|
Loading…
Reference in New Issue
Block a user