History loading minor bug fix

This commit is contained in:
oobabooga 2023-01-27 12:01:11 -03:00
parent 8b8236c6ff
commit 69ffef4391

View File

@ -8,6 +8,7 @@ import json
import sys import sys
from sys import exit from sys import exit
from pathlib import Path from pathlib import Path
import copy
import gradio as gr import gradio as gr
import warnings import warnings
from tqdm import tqdm from tqdm import tqdm
@ -458,7 +459,7 @@ if args.chat or args.cai_chat:
if 'data_visible' in j: if 'data_visible' in j:
history['visible'] = j['data_visible'] history['visible'] = j['data_visible']
else: else:
history['visible'] = history['internal'] history['visible'] = copy.deepcopy(history['internal'])
# Compatibility with Pygmalion AI's official web UI # Compatibility with Pygmalion AI's official web UI
elif 'chat' in j: elif 'chat' in j:
history['internal'] = [':'.join(x.split(':')[1:]).strip() for x in j['chat']] history['internal'] = [':'.join(x.split(':')[1:]).strip() for x in j['chat']]
@ -468,7 +469,7 @@ if args.chat or args.cai_chat:
history['internal'] = [[history['internal'][i], history['internal'][i+1]] for i in range(0, len(history['internal'])-1, 2)] history['internal'] = [[history['internal'][i], history['internal'][i+1]] for i in range(0, len(history['internal'])-1, 2)]
except: except:
history['internal'] = tokenize_dialogue(file, name1, name2) history['internal'] = tokenize_dialogue(file, name1, name2)
history['visible'] = history['internal'] history['visible'] = copy.deepcopy(history['internal'])
def load_character(_character, name1, name2): def load_character(_character, name1, name2):
global history, character global history, character