return None rather than raising an error

This commit is contained in:
Ingrid Stevens 2024-03-12 10:07:48 +01:00
parent 8459025260
commit b12d7f8b63

View File

@ -437,12 +437,11 @@ class PrivateGptUi:
"ollama": config_settings.ollama.model, "ollama": config_settings.ollama.model,
} }
try: if llm_mode not in model_mapping:
return model_mapping[llm_mode] print(f"Invalid 'llm mode': {llm_mode}")
except KeyError: return None
raise ValueError(
f"Invalid 'llm mode': {llm_mode}" return model_mapping[llm_mode]
) from None
with gr.Column(scale=7, elem_id="col"): with gr.Column(scale=7, elem_id="col"):
# Determine the model label based on the value of PGPT_PROFILES # Determine the model label based on the value of PGPT_PROFILES