Skip to content

Commit 56fe631

Browse files
committed
feat: update knowledge export methods to use knowledge_id for filtering documents and paragraphs
--bug=1057505 --user=刘瑞斌 【知识库】导出知识库是空白的 https://www.tapd.cn/62980211/s/1719080
1 parent dfa66c1 commit 56fe631

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

apps/knowledge/serializers/knowledge.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,8 @@ def delete(self):
388388
def export_excel(self, with_valid=True):
389389
if with_valid:
390390
self.is_valid(raise_exception=True)
391-
document_list = QuerySet(Document).filter(knowledge_id=self.data.get('id'))
392-
paragraph_list = native_search(QuerySet(Paragraph).filter(knowledge_id=self.data.get("id")),
391+
document_list = QuerySet(Document).filter(knowledge_id=self.data.get('knowledge_id'))
392+
paragraph_list = native_search(QuerySet(Paragraph).filter(knowledge_id=self.data.get("knowledge_id")),
393393
get_file_content(
394394
os.path.join(PROJECT_DIR, "apps", "knowledge", 'sql',
395395
'list_paragraph_document_name.sql')))
@@ -408,8 +408,8 @@ def export_excel(self, with_valid=True):
408408
def export_zip(self, with_valid=True):
409409
if with_valid:
410410
self.is_valid(raise_exception=True)
411-
document_list = QuerySet(Document).filter(knowledge_id=self.data.get('id'))
412-
paragraph_list = native_search(QuerySet(Paragraph).filter(knowledge_id=self.data.get("id")),
411+
document_list = QuerySet(Document).filter(knowledge_id=self.data.get('knowledge_id'))
412+
paragraph_list = native_search(QuerySet(Paragraph).filter(knowledge_id=self.data.get("knowledge_id")),
413413
get_file_content(
414414
os.path.join(PROJECT_DIR, "apps", "knowledge", 'sql',
415415
'list_paragraph_document_name.sql')))

0 commit comments

Comments
 (0)