mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-10-01 01:26:03 -04:00
Fix regex bug in loading character jsons with special characters
This commit is contained in:
parent
f867285e3d
commit
444cd69c67
@ -733,7 +733,7 @@ def tokenize_dialogue(dialogue, name1, name2):
|
||||
dialogue = re.sub('<start>', '', dialogue)
|
||||
dialogue = re.sub('(\n|^)[Aa]non:', '\\1You:', dialogue)
|
||||
dialogue = re.sub('(\n|^)\[CHARACTER\]:', f'\\g<1>{name2}:', dialogue)
|
||||
idx = [m.start() for m in re.finditer(f"(^|\n)({name1}|{name2}):", dialogue)]
|
||||
idx = [m.start() for m in re.finditer(f"(^|\n)({re.escape(name1)}|{re.escape(name2)}):", dialogue)]
|
||||
if len(idx) == 0:
|
||||
return _history
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user