feat: update file upload handling to use unique filenames based on document stems

This commit is contained in:
myhloli
2026-03-26 10:54:59 +08:00
parent 185ab841ae
commit d4f1710e42

View File

@@ -677,11 +677,12 @@ def submit_task_sync(
for document in planned_task.documents:
mime_type = mimetypes.guess_type(document.path.name)[0] or "application/octet-stream"
file_handle = stack.enter_context(open(document.path, "rb"))
upload_filename = f"{document.stem}{document.path.suffix}"
files.append(
(
"files",
(
document.path.name,
upload_filename,
file_handle,
mime_type,
),