mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
Improve file management (#10577)
### What problem does this PR solve? Improve file management. #10287. Passed tests: 1. Create folder `A` and `B`. 2. Upload a file inside `A`, called `file`. 3. Create a KB, called `K`. 3. Link `file` to `K`. 4. Parse `file` inside of `K`. (OK) 5. Move `file` from `A` to `B`. 6. Parse `file` inside of `K`. (OK) 7. Move `file` from `B` to `A`. 8. Parse `file` inside of `K`. (OK) 9. Move entire folder `A` into `B`. (B -> A -> file) 10. Parse `file` inside of `K`. (OK) 11. Delete folder `B`. 12. All clear. (There is no document inside of `K`) ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -476,6 +476,16 @@ class FileService(CommonService):
|
||||
|
||||
return err, files
|
||||
|
||||
@classmethod
|
||||
@DB.connection_context()
|
||||
def list_all_files_by_parent_id(cls, parent_id):
|
||||
try:
|
||||
files = cls.model.select().where((cls.model.parent_id == parent_id) & (cls.model.id != parent_id))
|
||||
return list(files)
|
||||
except Exception:
|
||||
logging.exception("list_by_parent_id failed")
|
||||
raise RuntimeError("Database error (list_by_parent_id)!")
|
||||
|
||||
@staticmethod
|
||||
def parse_docs(file_objs, user_id):
|
||||
exe = ThreadPoolExecutor(max_workers=12)
|
||||
|
||||
Reference in New Issue
Block a user