From a5306e6345eabdc27fb6a5c644a8c4a8d786b38d Mon Sep 17 00:00:00 2001 From: Kevin Hu Date: Tue, 16 Jul 2024 16:55:31 +0800 Subject: [PATCH] fix minimax init error (#1537) ### What problem does this PR solve? ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- api/apps/api_app.py | 1 + api/db/init_data.py | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/api/apps/api_app.py b/api/apps/api_app.py index 324ff93ea..b0ab20ed8 100644 --- a/api/apps/api_app.py +++ b/api/apps/api_app.py @@ -573,6 +573,7 @@ def completion_faq(): response = MINIO.get(bkt, nm) data_type_picture["url"] = base64.b64encode(response).decode('utf-8') data.append(data_type_picture) + break except Exception as e: return server_error_response(e) diff --git a/api/db/init_data.py b/api/db/init_data.py index 1f4fd35a9..0acfe7b12 100644 --- a/api/db/init_data.py +++ b/api/db/init_data.py @@ -90,6 +90,11 @@ def init_superuser(): def init_llm_factory(): + try: + LLMService.filter_delete([(LLM.fid == "MiniMax" or LLM.fid == "Minimax")]) + except Exception as e: + pass + factory_llm_infos = json.load( open( os.path.join(get_project_base_directory(), "conf", "llm_factories.json"), @@ -108,10 +113,6 @@ def init_llm_factory(): LLMService.save(**llm_info) except Exception as e: pass - try: - LLMService.filter_delete([(LLM.fid == "MiniMax" or LLM.fid == "Minimax")]) - except Exception as e: - pass LLMFactoriesService.filter_delete([LLMFactories.name == "Local"]) LLMService.filter_delete([LLM.fid == "Local"])