From 2efcda837cf3ef6934f2666e841a67e8231bd76c Mon Sep 17 00:00:00 2001 From: Michael Poluektov Date: Sun, 11 Aug 2024 09:07:12 +0100 Subject: [PATCH] add try: except back --- backend/main.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/backend/main.py b/backend/main.py index fbfbf2f2d..14d5a604a 100644 --- a/backend/main.py +++ b/backend/main.py @@ -457,10 +457,13 @@ async def chat_completion_inlets_handler(body, model, extra_params): # Extra parameters to be passed to the function custom_params = {**extra_params, "__model__": model, "__id__": filter_id} if hasattr(function_module, "UserValves") and "__user__" in sig.parameters: - uid = custom_params["__user__"]["id"] - custom_params["__user__"]["valves"] = function_module.UserValves( - **Functions.get_user_valves_by_id_and_user_id(filter_id, uid) - ) + try: + uid = custom_params["__user__"]["id"] + custom_params["__user__"]["valves"] = function_module.UserValves( + **Functions.get_user_valves_by_id_and_user_id(filter_id, uid) + ) + except Exception as e: + print(e) # Add extra params in contained in function signature for key, value in custom_params.items():