Remove source files after processing: delete from uploads, don't copy to processed
This commit is contained in:
parent
b786f84e7c
commit
2f3b27ac57
@ -3,7 +3,6 @@
|
||||
import asyncio
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
@ -104,9 +103,9 @@ async def process_file(file_path: Path, task_id: str):
|
||||
await asyncio.to_thread(build_document, result["segments"], docx_path, config)
|
||||
await asyncio.to_thread(build_document, result["segments"], md_path, config)
|
||||
|
||||
# Также сохраняем исходник
|
||||
src_copy = output_dir / file_path.name
|
||||
await asyncio.to_thread(shutil.copy2, str(file_path), str(src_copy))
|
||||
# Удаляем исходник из uploads после обработки
|
||||
if file_path.exists():
|
||||
await asyncio.to_thread(file_path.unlink)
|
||||
|
||||
result_data = {
|
||||
"docx": str(docx_path),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user