diff --git a/api/apps/document_app.py b/api/apps/document_app.py index c01f73a36e58191075656a38dec6357ea2418541..8402d121f49b0253663d460beefe7923ee0dedc5 100644 --- a/api/apps/document_app.py +++ b/api/apps/document_app.py @@ -58,7 +58,7 @@ def upload(): if not e: return get_data_error_result( retmsg="Can't find this knowledgebase!") - if DocumentService.get_doc_count(kb.tenant_id) >= os.environ.get('MAX_FILE_NUM_PER_USER', 8192): + if DocumentService.get_doc_count(kb.tenant_id) >= int(os.environ.get('MAX_FILE_NUM_PER_USER', 8192)): return get_data_error_result( retmsg="Exceed the maximum file number of a free user!") diff --git a/api/db/services/llm_service.py b/api/db/services/llm_service.py index a94701b0df2ee0b371f56838829026d6c548eefd..f565da132ced24e345b155cc617bc25ff63bde50 100644 --- a/api/db/services/llm_service.py +++ b/api/db/services/llm_service.py @@ -83,7 +83,12 @@ class TenantLLMService(CommonService): llm = LLMService.query(llm_name=llm_name) if llm and llm[0].fid in ["QAnything", "FastEmbed"]: model_config = {"llm_factory": llm[0].fid, "api_key":"", "llm_name": llm_name, "api_base": ""} - if not model_config: raise LookupError("Model({}) not authorized".format(mdlnm)) + if not model_config: + if llm_name == "flag-embedding": + model_config = {"llm_factory": "Tongyi-Qianwen", "api_key": "", + "llm_name": llm_name, "api_base": ""} + else: + raise LookupError("Model({}) not authorized".format(mdlnm)) if llm_type == LLMType.EMBEDDING.value: if model_config["llm_factory"] not in EmbeddingModel: