Skip to content

Commit

Permalink
fix bug for fasetembed (infiniflow#392)
Browse files Browse the repository at this point in the history
### What problem does this PR solve?

Issue link:infiniflow#325

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
  • Loading branch information
KevinHuSh authored Apr 16, 2024
1 parent b3bf7a2 commit ec9b80a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion api/apps/document_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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!")

Expand Down
7 changes: 6 additions & 1 deletion api/db/services/llm_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,12 @@ def model_instance(cls, tenant_id, llm_type,
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:
Expand Down

0 comments on commit ec9b80a

Please sign in to comment.