KevinHuSh
commited on
Commit
·
801a3c1
1
Parent(s):
b916b29
fix bug for fasetembed (#392)
Browse files### What problem does this PR solve?
Issue link:#325
### Type of change
- [x] Bug Fix (non-breaking change which fixes an issue)
api/apps/document_app.py
CHANGED
@@ -58,7 +58,7 @@ def upload():
|
|
58 |
if not e:
|
59 |
return get_data_error_result(
|
60 |
retmsg="Can't find this knowledgebase!")
|
61 |
-
if DocumentService.get_doc_count(kb.tenant_id) >= os.environ.get('MAX_FILE_NUM_PER_USER', 8192):
|
62 |
return get_data_error_result(
|
63 |
retmsg="Exceed the maximum file number of a free user!")
|
64 |
|
|
|
58 |
if not e:
|
59 |
return get_data_error_result(
|
60 |
retmsg="Can't find this knowledgebase!")
|
61 |
+
if DocumentService.get_doc_count(kb.tenant_id) >= int(os.environ.get('MAX_FILE_NUM_PER_USER', 8192)):
|
62 |
return get_data_error_result(
|
63 |
retmsg="Exceed the maximum file number of a free user!")
|
64 |
|
api/db/services/llm_service.py
CHANGED
@@ -83,7 +83,12 @@ class TenantLLMService(CommonService):
|
|
83 |
llm = LLMService.query(llm_name=llm_name)
|
84 |
if llm and llm[0].fid in ["QAnything", "FastEmbed"]:
|
85 |
model_config = {"llm_factory": llm[0].fid, "api_key":"", "llm_name": llm_name, "api_base": ""}
|
86 |
-
if not model_config:
|
|
|
|
|
|
|
|
|
|
|
87 |
|
88 |
if llm_type == LLMType.EMBEDDING.value:
|
89 |
if model_config["llm_factory"] not in EmbeddingModel:
|
|
|
83 |
llm = LLMService.query(llm_name=llm_name)
|
84 |
if llm and llm[0].fid in ["QAnything", "FastEmbed"]:
|
85 |
model_config = {"llm_factory": llm[0].fid, "api_key":"", "llm_name": llm_name, "api_base": ""}
|
86 |
+
if not model_config:
|
87 |
+
if llm_name == "flag-embedding":
|
88 |
+
model_config = {"llm_factory": "Tongyi-Qianwen", "api_key": "",
|
89 |
+
"llm_name": llm_name, "api_base": ""}
|
90 |
+
else:
|
91 |
+
raise LookupError("Model({}) not authorized".format(mdlnm))
|
92 |
|
93 |
if llm_type == LLMType.EMBEDDING.value:
|
94 |
if model_config["llm_factory"] not in EmbeddingModel:
|