mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-22 08:07:56 +01:00
Minor bug fixes after e7e1f5901e
This commit is contained in:
parent
83534798b2
commit
46ca15cb79
@ -539,17 +539,18 @@ def find_all_histories_with_first_prompts(state):
|
|||||||
filename = path.stem
|
filename = path.stem
|
||||||
with open(path, 'r', encoding='utf-8') as f:
|
with open(path, 'r', encoding='utf-8') as f:
|
||||||
data = json.load(f)
|
data = json.load(f)
|
||||||
|
|
||||||
|
first_prompt = ""
|
||||||
if 'visible' in data and len(data['visible']) > 0:
|
if 'visible' in data and len(data['visible']) > 0:
|
||||||
if data['internal'][0][0] == '<|BEGIN-VISIBLE-CHAT|>':
|
if data['internal'][0][0] == '<|BEGIN-VISIBLE-CHAT|>':
|
||||||
first_prompt = data['visible'][1][0] if len(data['visible']) > 1 else ''
|
if len(data['visible']) > 1:
|
||||||
|
first_prompt = html.unescape(data['visible'][1][0])
|
||||||
|
elif i == 0:
|
||||||
|
first_prompt = "New chat"
|
||||||
else:
|
else:
|
||||||
first_prompt = data['visible'][0][0]
|
first_prompt = html.unescape(data['visible'][0][0])
|
||||||
|
|
||||||
first_prompt = html.unescape(first_prompt)
|
|
||||||
elif i == 0:
|
elif i == 0:
|
||||||
first_prompt = "New chat"
|
first_prompt = "New chat"
|
||||||
else:
|
|
||||||
first_prompt = ''
|
|
||||||
|
|
||||||
first_prompt = first_prompt.strip()
|
first_prompt = first_prompt.strip()
|
||||||
|
|
||||||
@ -598,7 +599,7 @@ def load_history_after_deletion(state, idx):
|
|||||||
history = load_history(histories[idx][1], state['character_menu'], state['mode'])
|
history = load_history(histories[idx][1], state['character_menu'], state['mode'])
|
||||||
else:
|
else:
|
||||||
history = start_new_chat(state)
|
history = start_new_chat(state)
|
||||||
histories = find_all_histories_with_first_prompts
|
histories = find_all_histories_with_first_prompts(state)
|
||||||
|
|
||||||
return history, gr.update(choices=histories, value=histories[idx][1])
|
return history, gr.update(choices=histories, value=histories[idx][1])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user