mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
feat: update file name for existing records based on sha256_hash and knowledge/document IDs
This commit is contained in:
parent
056f79a8b8
commit
c2658fa735
|
|
@ -1569,6 +1569,11 @@ class DocumentSerializers(serializers.Serializer):
|
|||
# 读取新文件内容
|
||||
file_content = file.read()
|
||||
|
||||
QuerySet(File).filter(
|
||||
sha256_hash=original_hash,
|
||||
source_id__in=[self.data.get('knowledge_id'), self.data.get('document_id')]
|
||||
).update(file_name=file.name)
|
||||
|
||||
# 查找所有具有相同sha256_hash的文件
|
||||
files_to_update = QuerySet(File).filter(
|
||||
sha256_hash=original_hash,
|
||||
|
|
|
|||
Loading…
Reference in New Issue