fix: improve HuggingFace large file upload

- Fix commitUpload missing url parameter for endUpload
- Implement incremental SHA256 hash algorithm for large files
- Use 4MB chunks for SHA256 calculation to reduce memory pressure
- Support files of any size without memory overflow
This commit is contained in:
axibayuit
2025-12-30 21:00:18 +08:00
parent 9898364227
commit d0947e8770
12 changed files with 12 additions and 2 deletions

View File

@@ -113,10 +113,13 @@ export async function onRequestPost(context) {
await db.put(fullId, "", { metadata });
// 结束上传(更新索引等)
// 构造 url 对象用于 endUpload
const url = new URL(request.url);
const uploadContext = {
env,
waitUntil,
uploadConfig
uploadConfig,
url
};
waitUntil(endUpload(uploadContext, fullId, metadata));