fix(files): record the source tool in toolChain on Save to Files (#435)

Save to Files posted only the blob, so userFiles.toolChain stayed null and the library showed "Tools Used: None". Thread the producing toolId through /api/v1/files/upload (validated optional field) and store it as a one-element toolChain, matching the pipeline path.

Claude-Session: https://claude.ai/code/session_01UvVCMNUBrgpghk8gye5gav
This commit is contained in:
SnapOtter
2026-07-05 16:05:24 +08:00
committed by GitHub
parent cf884b52cd
commit 47a60e7fad
2 changed files with 14 additions and 2 deletions
@@ -88,6 +88,9 @@ export function ReviewPanel({
const res = await fetch(downloadUrl);
const blob = await res.blob();
const formData = new FormData();
// Record which tool produced this file so the library shows it under
// "Tools Used" (append before the file so the field is parsed first).
if (currentToolId) formData.append("toolId", currentToolId);
formData.append("file", new File([blob], filename, { type: fileType }));
const uploadRes = await fetch("/api/v1/files/upload", {
method: "POST",
@@ -100,7 +103,7 @@ export function ReviewPanel({
setSaveStatus("error");
setTimeout(() => setSaveStatus("idle"), 3000);
}
}, [downloadUrl, filename, fileType]);
}, [downloadUrl, filename, fileType, currentToolId]);
const hasBatchStats =
totalCount != null && totalCount > 1 && successCount != null && failedCount != null;