From 1399c60164222e6a52ce01477295a353c5d6a3fa Mon Sep 17 00:00:00 2001 From: Idriss Sbaaoui <112825897+6ba3i@users.noreply.github.com> Date: Tue, 17 Mar 2026 19:38:54 +0800 Subject: [PATCH] fix builtin model fail when parsing (#13657) ### What problem does this PR solve? using builtin model when parsing gave an error because it expects fid==builtin. split_model_name_and_factory returns id=None. pr allows the model to be accepted wheter with or without @Builtin ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- api/db/joint_services/tenant_model_service.py | 9 ++++++++- .../test_document_app/test_paser_documents.py | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/api/db/joint_services/tenant_model_service.py b/api/db/joint_services/tenant_model_service.py index 4ab128069c..f53f83ab95 100644 --- a/api/db/joint_services/tenant_model_service.py +++ b/api/db/joint_services/tenant_model_service.py @@ -40,7 +40,14 @@ def get_model_config_by_type_and_name(tenant_id: str, model_type: str, model_nam if not model_config: # model_name in format 'name@factory', split model_name and try again pure_model_name, fid = TenantLLMService.split_model_name_and_factory(model_name) - if model_type_val == LLMType.EMBEDDING.value and fid == "Builtin" and "tei-" in os.getenv("COMPOSE_PROFILES", "") and pure_model_name == os.getenv("TEI_MODEL", ""): + compose_profiles = os.getenv("COMPOSE_PROFILES", "") + is_tei_builtin_embedding = ( + model_type_val == LLMType.EMBEDDING.value + and "tei-" in compose_profiles + and pure_model_name == os.getenv("TEI_MODEL", "") + and (fid == "Builtin" or fid is None) + ) + if is_tei_builtin_embedding: # configured local embedding model embedding_cfg = settings.EMBEDDING_CFG config_dict = { diff --git a/test/testcases/test_web_api/test_document_app/test_paser_documents.py b/test/testcases/test_web_api/test_document_app/test_paser_documents.py index e3efa403d8..06ee79c775 100644 --- a/test/testcases/test_web_api/test_document_app/test_paser_documents.py +++ b/test/testcases/test_web_api/test_document_app/test_paser_documents.py @@ -303,7 +303,7 @@ class TestDocumentsParseStop: ], ) def test_basic_scenarios(self, WebApiAuth, add_documents_func, payload, expected_code, expected_message): - @wait_for(10, 1, "Document parsing timeout") + @wait_for(30, 1, "Document parsing timeout") def condition(_auth, _kb_id, _doc_ids): res = list_documents(_auth, {"kb_id": _kb_id}) for doc in res["data"]["docs"]: