Browse Source

Update server.py

oobabooga 3 years ago
parent
commit
001ecf95b2
1 changed files with 2 additions and 2 deletions
  1. 2 2
      server.py

+ 2 - 2
server.py

@@ -364,6 +364,8 @@ if args.chat or args.cai_chat:
 
     def extract_message_from_reply(question, reply, current, other, check, extensions=False):
         next_character_found = False
+        substring_found = False
+
         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 = idx[len(previous_idx)-1]
@@ -372,8 +374,6 @@ if args.chat or args.cai_chat:
             reply = reply[idx + 1 + len(apply_extensions(f"{current}:", "bot_prefix")):]
         else:
             reply = reply[idx + 1 + len(f"{current}:"):]
-
-        substring_found = False
         
         if check:
             reply = reply.split('\n')[0].strip()