Explorar o código

Fix bug in loading chat history as text file

oobabooga %!s(int64=3) %!d(string=hai) anos
pai
achega
8325e23923
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  1. 3 0
      server.py

+ 3 - 0
server.py

@@ -366,6 +366,8 @@ if args.chat or args.cai_chat:
         messages = []
         messages = []
         for i in range(len(idx)-1):
         for i in range(len(idx)-1):
             messages.append(dialogue[idx[i]:idx[i+1]].strip())
             messages.append(dialogue[idx[i]:idx[i+1]].strip())
+        messages.append(dialogue[idx[-1]:].strip())
+
         history = []
         history = []
         entry = ['', '']
         entry = ['', '']
         for i in messages:
         for i in messages:
@@ -376,6 +378,7 @@ if args.chat or args.cai_chat:
                 if not (len(entry[0]) == 0 and len(entry[1]) == 0):
                 if not (len(entry[0]) == 0 and len(entry[1]) == 0):
                     history.append(entry)
                     history.append(entry)
                 entry = ['', '']
                 entry = ['', '']
+
         return history
         return history
 
 
     def save_history():
     def save_history():