mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-07-24 12:45:45 +00:00
Co-authored-by: WangTing <wangting@192.168.1.10> Co-authored-by: aries_ckt <916701291@qq.com>
This commit is contained in:
parent
2eeef2fa75
commit
cd2163e444
@ -219,6 +219,7 @@ class KnowledgeDocumentDao(BaseDao):
|
||||
)
|
||||
|
||||
results = counts_query.all()
|
||||
session.close()
|
||||
docs_count = {result.space: result.document_count for result in results}
|
||||
return docs_count
|
||||
|
||||
@ -253,7 +254,9 @@ class KnowledgeDocumentDao(BaseDao):
|
||||
session = self.get_raw_session()
|
||||
updated_space = session.merge(document)
|
||||
session.commit()
|
||||
return updated_space.id
|
||||
update_space_id = updated_space.id
|
||||
session.close()
|
||||
return update_space_id
|
||||
|
||||
#
|
||||
def raw_delete(self, query: KnowledgeDocumentEntity):
|
||||
|
@ -220,9 +220,14 @@ class KnowledgeService:
|
||||
document.status not in [SyncStatus.RUNNING.name]
|
||||
and len(chunk_entities) == 0
|
||||
):
|
||||
self._sync_knowledge_document(
|
||||
space_name=document.space,
|
||||
doc=document,
|
||||
from dbgpt.serve.rag.service.service import Service
|
||||
|
||||
rag_service = Service.get_instance(CFG.SYSTEM_APP)
|
||||
space = rag_service.get({"name": document.space})
|
||||
document_vo = KnowledgeDocumentEntity.to_document_vo(documents)
|
||||
await rag_service._sync_knowledge_document(
|
||||
space_id=space.id,
|
||||
doc_vo=document_vo[0],
|
||||
chunk_parameters=chunk_parameters,
|
||||
)
|
||||
knowledge = KnowledgeFactory.create(
|
||||
|
@ -133,7 +133,7 @@ class ChromaStore(VectorStoreBase):
|
||||
Chunk(
|
||||
content=chroma_result[0],
|
||||
metadata=chroma_result[1] or {},
|
||||
score=chroma_result[2],
|
||||
score=(1 - chroma_result[2]),
|
||||
)
|
||||
)
|
||||
for chroma_result in zip(
|
||||
@ -195,7 +195,7 @@ class ChromaStore(VectorStoreBase):
|
||||
where_filters = {}
|
||||
filters_list = []
|
||||
condition = filters.condition
|
||||
chroma_condition = f"${condition}"
|
||||
chroma_condition = f"${condition.value}"
|
||||
if filters.filters:
|
||||
for filter in filters.filters:
|
||||
if filter.operator:
|
||||
|
Loading…
Reference in New Issue
Block a user