mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-12 20:29:06 +08:00
fix: using embd which user configured at knowledgebase (#1163)
### What problem does this PR solve? as title ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
parent
fe1805fa0e
commit
0b90aab22c
@ -136,8 +136,11 @@ def set():
|
|||||||
tenant_id = DocumentService.get_tenant_id(req["doc_id"])
|
tenant_id = DocumentService.get_tenant_id(req["doc_id"])
|
||||||
if not tenant_id:
|
if not tenant_id:
|
||||||
return get_data_error_result(retmsg="Tenant not found!")
|
return get_data_error_result(retmsg="Tenant not found!")
|
||||||
|
|
||||||
|
embd_id = DocumentService.get_embd_id(req["doc_id"])
|
||||||
embd_mdl = TenantLLMService.model_instance(
|
embd_mdl = TenantLLMService.model_instance(
|
||||||
tenant_id, LLMType.EMBEDDING.value)
|
tenant_id, LLMType.EMBEDDING.value, embd_id)
|
||||||
|
|
||||||
e, doc = DocumentService.get_by_id(req["doc_id"])
|
e, doc = DocumentService.get_by_id(req["doc_id"])
|
||||||
if not e:
|
if not e:
|
||||||
return get_data_error_result(retmsg="Document not found!")
|
return get_data_error_result(retmsg="Document not found!")
|
||||||
|
@ -182,6 +182,19 @@ class DocumentService(CommonService):
|
|||||||
return
|
return
|
||||||
return docs[0]["tenant_id"]
|
return docs[0]["tenant_id"]
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
@DB.connection_context()
|
||||||
|
def get_embd_id(cls, doc_id):
|
||||||
|
docs = cls.model.select(
|
||||||
|
Knowledgebase.embd_id).join(
|
||||||
|
Knowledgebase, on=(
|
||||||
|
Knowledgebase.id == cls.model.kb_id)).where(
|
||||||
|
cls.model.id == doc_id, Knowledgebase.status == StatusEnum.VALID.value)
|
||||||
|
docs = docs.dicts()
|
||||||
|
if not docs:
|
||||||
|
return
|
||||||
|
return docs[0]["embd_id"]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@DB.connection_context()
|
@DB.connection_context()
|
||||||
def get_doc_id_by_doc_name(cls, doc_name):
|
def get_doc_id_by_doc_name(cls, doc_name):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user