feat: update knowledge export methods to use knowledge_id for filtering documents and paragraphs
--bug=1057505 --user=刘瑞斌 【知识库】导出知识库是空白的 https://www.tapd.cn/62980211/s/1719080
This commit is contained in:
parent
dfa66c1d23
commit
56fe631ed6
@ -388,8 +388,8 @@ class KnowledgeSerializer(serializers.Serializer):
|
|||||||
def export_excel(self, with_valid=True):
|
def export_excel(self, with_valid=True):
|
||||||
if with_valid:
|
if with_valid:
|
||||||
self.is_valid(raise_exception=True)
|
self.is_valid(raise_exception=True)
|
||||||
document_list = QuerySet(Document).filter(knowledge_id=self.data.get('id'))
|
document_list = QuerySet(Document).filter(knowledge_id=self.data.get('knowledge_id'))
|
||||||
paragraph_list = native_search(QuerySet(Paragraph).filter(knowledge_id=self.data.get("id")),
|
paragraph_list = native_search(QuerySet(Paragraph).filter(knowledge_id=self.data.get("knowledge_id")),
|
||||||
get_file_content(
|
get_file_content(
|
||||||
os.path.join(PROJECT_DIR, "apps", "knowledge", 'sql',
|
os.path.join(PROJECT_DIR, "apps", "knowledge", 'sql',
|
||||||
'list_paragraph_document_name.sql')))
|
'list_paragraph_document_name.sql')))
|
||||||
@ -408,8 +408,8 @@ class KnowledgeSerializer(serializers.Serializer):
|
|||||||
def export_zip(self, with_valid=True):
|
def export_zip(self, with_valid=True):
|
||||||
if with_valid:
|
if with_valid:
|
||||||
self.is_valid(raise_exception=True)
|
self.is_valid(raise_exception=True)
|
||||||
document_list = QuerySet(Document).filter(knowledge_id=self.data.get('id'))
|
document_list = QuerySet(Document).filter(knowledge_id=self.data.get('knowledge_id'))
|
||||||
paragraph_list = native_search(QuerySet(Paragraph).filter(knowledge_id=self.data.get("id")),
|
paragraph_list = native_search(QuerySet(Paragraph).filter(knowledge_id=self.data.get("knowledge_id")),
|
||||||
get_file_content(
|
get_file_content(
|
||||||
os.path.join(PROJECT_DIR, "apps", "knowledge", 'sql',
|
os.path.join(PROJECT_DIR, "apps", "knowledge", 'sql',
|
||||||
'list_paragraph_document_name.sql')))
|
'list_paragraph_document_name.sql')))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user