mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-12 12:09:03 +08:00
fix ppt file from filemanager error (#2470)
### What problem does this PR solve? #2467 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
parent
e41268efc6
commit
e7dd487779
@ -85,6 +85,7 @@ def convert():
|
|||||||
"location": file.location,
|
"location": file.location,
|
||||||
"size": file.size
|
"size": file.size
|
||||||
})
|
})
|
||||||
|
FileService.set_constant_parser(doc, file.name)
|
||||||
file2document = File2DocumentService.insert({
|
file2document = File2DocumentService.insert({
|
||||||
"id": get_uuid(),
|
"id": get_uuid(),
|
||||||
"file_id": id,
|
"file_id": id,
|
||||||
|
@ -366,14 +366,7 @@ class FileService(CommonService):
|
|||||||
"size": len(blob),
|
"size": len(blob),
|
||||||
"thumbnail": thumbnail(filename, blob)
|
"thumbnail": thumbnail(filename, blob)
|
||||||
}
|
}
|
||||||
if doc["type"] == FileType.VISUAL:
|
self.set_constant_parser(doc, filename)
|
||||||
doc["parser_id"] = ParserType.PICTURE.value
|
|
||||||
if doc["type"] == FileType.AURAL:
|
|
||||||
doc["parser_id"] = ParserType.AUDIO.value
|
|
||||||
if re.search(r"\.(ppt|pptx|pages)$", filename):
|
|
||||||
doc["parser_id"] = ParserType.PRESENTATION.value
|
|
||||||
if re.search(r"\.(eml)$", filename):
|
|
||||||
doc["parser_id"] = ParserType.EMAIL.value
|
|
||||||
DocumentService.insert(doc)
|
DocumentService.insert(doc)
|
||||||
|
|
||||||
FileService.add_file_from_kb(doc, kb_folder["id"], kb.tenant_id)
|
FileService.add_file_from_kb(doc, kb_folder["id"], kb.tenant_id)
|
||||||
@ -381,4 +374,15 @@ class FileService(CommonService):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
err.append(file.filename + ": " + str(e))
|
err.append(file.filename + ": " + str(e))
|
||||||
|
|
||||||
return err, files
|
return err, files
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def set_constant_parser(doc, filename):
|
||||||
|
if doc["type"] == FileType.VISUAL:
|
||||||
|
doc["parser_id"] = ParserType.PICTURE.value
|
||||||
|
if doc["type"] == FileType.AURAL:
|
||||||
|
doc["parser_id"] = ParserType.AUDIO.value
|
||||||
|
if re.search(r"\.(ppt|pptx|pages)$", filename):
|
||||||
|
doc["parser_id"] = ParserType.PRESENTATION.value
|
||||||
|
if re.search(r"\.(eml)$", filename):
|
||||||
|
doc["parser_id"] = ParserType.EMAIL.value
|
Loading…
x
Reference in New Issue
Block a user