Wang Baoling
commited on
Commit
·
ef53081
1
Parent(s):
b2dbbc3
fix:failed to Create new Chunk in database #1159 (#1214)
Browse files### What problem does this PR solve?
fix bug: [1159](https://github.com/infiniflow/ragflow/issues/1159)
using embd which user configured at knowledgebase when create new chunk
in database
### Type of change
- [x] Bug Fix (non-breaking change which fixes an issue)
- api/apps/chunk_app.py +4 -2
api/apps/chunk_app.py
CHANGED
@@ -224,9 +224,11 @@ def create():
|
|
224 |
tenant_id = DocumentService.get_tenant_id(req["doc_id"])
|
225 |
if not tenant_id:
|
226 |
return get_data_error_result(retmsg="Tenant not found!")
|
227 |
-
|
|
|
228 |
embd_mdl = TenantLLMService.model_instance(
|
229 |
-
tenant_id, LLMType.EMBEDDING.value)
|
|
|
230 |
v, c = embd_mdl.encode([doc.name, req["content_with_weight"]])
|
231 |
DocumentService.increment_chunk_num(req["doc_id"], doc.kb_id, c, 1, 0)
|
232 |
v = 0.1 * v[0] + 0.9 * v[1]
|
|
|
224 |
tenant_id = DocumentService.get_tenant_id(req["doc_id"])
|
225 |
if not tenant_id:
|
226 |
return get_data_error_result(retmsg="Tenant not found!")
|
227 |
+
|
228 |
+
embd_id = DocumentService.get_embd_id(req["doc_id"])
|
229 |
embd_mdl = TenantLLMService.model_instance(
|
230 |
+
tenant_id, LLMType.EMBEDDING.value, embd_id)
|
231 |
+
|
232 |
v, c = embd_mdl.encode([doc.name, req["content_with_weight"]])
|
233 |
DocumentService.increment_chunk_num(req["doc_id"], doc.kb_id, c, 1, 0)
|
234 |
v = 0.1 * v[0] + 0.9 * v[1]
|