mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-29 19:09:32 +01:00
Update server.py
This commit is contained in:
parent
a85bb5e9a2
commit
001ecf95b2
@ -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]
|
||||||
@ -373,8 +375,6 @@ if args.chat or args.cai_chat:
|
|||||||
else:
|
else:
|
||||||
reply = reply[idx + 1 + len(f"{current}:"):]
|
reply = reply[idx + 1 + len(f"{current}:"):]
|
||||||
|
|
||||||
substring_found = False
|
|
||||||
|
|
||||||
if check:
|
if check:
|
||||||
reply = reply.split('\n')[0].strip()
|
reply = reply.split('\n')[0].strip()
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user