mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-09-20 18:45:09 +02:00
fix: deduplicate return code
This commit is contained in:
parent
6ca62306b0
commit
ea75b94e01
1 changed files with 20 additions and 31 deletions
|
@ -1059,10 +1059,12 @@ def handle_start_new_chat_click(state):
|
||||||
|
|
||||||
convert_to_markdown.cache_clear()
|
convert_to_markdown.cache_clear()
|
||||||
|
|
||||||
if len(histories) == 0:
|
if len(histories) > 0:
|
||||||
return [history, html, gr.update(choices=histories)]
|
return_histories = gr.update(choices=histories, value=histories[0][1])
|
||||||
|
else:
|
||||||
|
return_histories = gr.update(choices=histories)
|
||||||
|
|
||||||
return [history, html, gr.update(choices=histories, value=histories[0][1])]
|
return [history, html, return_histories]
|
||||||
|
|
||||||
|
|
||||||
def handle_delete_chat_confirm_click(state):
|
def handle_delete_chat_confirm_click(state):
|
||||||
|
@ -1113,17 +1115,15 @@ def handle_upload_chat_history(load_chat_history, state):
|
||||||
|
|
||||||
convert_to_markdown.cache_clear()
|
convert_to_markdown.cache_clear()
|
||||||
|
|
||||||
if len(histories) == 0:
|
if len(histories) > 0:
|
||||||
return [
|
return_histories = gr.update(choices=histories, value=histories[0][1])
|
||||||
history,
|
else:
|
||||||
html,
|
return_histories = gr.update(choices=histories)
|
||||||
gr.update(choices=histories)
|
|
||||||
]
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
history,
|
history,
|
||||||
html,
|
html,
|
||||||
gr.update(choices=histories, value=histories[0][1])
|
return_histories
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -1142,17 +1142,10 @@ def handle_character_menu_change(state):
|
||||||
|
|
||||||
convert_to_markdown.cache_clear()
|
convert_to_markdown.cache_clear()
|
||||||
|
|
||||||
if len(histories) == 0:
|
if len(histories) > 0:
|
||||||
return [
|
return_histories = gr.update(choices=histories, value=histories[0][1])
|
||||||
history,
|
else:
|
||||||
html,
|
return_histories = gr.update(choices=histories)
|
||||||
name1,
|
|
||||||
name2,
|
|
||||||
picture,
|
|
||||||
greeting,
|
|
||||||
context,
|
|
||||||
gr.update(choices=histories)
|
|
||||||
]
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
history,
|
history,
|
||||||
|
@ -1162,7 +1155,7 @@ def handle_character_menu_change(state):
|
||||||
picture,
|
picture,
|
||||||
greeting,
|
greeting,
|
||||||
context,
|
context,
|
||||||
gr.update(choices=histories, value=histories[0][1]),
|
return_histories,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -1173,21 +1166,17 @@ def handle_mode_change(state):
|
||||||
|
|
||||||
convert_to_markdown.cache_clear()
|
convert_to_markdown.cache_clear()
|
||||||
|
|
||||||
if len(histories) == 0:
|
if len(histories) > 0:
|
||||||
return [
|
return_histories = gr.update(choices=histories, value=histories[0][1])
|
||||||
history,
|
else:
|
||||||
html,
|
return_histories = gr.update(choices=histories)
|
||||||
gr.update(visible=state['mode'] != 'instruct'),
|
|
||||||
gr.update(visible=state['mode'] == 'chat-instruct'),
|
|
||||||
gr.update(choices=histories)
|
|
||||||
]
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
history,
|
history,
|
||||||
html,
|
html,
|
||||||
gr.update(visible=state['mode'] != 'instruct'),
|
gr.update(visible=state['mode'] != 'instruct'),
|
||||||
gr.update(visible=state['mode'] == 'chat-instruct'),
|
gr.update(visible=state['mode'] == 'chat-instruct'),
|
||||||
gr.update(choices=histories, value=histories[0][1])
|
return_histories
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue