UI: save the sent chat message on "no model is loaded" error

This commit is contained in:
oobabooga 2023-12-16 10:52:41 -08:00
parent a060908d6c
commit f8079d067d

View file

@ -210,10 +210,6 @@ def chatbot_wrapper(text, state, regenerate=False, _continue=False, loading_mess
output = copy.deepcopy(history)
output = apply_extensions('history', output)
state = apply_extensions('state', state)
if shared.model_name == 'None' or shared.model is None:
logger.error("No model is loaded! Select one in the Model tab.")
yield output
return
visible_text = None
stopping_strings = get_stopping_strings(state)
@ -252,6 +248,9 @@ def chatbot_wrapper(text, state, regenerate=False, _continue=False, loading_mess
'internal': output['internal']
}
if shared.model_name == 'None' or shared.model is None:
raise ValueError("No model is loaded! Select one in the Model tab.")
# Generate the prompt
kwargs = {
'_continue': _continue,