mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-23 00:18:20 +01:00
commit
824329749d
@ -364,6 +364,8 @@ if args.chat or args.cai_chat:
|
|||||||
|
|
||||||
def extract_message_from_reply(question, reply, current, other, check, extensions=False):
|
def extract_message_from_reply(question, reply, current, other, check, extensions=False):
|
||||||
next_character_found = False
|
next_character_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){current}:", question)]
|
||||||
idx = [m.start() for m in re.finditer(f"(^|\n){current}:", reply)]
|
idx = [m.start() for m in re.finditer(f"(^|\n){current}:", reply)]
|
||||||
idx = idx[len(previous_idx)-1]
|
idx = idx[len(previous_idx)-1]
|
||||||
@ -385,7 +387,6 @@ if args.chat or args.cai_chat:
|
|||||||
# Detect if something like "\nYo" is generated just before
|
# Detect if something like "\nYo" is generated just before
|
||||||
# "\nYou:" is completed
|
# "\nYou:" is completed
|
||||||
tmp = f"\n{other}:"
|
tmp = f"\n{other}:"
|
||||||
substring_found = False
|
|
||||||
for j in range(1, len(tmp)):
|
for j in range(1, len(tmp)):
|
||||||
if reply[-j:] == tmp[:j]:
|
if reply[-j:] == tmp[:j]:
|
||||||
substring_found = True
|
substring_found = True
|
||||||
|
Loading…
Reference in New Issue
Block a user